From 5dbf10f1320adf4bcda9a74f4968d4e7abacd71d Mon Sep 17 00:00:00 2001 From: Devdeep Ghosh Date: Fri, 9 Feb 2024 07:41:19 +0530 Subject: [PATCH 01/18] changed base structure --- .../Facility/DoctorVideoSlideover.tsx | 74 +++++++++++-------- 1 file changed, 43 insertions(+), 31 deletions(-) diff --git a/src/Components/Facility/DoctorVideoSlideover.tsx b/src/Components/Facility/DoctorVideoSlideover.tsx index c2cd94e0ded..ac62b07eb9b 100644 --- a/src/Components/Facility/DoctorVideoSlideover.tsx +++ b/src/Components/Facility/DoctorVideoSlideover.tsx @@ -8,6 +8,7 @@ import CareIcon from "../../CAREUI/icons/CareIcon"; import { relativeTime } from "../../Utils/utils"; import useAuthUser from "../../Common/hooks/useAuthUser"; import { triggerGoal } from "../../Integrations/Plausible"; +import Chip from "../../CAREUI/display/Chip"; export default function DoctorVideoSlideover(props: { show: boolean; @@ -55,6 +56,14 @@ export default function DoctorVideoSlideover(props: {

Select a doctor to connect via video

+ {/* + Add a filter to show Doctors, Nurses, and TeleICU Hub separately + */} +
+ + + +
{[ { title: "Doctors", @@ -156,6 +165,39 @@ function UserListItem(props: { user: UserAssignedModel }) { {user.first_name} {user.last_name} + +

+ {!!user.skills.length && ( +
+
+ {user.skills?.map((skill: SkillObjectModel) => ( + +

{skill.name}

+
+ ))} +
+
+ )} +

+ + await navigator.clipboard.writeText( + user?.alt_phone_number || "" + ) + } + > +

+ + Copy Phone number + + +
+ + {user.alt_phone_number} +

+
{user.video_connect_link && (
-

- {!!user.skills.length && ( -
-
- {user.skills?.map((skill: SkillObjectModel) => ( - -

{skill.name}

-
- ))} -
-
- )} -

- - await navigator.clipboard.writeText( - user?.alt_phone_number || "" - ) - } - > -

- - Copy Phone number - - -
- - {user.alt_phone_number} {user.last_login && {relativeTime(user.last_login)}} -

+
From 42ba621ec8b1ace0d0fe0f6d9d1f179dda9bbb7a Mon Sep 17 00:00:00 2001 From: Devdeep Ghosh Date: Thu, 15 Feb 2024 12:35:31 +0530 Subject: [PATCH 02/18] Removed redundant filter logic and structure changes --- .../Facility/DoctorVideoSlideover.tsx | 329 +++++++++--------- 1 file changed, 155 insertions(+), 174 deletions(-) diff --git a/src/Components/Facility/DoctorVideoSlideover.tsx b/src/Components/Facility/DoctorVideoSlideover.tsx index ac62b07eb9b..24f4a913740 100644 --- a/src/Components/Facility/DoctorVideoSlideover.tsx +++ b/src/Components/Facility/DoctorVideoSlideover.tsx @@ -10,6 +10,9 @@ import useAuthUser from "../../Common/hooks/useAuthUser"; import { triggerGoal } from "../../Integrations/Plausible"; import Chip from "../../CAREUI/display/Chip"; +const isHomeUser = (user: UserAssignedModel, facilityId: string) => + user.home_facility_object?.id === facilityId; + export default function DoctorVideoSlideover(props: { show: boolean; facilityId: string; @@ -29,7 +32,9 @@ export default function DoctorVideoSlideover(props: { setDoctors( res.data.results .filter( - (user: any) => user.alt_phone_number || user.video_connect_link + (user: any) => + (user.alt_phone_number || user.video_connect_link) && + (user.user_type === "Doctor" || user.user_type === "Nurse") ) .sort((a: any, b: any) => { return Number(a.last_login) - Number(b.last_login); @@ -56,58 +61,28 @@ export default function DoctorVideoSlideover(props: {

Select a doctor to connect via video

- {/* - Add a filter to show Doctors, Nurses, and TeleICU Hub separately - */}
+ {/* + TODO: Add a filter to show Doctors, Nurses, and TeleICU Hub separately + */}
- {[ - { - title: "Doctors", - user_type: "Doctor", - home: true, - }, - { - title: "Nurse", - user_type: "Nurse", - home: true, - }, - { - title: "TeleICU Hub", - user_type: "Doctor", - home: false, - }, - ].map((type, i) => ( + {doctors.map((doctor, i) => (
-
- {type.title} -
- -
    - {doctors - .filter((doc) => { - const isHomeUser = - (doc.home_facility_object?.id || "") === facilityId; - return ( - doc.user_type === type.user_type && isHomeUser === type.home - ); - }) - .map((doctor) => { - return ; - })} +
      +
))} @@ -115,124 +90,103 @@ export default function DoctorVideoSlideover(props: { ); } -function UserListItem(props: { user: UserAssignedModel }) { +function UserListItem(props: { user: UserAssignedModel; facilityId: string }) { const user = props.user; + const facilityId = props.facilityId; const icon = user.user_type === "Doctor" ? "fa-user-doctor " : " fa-user-nurse"; const authUser = useAuthUser(); return ( -
  • -
  • + - + { + // Show online icon based on last_login + user.last_login && + Number(new Date()) - Number(new Date(user.last_login)) < 60000 ? ( + + ) : ( + + ) } - target="_blank" - rel="noopener noreferrer" - className="flex" - > -
    - { - // Show online icon based on last_login - user.last_login && - Number(new Date()) - Number(new Date(user.last_login)) < 60000 ? ( - - ) : ( - - ) - } -
    -
    -

    - - {user.first_name} {user.last_name} - - -

    - {!!user.skills.length && ( -
    -
    - {user.skills?.map((skill: SkillObjectModel) => ( - -

    {skill.name}

    -
    - ))} -
    -
    - )} -

    - - await navigator.clipboard.writeText( - user?.alt_phone_number || "" - ) - } - > -

    +
    +

    + + {user.first_name} {user.last_name} + + +

    + {!!user.skills.length && ( +
    +
    + {user.skills?.map((skill: SkillObjectModel) => ( + +

    {skill.name}

    - -
    -
    - {user.alt_phone_number} -

    - + )} +

    + + await navigator.clipboard.writeText( + user?.alt_phone_number || "" + ) + } + > +

    + + {user.alt_phone_number} +

    +
    + - {user.last_login && {relativeTime(user.last_login)}} + )} + { + triggerGoal("Doctor Connect Click", { + medium: "WhatsApp", + userId: authUser?.id, + targetUserType: user.user_type, + }); + }} + target="_blank" + rel="noopener noreferrer" + > +
    + + Connect on WhatsApp + + +
    +
    + { + triggerGoal("Doctor Connect Click", { + medium: "Phone Call", + userId: authUser?.id, + targetUserType: user.user_type, + }); + }} + > +
    + + Connect on Phone + + +
    +
    + {user.last_login && {relativeTime(user.last_login)}}
    - -
  • + + ); } From b5f4c6a5802fefad8dcf7f279cee9e5048f5f2eb Mon Sep 17 00:00:00 2001 From: Devdeep Ghosh Date: Thu, 15 Feb 2024 12:56:14 +0530 Subject: [PATCH 03/18] added sorting based on user_type --- src/Components/Facility/DoctorVideoSlideover.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Components/Facility/DoctorVideoSlideover.tsx b/src/Components/Facility/DoctorVideoSlideover.tsx index 24f4a913740..62a33b3a5a8 100644 --- a/src/Components/Facility/DoctorVideoSlideover.tsx +++ b/src/Components/Facility/DoctorVideoSlideover.tsx @@ -32,12 +32,18 @@ export default function DoctorVideoSlideover(props: { setDoctors( res.data.results .filter( - (user: any) => + (user: UserAssignedModel) => (user.alt_phone_number || user.video_connect_link) && (user.user_type === "Doctor" || user.user_type === "Nurse") ) - .sort((a: any, b: any) => { - return Number(a.last_login) - Number(b.last_login); + .sort((a: UserAssignedModel, b: UserAssignedModel) => { + const aIsHomeUser = isHomeUser(a, facilityId); + const bIsHomeUser = isHomeUser(b, facilityId); + return aIsHomeUser === bIsHomeUser + ? 0 + : isHomeUser(a, facilityId) + ? -1 + : 1; }) ); } From 3a9be2af5f7ecad9d42e2691764c122ddf043626 Mon Sep 17 00:00:00 2001 From: Devdeep Ghosh Date: Thu, 15 Feb 2024 14:03:36 +0530 Subject: [PATCH 04/18] added filter Switch --- .../Facility/DoctorVideoSlideover.tsx | 41 +++++++++++++++---- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/src/Components/Facility/DoctorVideoSlideover.tsx b/src/Components/Facility/DoctorVideoSlideover.tsx index 62a33b3a5a8..84d64bbd3da 100644 --- a/src/Components/Facility/DoctorVideoSlideover.tsx +++ b/src/Components/Facility/DoctorVideoSlideover.tsx @@ -9,6 +9,14 @@ import { relativeTime } from "../../Utils/utils"; import useAuthUser from "../../Common/hooks/useAuthUser"; import { triggerGoal } from "../../Integrations/Plausible"; import Chip from "../../CAREUI/display/Chip"; +import Switch from "../../CAREUI/interactive/Switch"; + +enum FilterTypes { + ALL = "All", + DOCTOR = "Doctor", + NURSE = "Nurse", + TELEICU = "TeleICU Hub", +} const isHomeUser = (user: UserAssignedModel, facilityId: string) => user.home_facility_object?.id === facilityId; @@ -20,6 +28,7 @@ export default function DoctorVideoSlideover(props: { }) { const { show, facilityId, setShow } = props; const [doctors, setDoctors] = useState([]); + const [filter, setFilter] = useState(FilterTypes.ALL); const dispatchAction: any = useDispatch(); useEffect(() => { @@ -34,7 +43,16 @@ export default function DoctorVideoSlideover(props: { .filter( (user: UserAssignedModel) => (user.alt_phone_number || user.video_connect_link) && - (user.user_type === "Doctor" || user.user_type === "Nurse") + (user.user_type === "Doctor" || user.user_type === "Nurse") && + (filter === FilterTypes.ALL || + (filter === FilterTypes.DOCTOR && + isHomeUser(user, facilityId) && + user.user_type === "Doctor") || + (filter === FilterTypes.NURSE && + isHomeUser(user, facilityId) && + user.user_type === "Nurse") || + (filter === FilterTypes.TELEICU && + !isHomeUser(user, facilityId))) ) .sort((a: UserAssignedModel, b: UserAssignedModel) => { const aIsHomeUser = isHomeUser(a, facilityId); @@ -54,7 +72,7 @@ export default function DoctorVideoSlideover(props: { if (show) { fetchUsers(); } - }, [show, facilityId]); + }, [show, facilityId, filter]); return ( Select a doctor to connect via video

    -
    - {/* - TODO: Add a filter to show Doctors, Nurses, and TeleICU Hub separately - */} - - - +
    + ({ ...acc, [type]: type }), + {} + ) as Record + } + selected={filter} + onChange={(tab) => setFilter(tab)} + size="md" + />
    {doctors.map((doctor, i) => (
    Date: Thu, 15 Feb 2024 14:19:51 +0530 Subject: [PATCH 05/18] added spacing between items --- src/Components/Facility/DoctorVideoSlideover.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Components/Facility/DoctorVideoSlideover.tsx b/src/Components/Facility/DoctorVideoSlideover.tsx index 84d64bbd3da..dfc2f33c83b 100644 --- a/src/Components/Facility/DoctorVideoSlideover.tsx +++ b/src/Components/Facility/DoctorVideoSlideover.tsx @@ -189,7 +189,7 @@ function UserListItem(props: { user: UserAssignedModel; facilityId: string }) {
    )} -

    +

    {user.alt_phone_number}

    -
    +
    {user.video_connect_link && ( Date: Mon, 19 Feb 2024 13:53:47 +0530 Subject: [PATCH 06/18] fixed unnecessary api calls on filter switching --- .../Facility/DoctorVideoSlideover.tsx | 62 ++++++++++--------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/src/Components/Facility/DoctorVideoSlideover.tsx b/src/Components/Facility/DoctorVideoSlideover.tsx index dfc2f33c83b..b6527c49de6 100644 --- a/src/Components/Facility/DoctorVideoSlideover.tsx +++ b/src/Components/Facility/DoctorVideoSlideover.tsx @@ -28,6 +28,9 @@ export default function DoctorVideoSlideover(props: { }) { const { show, facilityId, setShow } = props; const [doctors, setDoctors] = useState([]); + const [filteredDoctors, setFilteredDoctors] = useState( + [] + ); const [filter, setFilter] = useState(FilterTypes.ALL); const dispatchAction: any = useDispatch(); @@ -38,32 +41,7 @@ export default function DoctorVideoSlideover(props: { getFacilityUsers(facilityId, { limit: 50 }) ); if (res?.data) { - setDoctors( - res.data.results - .filter( - (user: UserAssignedModel) => - (user.alt_phone_number || user.video_connect_link) && - (user.user_type === "Doctor" || user.user_type === "Nurse") && - (filter === FilterTypes.ALL || - (filter === FilterTypes.DOCTOR && - isHomeUser(user, facilityId) && - user.user_type === "Doctor") || - (filter === FilterTypes.NURSE && - isHomeUser(user, facilityId) && - user.user_type === "Nurse") || - (filter === FilterTypes.TELEICU && - !isHomeUser(user, facilityId))) - ) - .sort((a: UserAssignedModel, b: UserAssignedModel) => { - const aIsHomeUser = isHomeUser(a, facilityId); - const bIsHomeUser = isHomeUser(b, facilityId); - return aIsHomeUser === bIsHomeUser - ? 0 - : isHomeUser(a, facilityId) - ? -1 - : 1; - }) - ); + setDoctors(res.data.results); } } else { setDoctors([]); @@ -72,7 +50,35 @@ export default function DoctorVideoSlideover(props: { if (show) { fetchUsers(); } - }, [show, facilityId, filter]); + }, [show, facilityId]); + + useEffect(() => { + setFilteredDoctors( + doctors + .filter( + (user: UserAssignedModel) => + (user.alt_phone_number || user.video_connect_link) && + (user.user_type === "Doctor" || user.user_type === "Nurse") && + (filter === FilterTypes.ALL || + (filter === FilterTypes.DOCTOR && + isHomeUser(user, facilityId) && + user.user_type === "Doctor") || + (filter === FilterTypes.NURSE && + isHomeUser(user, facilityId) && + user.user_type === "Nurse") || + (filter === FilterTypes.TELEICU && !isHomeUser(user, facilityId))) + ) + .sort((a: UserAssignedModel, b: UserAssignedModel) => { + const aIsHomeUser = isHomeUser(a, facilityId); + const bIsHomeUser = isHomeUser(b, facilityId); + return aIsHomeUser === bIsHomeUser + ? 0 + : isHomeUser(a, facilityId) + ? -1 + : 1; + }) + ); + }, [doctors, filter]); return (
    - {doctors.map((doctor, i) => ( + {filteredDoctors.map((doctor, i) => (
    Date: Mon, 19 Feb 2024 14:27:13 +0530 Subject: [PATCH 07/18] replaced useDispatch with useQuery and code refactor --- .../Facility/DoctorVideoSlideover.tsx | 83 ++++++++----------- src/Redux/api.tsx | 3 +- 2 files changed, 38 insertions(+), 48 deletions(-) diff --git a/src/Components/Facility/DoctorVideoSlideover.tsx b/src/Components/Facility/DoctorVideoSlideover.tsx index b6527c49de6..bf0b39624a8 100644 --- a/src/Components/Facility/DoctorVideoSlideover.tsx +++ b/src/Components/Facility/DoctorVideoSlideover.tsx @@ -1,7 +1,5 @@ import { useEffect, useState } from "react"; -import { useDispatch } from "react-redux"; import SlideOver from "../../CAREUI/interactive/SlideOver"; -import { getFacilityUsers } from "../../Redux/actions"; import { UserAssignedModel } from "../Users/models"; import { SkillObjectModel } from "../Users/models"; import CareIcon from "../../CAREUI/icons/CareIcon"; @@ -10,6 +8,8 @@ import useAuthUser from "../../Common/hooks/useAuthUser"; import { triggerGoal } from "../../Integrations/Plausible"; import Chip from "../../CAREUI/display/Chip"; import Switch from "../../CAREUI/interactive/Switch"; +import useQuery from "../../Utils/request/useQuery"; +import routes from "../../Redux/api"; enum FilterTypes { ALL = "All", @@ -27,58 +27,47 @@ export default function DoctorVideoSlideover(props: { setShow: (show: boolean) => void; }) { const { show, facilityId, setShow } = props; - const [doctors, setDoctors] = useState([]); const [filteredDoctors, setFilteredDoctors] = useState( [] ); const [filter, setFilter] = useState(FilterTypes.ALL); - const dispatchAction: any = useDispatch(); - useEffect(() => { - const fetchUsers = async () => { - if (facilityId) { - const res = await dispatchAction( - getFacilityUsers(facilityId, { limit: 50 }) - ); - if (res?.data) { - setDoctors(res.data.results); - } - } else { - setDoctors([]); - } - }; - if (show) { - fetchUsers(); - } - }, [show, facilityId]); + const { data: users, loading } = useQuery(routes.getFacilityUsers, { + prefetch: show, + pathParams: { facility_id: facilityId }, + query: { limit: 50 }, + }); useEffect(() => { - setFilteredDoctors( - doctors - .filter( - (user: UserAssignedModel) => - (user.alt_phone_number || user.video_connect_link) && - (user.user_type === "Doctor" || user.user_type === "Nurse") && - (filter === FilterTypes.ALL || - (filter === FilterTypes.DOCTOR && - isHomeUser(user, facilityId) && - user.user_type === "Doctor") || - (filter === FilterTypes.NURSE && - isHomeUser(user, facilityId) && - user.user_type === "Nurse") || - (filter === FilterTypes.TELEICU && !isHomeUser(user, facilityId))) - ) - .sort((a: UserAssignedModel, b: UserAssignedModel) => { - const aIsHomeUser = isHomeUser(a, facilityId); - const bIsHomeUser = isHomeUser(b, facilityId); - return aIsHomeUser === bIsHomeUser - ? 0 - : isHomeUser(a, facilityId) - ? -1 - : 1; - }) - ); - }, [doctors, filter]); + if (users?.results && !loading) { + setFilteredDoctors( + users.results + .filter( + (user: UserAssignedModel) => + (user.alt_phone_number || user.video_connect_link) && + (user.user_type === "Doctor" || user.user_type === "Nurse") && + (filter === FilterTypes.ALL || + (filter === FilterTypes.DOCTOR && + isHomeUser(user, facilityId) && + user.user_type === "Doctor") || + (filter === FilterTypes.NURSE && + isHomeUser(user, facilityId) && + user.user_type === "Nurse") || + (filter === FilterTypes.TELEICU && + !isHomeUser(user, facilityId))) + ) + .sort((a: UserAssignedModel, b: UserAssignedModel) => { + const aIsHomeUser = isHomeUser(a, facilityId); + const bIsHomeUser = isHomeUser(b, facilityId); + return aIsHomeUser === bIsHomeUser + ? 0 + : isHomeUser(a, facilityId) + ? -1 + : 1; + }) + ); + } + }, [facilityId, filter, loading, users?.results]); return ( >(), + TRes: Type>(), }, listFacilityAssetLocation: { From 9b5314c39490c15dd1b00251a85859b9eae46de3 Mon Sep 17 00:00:00 2001 From: Devdeep Ghosh Date: Mon, 19 Feb 2024 19:12:10 +0530 Subject: [PATCH 08/18] code refactor --- .../Facility/DoctorVideoSlideover.tsx | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/Components/Facility/DoctorVideoSlideover.tsx b/src/Components/Facility/DoctorVideoSlideover.tsx index bf0b39624a8..ff75c7e17c1 100644 --- a/src/Components/Facility/DoctorVideoSlideover.tsx +++ b/src/Components/Facility/DoctorVideoSlideover.tsx @@ -39,24 +39,25 @@ export default function DoctorVideoSlideover(props: { }); useEffect(() => { + const filterDoctors = (users: UserAssignedModel[]) => { + return users.filter( + (user: UserAssignedModel) => + (user.alt_phone_number || user.video_connect_link) && + (user.user_type === "Doctor" || user.user_type === "Nurse") && + (filter === FilterTypes.ALL || + (filter === FilterTypes.DOCTOR && + isHomeUser(user, facilityId) && + user.user_type === "Doctor") || + (filter === FilterTypes.NURSE && + isHomeUser(user, facilityId) && + user.user_type === "Nurse") || + (filter === FilterTypes.TELEICU && !isHomeUser(user, facilityId))) + ); + }; if (users?.results && !loading) { setFilteredDoctors( - users.results - .filter( - (user: UserAssignedModel) => - (user.alt_phone_number || user.video_connect_link) && - (user.user_type === "Doctor" || user.user_type === "Nurse") && - (filter === FilterTypes.ALL || - (filter === FilterTypes.DOCTOR && - isHomeUser(user, facilityId) && - user.user_type === "Doctor") || - (filter === FilterTypes.NURSE && - isHomeUser(user, facilityId) && - user.user_type === "Nurse") || - (filter === FilterTypes.TELEICU && - !isHomeUser(user, facilityId))) - ) - .sort((a: UserAssignedModel, b: UserAssignedModel) => { + filterDoctors(users.results).sort( + (a: UserAssignedModel, b: UserAssignedModel) => { const aIsHomeUser = isHomeUser(a, facilityId); const bIsHomeUser = isHomeUser(b, facilityId); return aIsHomeUser === bIsHomeUser @@ -64,7 +65,8 @@ export default function DoctorVideoSlideover(props: { : isHomeUser(a, facilityId) ? -1 : 1; - }) + } + ) ); } }, [facilityId, filter, loading, users?.results]); From 9e2f8fab2f0ce6ab8c08a0a5d758a5368104a074 Mon Sep 17 00:00:00 2001 From: Devdeep Ghosh Date: Mon, 19 Feb 2024 19:29:37 +0530 Subject: [PATCH 09/18] fixed deepScan issues --- .../Facility/DoctorVideoSlideover.tsx | 37 ++++++++++--------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/Components/Facility/DoctorVideoSlideover.tsx b/src/Components/Facility/DoctorVideoSlideover.tsx index ff75c7e17c1..43d8a9fd99f 100644 --- a/src/Components/Facility/DoctorVideoSlideover.tsx +++ b/src/Components/Facility/DoctorVideoSlideover.tsx @@ -136,18 +136,18 @@ function UserListItem(props: { user: UserAssignedModel; facilityId: string }) { role="option" tabIndex={-1} > - { + window.open( + user.alt_phone_number + ? `https://api.whatsapp.com/send/?phone=${encodeURIComponent( + user.alt_phone_number + )}&text=${encodeURIComponent( + `Hey ${user.first_name} ${user.last_name}, I have a query regarding a patient.\n\nPatient Link: ${window.location.href}` + )}` + : "#" + ); + }} className="flex" >
    @@ -179,7 +179,10 @@ function UserListItem(props: { user: UserAssignedModel; facilityId: string }) {
    {user.skills?.map((skill: SkillObjectModel) => ( - +

    {skill.name}

    ))} @@ -196,12 +199,12 @@ function UserListItem(props: { user: UserAssignedModel; facilityId: string }) { ) } > -
    +

    Copy Phone number -

    +

    {user.alt_phone_number}

    @@ -213,7 +216,7 @@ function UserListItem(props: { user: UserAssignedModel; facilityId: string }) { onClick={() => { triggerGoal("Doctor Connect Click", { medium: "Video Call", - userId: authUser?.id, + userId: authUser.id, targetUserType: user.user_type, }); }} @@ -278,7 +281,7 @@ function UserListItem(props: { user: UserAssignedModel; facilityId: string }) { {user.last_login && {relativeTime(user.last_login)}}
    - +
    ); } From 5d10f9816494411ee59000cccabac10a8f60bfb3 Mon Sep 17 00:00:00 2001 From: Devdeep Ghosh Date: Mon, 19 Feb 2024 19:34:51 +0530 Subject: [PATCH 10/18] reverted back certain changes --- .../Facility/DoctorVideoSlideover.tsx | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Components/Facility/DoctorVideoSlideover.tsx b/src/Components/Facility/DoctorVideoSlideover.tsx index 43d8a9fd99f..ae7d396cb79 100644 --- a/src/Components/Facility/DoctorVideoSlideover.tsx +++ b/src/Components/Facility/DoctorVideoSlideover.tsx @@ -136,18 +136,18 @@ function UserListItem(props: { user: UserAssignedModel; facilityId: string }) { role="option" tabIndex={-1} > -
    { - window.open( - user.alt_phone_number - ? `https://api.whatsapp.com/send/?phone=${encodeURIComponent( - user.alt_phone_number - )}&text=${encodeURIComponent( - `Hey ${user.first_name} ${user.last_name}, I have a query regarding a patient.\n\nPatient Link: ${window.location.href}` - )}` - : "#" - ); - }} +
    @@ -281,7 +281,7 @@ function UserListItem(props: { user: UserAssignedModel; facilityId: string }) { {user.last_login && {relativeTime(user.last_login)}}
    -
    + ); } From 613c859aedc312adef83ea2db6ad12d324613d3c Mon Sep 17 00:00:00 2001 From: Devdeep Ghosh Date: Mon, 19 Feb 2024 19:48:12 +0530 Subject: [PATCH 11/18] redundant null check fix --- src/Components/Facility/DoctorVideoSlideover.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Components/Facility/DoctorVideoSlideover.tsx b/src/Components/Facility/DoctorVideoSlideover.tsx index ae7d396cb79..44686a2fd68 100644 --- a/src/Components/Facility/DoctorVideoSlideover.tsx +++ b/src/Components/Facility/DoctorVideoSlideover.tsx @@ -199,12 +199,12 @@ function UserListItem(props: { user: UserAssignedModel; facilityId: string }) { ) } > -

    + Copy Phone number -

    + {user.alt_phone_number}

    @@ -244,7 +244,7 @@ function UserListItem(props: { user: UserAssignedModel; facilityId: string }) { onClick={() => { triggerGoal("Doctor Connect Click", { medium: "WhatsApp", - userId: authUser?.id, + userId: authUser.id, targetUserType: user.user_type, }); }} @@ -265,7 +265,7 @@ function UserListItem(props: { user: UserAssignedModel; facilityId: string }) { onClick={() => { triggerGoal("Doctor Connect Click", { medium: "Phone Call", - userId: authUser?.id, + userId: authUser.id, targetUserType: user.user_type, }); }} From 9ccbd24a2539c7fd070c95255ddb91e7d153797b Mon Sep 17 00:00:00 2001 From: Devdeep Ghosh <63492939+thedevildude@users.noreply.github.com> Date: Tue, 20 Feb 2024 13:50:00 +0530 Subject: [PATCH 12/18] suggestion commit Co-authored-by: Rithvik Nishad --- src/Components/Facility/DoctorVideoSlideover.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/Facility/DoctorVideoSlideover.tsx b/src/Components/Facility/DoctorVideoSlideover.tsx index 44686a2fd68..bd10eac19b3 100644 --- a/src/Components/Facility/DoctorVideoSlideover.tsx +++ b/src/Components/Facility/DoctorVideoSlideover.tsx @@ -62,7 +62,7 @@ export default function DoctorVideoSlideover(props: { const bIsHomeUser = isHomeUser(b, facilityId); return aIsHomeUser === bIsHomeUser ? 0 - : isHomeUser(a, facilityId) + : aIsHomeUser ? -1 : 1; } From 1130bd40c72a14db5593dd9e602a913e277330ec Mon Sep 17 00:00:00 2001 From: rithviknishad Date: Tue, 20 Feb 2024 18:59:48 +0530 Subject: [PATCH 13/18] fix lint --- src/Components/Facility/DoctorVideoSlideover.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Components/Facility/DoctorVideoSlideover.tsx b/src/Components/Facility/DoctorVideoSlideover.tsx index bd10eac19b3..1958264d714 100644 --- a/src/Components/Facility/DoctorVideoSlideover.tsx +++ b/src/Components/Facility/DoctorVideoSlideover.tsx @@ -60,11 +60,7 @@ export default function DoctorVideoSlideover(props: { (a: UserAssignedModel, b: UserAssignedModel) => { const aIsHomeUser = isHomeUser(a, facilityId); const bIsHomeUser = isHomeUser(b, facilityId); - return aIsHomeUser === bIsHomeUser - ? 0 - : aIsHomeUser - ? -1 - : 1; + return aIsHomeUser === bIsHomeUser ? 0 : aIsHomeUser ? -1 : 1; } ) ); From 67c1568eadcefdbe17be3254dbbf6ab583edff9a Mon Sep 17 00:00:00 2001 From: Devdeep Ghosh Date: Mon, 4 Mar 2024 12:37:20 +0530 Subject: [PATCH 14/18] fix linting --- src/Components/Facility/DoctorVideoSlideover.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Components/Facility/DoctorVideoSlideover.tsx b/src/Components/Facility/DoctorVideoSlideover.tsx index f6b2117b485..b673d6dd3b8 100644 --- a/src/Components/Facility/DoctorVideoSlideover.tsx +++ b/src/Components/Facility/DoctorVideoSlideover.tsx @@ -148,14 +148,14 @@ function UserListItem(props: { user: UserAssignedModel; facilityId: string }) { >
    { - // Show online icon based on last_login - user.last_login && - Number(new Date()) - Number(new Date(user.last_login)) < 60000 ? ( - - ) : ( - - ) - } + // Show online icon based on last_login + user.last_login && + Number(new Date()) - Number(new Date(user.last_login)) < 60000 ? ( + + ) : ( + + ) + }

    From 3555d56a750084ddb12c040402da24a5a3a29292 Mon Sep 17 00:00:00 2001 From: Devdeep Ghosh Date: Mon, 11 Mar 2024 19:04:19 +0530 Subject: [PATCH 15/18] reverted back to old layout --- .../Facility/DoctorVideoSlideover.tsx | 199 +++++++++--------- 1 file changed, 101 insertions(+), 98 deletions(-) diff --git a/src/Components/Facility/DoctorVideoSlideover.tsx b/src/Components/Facility/DoctorVideoSlideover.tsx index b673d6dd3b8..9252a9a368f 100644 --- a/src/Components/Facility/DoctorVideoSlideover.tsx +++ b/src/Components/Facility/DoctorVideoSlideover.tsx @@ -6,7 +6,6 @@ import CareIcon, { IconName } from "../../CAREUI/icons/CareIcon"; import { relativeTime } from "../../Utils/utils"; import useAuthUser from "../../Common/hooks/useAuthUser"; import { triggerGoal } from "../../Integrations/Plausible"; -import Chip from "../../CAREUI/display/Chip"; import Switch from "../../CAREUI/interactive/Switch"; import useQuery from "../../Utils/request/useQuery"; import routes from "../../Redux/api"; @@ -72,7 +71,7 @@ export default function DoctorVideoSlideover(props: { open={show} setOpen={setShow} title="Doctor Connect" - dialogClass="md:w-[400px]" + dialogClass="md:w-[450px]" > {/* Title and close button */}

    @@ -117,7 +116,6 @@ function UserListItem(props: { user: UserAssignedModel; facilityId: string }) { const facilityId = props.facilityId; const icon: IconName = user.user_type === "Doctor" ? "l-user-md" : "l-user-nurse"; - const authUser = useAuthUser(); return (

  • -
    -

    +

    +
    {user.first_name} {user.last_name} - - + ( + {isHomeUser(user, facilityId) ? user.user_type - : `TeleICU Hub ${user.user_type}` - } - size="small" - /> -

    + : `TeleICU Hub ${user.user_type}`} + ) + + + +
    {!!user.skills.length && (
    @@ -185,99 +183,104 @@ function UserListItem(props: { user: UserAssignedModel; facilityId: string }) {
    )} -

    - - await navigator.clipboard.writeText( - user?.alt_phone_number || "" - ) - } - > - - - Copy Phone number - - - - - {user.alt_phone_number} -

    -
    -
    - {user.video_connect_link && ( - { - triggerGoal("Doctor Connect Click", { - medium: "Video Call", - userId: authUser.id, - targetUserType: user.user_type, - }); - }} - target="_blank" - rel="noopener noreferrer" - > -
    - - Connect on a Video Call - - -
    -
    - )} +
  • ); } + +function DoctorConnectButtons(props: { user: UserAssignedModel }) { + const user = props.user; + const authUser = useAuthUser(); + return ( + + ); +} From 02623c741274e7343dcb30f28823b0163143b39e Mon Sep 17 00:00:00 2001 From: Devdeep Ghosh Date: Thu, 21 Mar 2024 05:15:51 +0530 Subject: [PATCH 16/18] post merge fixes --- src/Components/Facility/DoctorVideoSlideover.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Components/Facility/DoctorVideoSlideover.tsx b/src/Components/Facility/DoctorVideoSlideover.tsx index b7fbcc19fee..0a8f754d990 100644 --- a/src/Components/Facility/DoctorVideoSlideover.tsx +++ b/src/Components/Facility/DoctorVideoSlideover.tsx @@ -213,7 +213,10 @@ function UserListItem(props: { user: UserAssignedModel; facilityId: string }) { ) - +
    {!!user.skills.length && (
    @@ -259,7 +262,10 @@ function UserListItem(props: { user: UserAssignedModel; facilityId: string }) { ); } -function DoctorConnectButtons(props: { user: UserAssignedModel }) { +function DoctorConnectButtons(props: { + user: UserAssignedModel; + connectOnWhatsApp: (e: React.MouseEvent) => void; +}) { const user = props.user; const authUser = useAuthUser(); return ( @@ -285,7 +291,7 @@ function DoctorConnectButtons(props: { user: UserAssignedModel }) {
    )} - +
    Connect on WhatsApp From 7519f993c3d07ee5994f4a40d9c2502a90d221de Mon Sep 17 00:00:00 2001 From: Devdeep Ghosh Date: Thu, 21 Mar 2024 10:18:07 +0530 Subject: [PATCH 17/18] tooltip direction fixed --- src/Components/Facility/DoctorVideoSlideover.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Components/Facility/DoctorVideoSlideover.tsx b/src/Components/Facility/DoctorVideoSlideover.tsx index 0a8f754d990..e234fd09354 100644 --- a/src/Components/Facility/DoctorVideoSlideover.tsx +++ b/src/Components/Facility/DoctorVideoSlideover.tsx @@ -284,7 +284,7 @@ function DoctorConnectButtons(props: { rel="noopener noreferrer" >
    - + Connect on a Video Call @@ -293,9 +293,7 @@ function DoctorConnectButtons(props: { )}
    - - Connect on WhatsApp - + Connect on WhatsApp
    @@ -310,7 +308,7 @@ function DoctorConnectButtons(props: { }} >
    - Connect on Phone + Connect on Phone
    From 5f3ab009aebd1e6ca894e6ea984d4540b68fae52 Mon Sep 17 00:00:00 2001 From: Devdeep Ghosh Date: Tue, 26 Mar 2024 13:50:05 +0530 Subject: [PATCH 18/18] minor bug fix --- src/Components/Facility/DoctorVideoSlideover.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/Facility/DoctorVideoSlideover.tsx b/src/Components/Facility/DoctorVideoSlideover.tsx index 016f14544dd..a8732f959eb 100644 --- a/src/Components/Facility/DoctorVideoSlideover.tsx +++ b/src/Components/Facility/DoctorVideoSlideover.tsx @@ -309,7 +309,7 @@ function DoctorConnectButtons(props: { >
    Connect on Phone - +