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

Adds support for review missed logic #8607 #9486

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
38 changes: 21 additions & 17 deletions src/components/Patient/ManagePatients.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { Link, navigate } from "raviger";
import { ReactNode, useCallback, useEffect, useState } from "react";
import { useTranslation } from "react-i18next";

import { Badge } from "@/components/ui/badge";

import { Avatar } from "@/components/Common/Avatar";
import ButtonV2 from "@/components/Common/ButtonV2";
import { ExportMenu } from "@/components/Common/Export";
Expand Down Expand Up @@ -589,24 +591,26 @@ export const PatientManager = () => {
)}
{patient.review_time &&
!patient.last_consultation?.discharge_date &&
Number(patient.last_consultation?.review_interval) > 0 &&
dayjs().isAfter(patient.review_time) && (
<Chip
size="small"
variant="danger"
startIcon="l-clock"
text="Review Missed"
/>
Number(patient.last_consultation?.review_interval) > 0 && (
<Badge
variant={
dayjs().isAfter(patient.review_time)
? "purple"
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's use the destructive instead 🤔 That should be in line in what we had originally (red color).

Primary should work for the green color.

Try both of those and remove success/purple styles from badge component if they work.

Copy link
Author

Choose a reason for hiding this comment

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

Ok

Copy link
Author

Choose a reason for hiding this comment

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

There is no primary, so I changed the name of 'success' to 'primary.'

Copy link
Contributor

Choose a reason for hiding this comment

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

image

Okay, let's modify the primary to match the chip component's primary style.

While you are at it, can you also update the existing chips in the page to use the new badge component?

Copy link
Contributor

Choose a reason for hiding this comment

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

@Sancharisingh Can you do the above as well (switch existing chips in the component to use badge)?

Copy link
Author

Choose a reason for hiding this comment

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

yes

Copy link
Author

@Sancharisingh Sancharisingh Dec 20, 2024

Choose a reason for hiding this comment

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

Hi @Jacobjeevan,
I updated the Chip to Badge in the ManagePatient file. Should this change be applied project-wide, or is it fine to keep other instances as they are?

Copy link
Contributor

@Jacobjeevan Jacobjeevan Dec 20, 2024

Choose a reason for hiding this comment

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

Hi @Jacobjeevan, I updated the Chip to Badge in the ManagePatient file. Should this change be applied project-wide, or is it fine to keep other instances as they are?

Just this file/component is enough.

Copy link
Author

Choose a reason for hiding this comment

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

Okay.

: "success"
}
className="flex items-center gap-1"
>
<i className="icon-class l-clock"></i>
{dayjs().isAfter(patient.review_time)
? `Review Missed ${Math.abs(
dayjs().diff(dayjs(patient.review_time), "days"),
)} days ago`
: `Review Due in ${Math.abs(
dayjs(patient.review_time).diff(dayjs(), "days"),
)} days`}
</Badge>
)}
{patient.last_consultation?.is_readmission && (
<Chip
size="small"
variant="custom"
className="border-blue-600 bg-blue-100 text-blue-600"
startIcon="l-repeat"
text="Readmission"
/>
)}

{patient.last_consultation?.suggestion === "A" &&
patient.last_consultation.facility === patient.facility &&
!patient.last_consultation.discharge_date && (
Expand Down
4 changes: 4 additions & 0 deletions src/components/ui/badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ const badgeVariants = cva(
warning:
"border-transparent bg-yellow-400 text-gray-900 shadow hover:bg-yellow-500 dark:bg-yellow-400 dark:text-gray-900 dark:hover:bg-yellow-500",
outline: "text-gray-950 dark:text-gray-50",
purple:
"border-transparent bg-purple-200 text-purple-800 shadow hover:bg-purple-300 dark:bg-purple-900 dark:text-purple-100 dark:hover:bg-purple-900",
success:
"border-transparent bg-green-500 text-gray-50 shadow hover:bg-green-500/80 dark:bg-green-900 dark:text-gray-50 dark:hover:bg-green-900/80",
rithviknishad marked this conversation as resolved.
Show resolved Hide resolved
},
},
defaultVariants: {
Expand Down
Loading