Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues/7350/log update consistency #8278

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/CAREUI/display/Timeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ interface TimelineNodeProps {

export const TimelineNode = (props: TimelineNodeProps) => {
const name = useContext(TimelineContext);
let newName: string | null = null;
if (props.name === "daily round details Event") {
newName = props.name.replace("daily round", "log update");
}
Comment on lines +55 to +58
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the right way to solve the problem.

It should instead be changed in the props passed to this component.

Reusable components such as these should not contain any implementation specific to a particular usage.

const { t } = useTranslation();

return (
Expand Down Expand Up @@ -95,7 +99,9 @@ export const TimelineNode = (props: TimelineNodeProps) => {
{props.titleSuffix || (
<>
{`${props.event.type} the `}
<span className="capitalize">{props.name || name}</span>
<span className="capitalize">
{newName || props.name || name}
</span>
</>
)}
</p>
Expand Down
8 changes: 4 additions & 4 deletions src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 Consultation Updated",
text: "Patient Log Updated",
icon: "l-heart-medical",
},
{
Expand All @@ -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",
},
{
Expand Down
1 change: 1 addition & 0 deletions src/Components/Common/Breadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const MENU_TAGS: { [key: string]: string } = {
external_results: "External Results",
users: "Users",
notice_board: "Notice Board",
"daily-rounds": "Log Update",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change the URL's path param itself instead

Suggested change
"daily-rounds": "Log Update",

};

const capitalize = (string: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ let make = (
<div>
<div
className="bg-white px-2 md:px-6 py-5 border-b border-secondary-200 sm:px-6 max-w-5xl mx-auto border mt-4 shadow rounded-lg">
<h1 className="text-4xl sm:text-5xl"> {str("Consultation Update")} </h1>
<h1 className="text-4xl sm:text-5xl"> {str("Log Update")} </h1>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why wrap it in str(...)?

Suggested change
<h1 className="text-4xl sm:text-5xl"> {str("Log Update")} </h1>
<h1 className="text-4xl sm:text-5xl">Log Update</h1>

<div>
<CriticalCare__PageTitle title="General" />
<DailyRound__General others title renderOptionalDescription />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
</span>
</div>
}
tab1="Daily Rounds"
tab1="Log Updates"
onClickTab1={() => setShowEvents(false)}
onClickTab2={() => setShowEvents(true)}
isTab2Active={showEvents}
Expand Down
21 changes: 20 additions & 1 deletion src/Components/Notifications/NotificationsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,26 @@ 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",
"PATIENT_CONSULTATION_CREATED",
];
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;
}
Comment on lines +354 to +370
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to be the right way to do it.

Why is patient consultation created event being renamed to log update? Consultation creation is not relevant to log updates right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you clarify if the way I am modifying data is wrong or is it just the part that I have 'PATIENT_CONSULTATION_CREATED' in toChangeId wrong?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consultation Create notification message need not be replaced with log updates right?

});
setData(modifiedData);
setUnreadCount(
res.data.results?.reduce(
(acc: number, result: any) => acc + (result.read_at ? 0 : 1),
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Patient/DailyRoundListDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const DailyRoundListDetails = (props: any) => {

return (
<Page
title={`Consultation Update #${id}`}
title={`Log Update #${id}`}
backUrl={`/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}/daily-rounds`}
>
<div
Expand Down
Loading