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

Changes 'CONSULTATION NOTES' to 'GENERAL INSTRUCTIONS (ADVICE)' #8216

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import type { ReactNode } from "react";
import consultationMessage from "../../../../../src/Locale/en/Consultation.json";
interface IProps {
values: Record<string, unknown>;
}

type ConsultationMessageKeys = keyof typeof consultationMessage;
Copy link
Member

Choose a reason for hiding this comment

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

You shouldn't be importing the translations file directly. Use useTranslation hook to retrieve the display text instead. Ref: https://github.com/coronasafe/care_fe/blob/f76248c997c1153a9f859511a6678ada18dd0af9/src/Components/Facility/Consultations/DailyRoundsList.tsx#L24

/**
* object - array, date
*/
Expand Down Expand Up @@ -84,11 +86,15 @@ export default function GenericEvent(props: IProps) {
<div className="flex w-full flex-col gap-4 rounded-lg border border-secondary-400 p-4 @container">
{Object.entries(props.values).map(([key, value]) => (
<div className="flex w-full flex-col items-start gap-2">
<span className="text-xs uppercase text-secondary-700">
{key === "consultation_notes"
? "General Instructions (Advice)"
: key.replaceAll(/_/g, " ")}
</span>
{(key as ConsultationMessageKeys) in consultationMessage ? (
<span className="text-xs text-secondary-700">
{consultationMessage[key as ConsultationMessageKeys]}
</span>
) : (
<span className="text-xs capitalize text-secondary-700">
{key.replaceAll(/_/g, " ")}
</span>
)}
<span className="break-all text-sm font-semibold text-secondary-700">
{formatValue(value, key)}
</span>
Expand Down
3 changes: 2 additions & 1 deletion src/Locale/en/Consultation.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@
"encounter_date_field_label__HI": "Date & Time of Consultation",
"encounter_date_field_label__R": "Date & Time of Consultation",
"back_dated_encounter_date_caution": "You are creating an encounter for",
"encounter_duration_confirmation": "The duration of this encounter would be"
"encounter_duration_confirmation": "The duration of this encounter would be",
"consultation_notes": "General Instructions (Advice)"
}
Loading