Skip to content

Commit

Permalink
Changed WhatsApp message: doctor connect (#7715)
Browse files Browse the repository at this point in the history
* courtesyTitle function added

* removed unncessary console.log

* replaced genderSalutation with switch statement

* fixes issues

---------

Co-authored-by: rithviknishad <[email protected]>
  • Loading branch information
thedevildude and rithviknishad authored May 9, 2024
1 parent ff6b787 commit f1ff125
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ export const GENDER_TYPES = [
{ id: 1, text: "Male", icon: "M" },
{ id: 2, text: "Female", icon: "F" },
{ id: 3, text: "Transgender", icon: "TRANS" },
];
] as const;

export const SAMPLE_TEST_RESULT = [
{ id: 1, text: "POSITIVE" },
Expand Down
14 changes: 13 additions & 1 deletion src/Components/Facility/DoctorVideoSlideover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ const UserGroups = {
TELEICU: "TeleICU Doctor",
};

const courtesyTitle = (user: UserAssignedModel) => {
if (user.user_type === "Doctor") {
return "Dr." as const;
}

return {
1: "Mr.",
2: "Ms.",
3: "Hey",
}[user.gender!];
};

type UserGroup = keyof typeof UserGroups;

type UserAnnotatedWithGroup = UserAssignedModel & { group?: UserGroup };
Expand Down Expand Up @@ -161,7 +173,7 @@ function UserListItem({ user }: { user: UserAnnotatedWithGroup }) {
e.stopPropagation();
if (!user.alt_phone_number) return;
const phoneNumber = user.alt_phone_number;
const message = `Hey ${user.first_name} ${user.last_name}, I have a query regarding a patient.\n\nPatient Link: ${window.location.href}`;
const message = `${courtesyTitle(user)} ${user.first_name} ${user.last_name}, I have a query regarding a patient.\n\nPatient Link: ${window.location.href}`;
const encodedMessage = encodeURIComponent(message);
const whatsappAppURL = `whatsapp://send?phone=${phoneNumber}&text=${encodedMessage}`;
const whatsappWebURL = `https://web.whatsapp.com/send?phone=${phoneNumber}&text=${encodedMessage}`;
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Users/models.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UserRole } from "../../Common/constants";
import { GENDER_TYPES, UserRole } from "../../Common/constants";
import { DistrictModel, LocalBodyModel, StateModel } from "../Facility/models";

interface HomeFacilityObjectModel {
Expand Down Expand Up @@ -64,7 +64,7 @@ export interface UserAssignedModel extends UserBareMinimum {
phone_number?: string;
alt_phone_number?: string;
video_connect_link: string;
gender?: number;
gender?: (typeof GENDER_TYPES)[number]["id"];
date_of_birth: Date | null;
is_superuser?: boolean;
verified?: boolean;
Expand Down

0 comments on commit f1ff125

Please sign in to comment.