From b4ce664b758089a631795f7e8071597114c21d23 Mon Sep 17 00:00:00 2001 From: renoseHarsh Date: Thu, 8 Aug 2024 23:41:23 +0530 Subject: [PATCH 1/5] Changed Daily rounds consultation updates to Log Update --- src/CAREUI/display/Timeline.tsx | 9 +++++++-- src/Common/constants.tsx | 6 +++--- src/Components/Common/Breadcrumbs.tsx | 1 + .../CriticalCare__Index.res | 2 +- .../ConsultationUpdatesTab.tsx | 2 +- .../Notifications/NotificationsList.tsx | 20 ++++++++++++++++++- .../Patient/DailyRoundListDetails.tsx | 2 +- 7 files changed, 33 insertions(+), 9 deletions(-) diff --git a/src/CAREUI/display/Timeline.tsx b/src/CAREUI/display/Timeline.tsx index 7fcb57f56ea..7840bf8b9c9 100644 --- a/src/CAREUI/display/Timeline.tsx +++ b/src/CAREUI/display/Timeline.tsx @@ -1,4 +1,4 @@ -import { createContext, useContext } from "react"; +import { createContext, useContext, useState } from "react"; import { useTranslation } from "react-i18next"; import { PerformedByModel } from "../../Components/HCX/misc"; import { classNames, formatName } from "../../Utils/utils"; @@ -52,6 +52,9 @@ interface TimelineNodeProps { export const TimelineNode = (props: TimelineNodeProps) => { const name = useContext(TimelineContext); + const [newName, setNewName] = useState(""); + if (!newName && props.name === "daily round details Event") + setNewName(props.name.replace("daily round", "log update")); const { t } = useTranslation(); return ( @@ -95,7 +98,9 @@ export const TimelineNode = (props: TimelineNodeProps) => { {props.titleSuffix || ( <> {`${props.event.type} the `} - {props.name || name} + + {newName || props.name || name} + )}

diff --git a/src/Common/constants.tsx b/src/Common/constants.tsx index 4a490f34e78..b3f007670f5 100644 --- a/src/Common/constants.tsx +++ b/src/Common/constants.tsx @@ -580,7 +580,7 @@ export const NOTIFICATION_EVENTS: NotificationEvent[] = [ }, { id: "PATIENT_CONSULTATION_UPDATED", - text: "Patient Consultation Updated", + text: "Patient Log Update Updated", icon: "l-heart-medical", }, { @@ -605,12 +605,12 @@ export const NOTIFICATION_EVENTS: NotificationEvent[] = [ }, { id: "PATIENT_CONSULTATION_UPDATE_CREATED", - text: "Patient Consultation Update Created", + text: "Patient Log Update Created", icon: "l-heart", }, { id: "PATIENT_CONSULTATION_UPDATE_UPDATED", - text: "Patient Consultation Update Updated", + text: "Patient Log Update Updated", icon: "l-heart-medical", }, { diff --git a/src/Components/Common/Breadcrumbs.tsx b/src/Components/Common/Breadcrumbs.tsx index bb5419bbe10..3149650628a 100644 --- a/src/Components/Common/Breadcrumbs.tsx +++ b/src/Components/Common/Breadcrumbs.tsx @@ -13,6 +13,7 @@ const MENU_TAGS: { [key: string]: string } = { external_results: "External Results", users: "Users", notice_board: "Notice Board", + "daily-rounds": "Log Update", }; const capitalize = (string: string) => { diff --git a/src/Components/CriticalCareRecording/CriticalCare__Index.res b/src/Components/CriticalCareRecording/CriticalCare__Index.res index 0290728fd82..945849f89a6 100644 --- a/src/Components/CriticalCareRecording/CriticalCare__Index.res +++ b/src/Components/CriticalCareRecording/CriticalCare__Index.res @@ -113,7 +113,7 @@ let make = (
-

{str("Consultation Update")}

+

{str("Log Update")}

diff --git a/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx b/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx index d00b77d9bca..c1aa4a1f3ae 100644 --- a/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx +++ b/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx @@ -661,7 +661,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
} - tab1="Daily Rounds" + tab1="Log Updates" onClickTab1={() => setShowEvents(false)} onClickTab2={() => setShowEvents(true)} isTab2Active={showEvents} diff --git a/src/Components/Notifications/NotificationsList.tsx b/src/Components/Notifications/NotificationsList.tsx index 2de3ae7922c..5bf26b1c5fd 100644 --- a/src/Components/Notifications/NotificationsList.tsx +++ b/src/Components/Notifications/NotificationsList.tsx @@ -350,7 +350,25 @@ export default function NotificationsList({ }) .then((res) => { if (res && res.data) { - setData(res.data.results); + const toChangeId = [ + "PATIENT_CONSULTATION_UPDATED", + "PATIENT_CONSULTATION_UPDATE_CREATED", + "PATIENT_CONSULTATION_UPDATE_UPDATED", + ]; + const modifiedData = res.data.results.map((notification: any) => { + if (toChangeId.includes(notification.event)) { + return { + ...notification, + message: notification.message.replace( + "Consultation", + "Log Updates", + ), + }; + } else { + return notification; + } + }); + setData(modifiedData); setUnreadCount( res.data.results?.reduce( (acc: number, result: any) => acc + (result.read_at ? 0 : 1), diff --git a/src/Components/Patient/DailyRoundListDetails.tsx b/src/Components/Patient/DailyRoundListDetails.tsx index 66536c986ca..162025f8864 100644 --- a/src/Components/Patient/DailyRoundListDetails.tsx +++ b/src/Components/Patient/DailyRoundListDetails.tsx @@ -33,7 +33,7 @@ export const DailyRoundListDetails = (props: any) => { return (
Date: Thu, 8 Aug 2024 23:52:14 +0530 Subject: [PATCH 2/5] Removed useState --- src/CAREUI/display/Timeline.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/CAREUI/display/Timeline.tsx b/src/CAREUI/display/Timeline.tsx index 7840bf8b9c9..156405eb688 100644 --- a/src/CAREUI/display/Timeline.tsx +++ b/src/CAREUI/display/Timeline.tsx @@ -1,4 +1,4 @@ -import { createContext, useContext, useState } from "react"; +import { createContext, useContext } from "react"; import { useTranslation } from "react-i18next"; import { PerformedByModel } from "../../Components/HCX/misc"; import { classNames, formatName } from "../../Utils/utils"; @@ -52,9 +52,10 @@ interface TimelineNodeProps { export const TimelineNode = (props: TimelineNodeProps) => { const name = useContext(TimelineContext); - const [newName, setNewName] = useState(""); - if (!newName && props.name === "daily round details Event") - setNewName(props.name.replace("daily round", "log update")); + let newName: string | null = null; + if (props.name === "daily round details Event") { + newName = props.name.replace("daily round", "log update"); + } const { t } = useTranslation(); return ( From d5d4ef071c4c91bfef9e8001ce31185dc0a3fa11 Mon Sep 17 00:00:00 2001 From: renoseHarsh Date: Fri, 9 Aug 2024 00:14:17 +0530 Subject: [PATCH 3/5] Fix double Update --- src/Common/constants.tsx | 4 ++-- .../Facility/ConsultationDetails/ConsultationUpdatesTab.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Common/constants.tsx b/src/Common/constants.tsx index b3f007670f5..1d006ca18fd 100644 --- a/src/Common/constants.tsx +++ b/src/Common/constants.tsx @@ -575,12 +575,12 @@ export const NOTIFICATION_EVENTS: NotificationEvent[] = [ }, { id: "PATIENT_CONSULTATION_CREATED", - text: "Patient Consultation Created", + text: "Patient Log Created", icon: "l-heart", }, { id: "PATIENT_CONSULTATION_UPDATED", - text: "Patient Log Update Updated", + text: "Patient Log Updated", icon: "l-heart-medical", }, { diff --git a/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx b/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx index c1aa4a1f3ae..54a2a45245a 100644 --- a/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx +++ b/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx @@ -661,7 +661,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
} - tab1="Log Updates" + tab1="Log Update" onClickTab1={() => setShowEvents(false)} onClickTab2={() => setShowEvents(true)} isTab2Active={showEvents} From e6da152e97aaaf1a13106b39619a8fb45178c929 Mon Sep 17 00:00:00 2001 From: renoseHarsh Date: Fri, 9 Aug 2024 00:21:34 +0530 Subject: [PATCH 4/5] Added another ID --- src/Components/Notifications/NotificationsList.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Components/Notifications/NotificationsList.tsx b/src/Components/Notifications/NotificationsList.tsx index 5bf26b1c5fd..a71f3db9705 100644 --- a/src/Components/Notifications/NotificationsList.tsx +++ b/src/Components/Notifications/NotificationsList.tsx @@ -354,6 +354,7 @@ export default function NotificationsList({ "PATIENT_CONSULTATION_UPDATED", "PATIENT_CONSULTATION_UPDATE_CREATED", "PATIENT_CONSULTATION_UPDATE_UPDATED", + "PATIENT_CONSULTATION_CREATED", ]; const modifiedData = res.data.results.map((notification: any) => { if (toChangeId.includes(notification.event)) { From 85523c84277b072f92fda64e17e06895963c7f0d Mon Sep 17 00:00:00 2001 From: renoseHarsh Date: Fri, 9 Aug 2024 00:42:11 +0530 Subject: [PATCH 5/5] Plural --- .../Facility/ConsultationDetails/ConsultationUpdatesTab.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx b/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx index 54a2a45245a..c1aa4a1f3ae 100644 --- a/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx +++ b/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx @@ -661,7 +661,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
} - tab1="Log Update" + tab1="Log Updates" onClickTab1={() => setShowEvents(false)} onClickTab2={() => setShowEvents(true)} isTab2Active={showEvents}