diff --git a/src/CAREUI/display/RecordMeta.tsx b/src/CAREUI/display/RecordMeta.tsx index 818553d9207..d4d32e437c8 100644 --- a/src/CAREUI/display/RecordMeta.tsx +++ b/src/CAREUI/display/RecordMeta.tsx @@ -37,7 +37,7 @@ const RecordMeta = ({ let child = (
{relativeTime(time)} - + {formatDateTime(time)} {user && !inlineUser && ( diff --git a/src/CAREUI/display/Timeline.tsx b/src/CAREUI/display/Timeline.tsx index 7549fbfd69f..276c437056c 100644 --- a/src/CAREUI/display/Timeline.tsx +++ b/src/CAREUI/display/Timeline.tsx @@ -76,23 +76,29 @@ export const TimelineNode = (props: TimelineNodeProps) => { > {props.title || ( -

- {props.event.by && ( - - {formatName(props.event.by)}{" "} - - )} - {props.titleSuffix - ? props.titleSuffix - : `${props.event.type} the ${props.name || name}.`} -

- {props.actions && ( - {props.actions} - )} - +
+

+ {props.event.by && ( + + {formatName(props.event.by)}{" "} + {props.event.by.user_type && + `(${props.event.by.user_type}) `} + + )} + {props.titleSuffix + ? props.titleSuffix + : `${props.event.type} the ${props.name || name}.`} +

+
+ {props.actions && ( + {props.actions} + )} + +
+
)}
diff --git a/src/CAREUI/misc/PaginatedList.tsx b/src/CAREUI/misc/PaginatedList.tsx index 02ee0e3d90e..61c67f97ae2 100644 --- a/src/CAREUI/misc/PaginatedList.tsx +++ b/src/CAREUI/misc/PaginatedList.tsx @@ -7,6 +7,7 @@ import ButtonV2, { import CareIcon from "../icons/CareIcon"; import { classNames } from "../../Utils/utils"; import Pagination from "../../Components/Common/Pagination"; +import Timeline from "../display/Timeline"; const DEFAULT_PER_PAGE_LIMIT = 14; @@ -129,20 +130,26 @@ interface ItemsProps { const Items = (props: ItemsProps) => { const { loading, items } = useContextualized(); + if (loading) { + return null; + } + return ( -
    - {loading && props.shimmer - ? Array.from({ length: props.shimmerCount ?? 8 }).map((_, i) => ( -
  • - {props.shimmer} -
  • - )) - : items.map((item, index, items) => ( -
  • - {props.children(item, items)} -
  • - ))} -
+ +
    + {loading && props.shimmer + ? Array.from({ length: props.shimmerCount ?? 8 }).map((_, i) => ( +
  • + {props.shimmer} +
  • + )) + : items.map((item, index, items) => ( +
  • + {props.children(item, items)} +
  • + ))} +
+
); }; @@ -153,8 +160,16 @@ interface PaginatorProps { hideIfSinglePage?: boolean; } -const Paginator = ({ className, hideIfSinglePage }: PaginatorProps) => { +const Paginator = ({ + className, + hideIfSinglePage, +}: PaginatorProps) => { const { data, perPage, currentPage, setPage } = useContextualized(); + const { loading } = useContextualized(); + + if (loading) { + return null; + } if (hideIfSinglePage && (data?.count ?? 0) <= perPage) { return null; diff --git a/src/Components/Facility/Consultations/DailyRounds/DefaultLogUpdateCard.tsx b/src/Components/Facility/Consultations/DailyRounds/DefaultLogUpdateCard.tsx index a0a4f2280cf..4cb90c900b1 100644 --- a/src/Components/Facility/Consultations/DailyRounds/DefaultLogUpdateCard.tsx +++ b/src/Components/Facility/Consultations/DailyRounds/DefaultLogUpdateCard.tsx @@ -1,5 +1,4 @@ import { useTranslation } from "react-i18next"; -import RecordMeta from "../../../../CAREUI/display/RecordMeta"; import CareIcon from "../../../../CAREUI/icons/CareIcon"; import ButtonV2 from "../../../Common/components/ButtonV2"; import { DailyRoundsModel } from "../../../Patient/models"; @@ -12,87 +11,48 @@ interface Props { onViewDetails: () => void; onUpdateLog?: () => void; } - -const getName = (item: any) => { - return `${item?.first_name} ${item?.last_name} (${item?.user_type})`; -}; - const DefaultLogUpdateCard = ({ round, ...props }: Props) => { const { t } = useTranslation(); - const telemedicine_doctor_update = - round.created_by_telemedicine || round.last_updated_by_telemedicine; - - const by = props.consultationData.assigned_to_object || round.created_by; return ( -
-
-
-
- -
- - {`${by?.first_name} ${by?.last_name}`} - - ({by?.user_type}) - - -
- - {t("created")} - -
-
- {!telemedicine_doctor_update && round?.last_edited_by && ( - - )} - - - - - -
- - - {t("view_details")} - - {props.onUpdateLog && ( - - - {t("update_log")} - - )} -
+
+ + + + +
+ + + {t("view_details")} + + + + {t("update_log")} +
); diff --git a/src/Components/Facility/Consultations/DailyRounds/VirtualNursingAssistantLogUpdateCard.tsx b/src/Components/Facility/Consultations/DailyRounds/VirtualNursingAssistantLogUpdateCard.tsx index 00f33790675..505c2f326fa 100644 --- a/src/Components/Facility/Consultations/DailyRounds/VirtualNursingAssistantLogUpdateCard.tsx +++ b/src/Components/Facility/Consultations/DailyRounds/VirtualNursingAssistantLogUpdateCard.tsx @@ -1,6 +1,4 @@ import { useTranslation } from "react-i18next"; -import RecordMeta from "../../../../CAREUI/display/RecordMeta"; -import CareIcon from "../../../../CAREUI/icons/CareIcon"; import { DailyRoundsModel } from "../../../Patient/models"; import LogUpdateCardAttribute from "./LogUpdateCardAttribute"; @@ -67,20 +65,7 @@ const VirtualNursingAssistantLogUpdateCard = (props: Props) => { const diffKeys = Object.keys(diff); return ( -
-
-
-
- -
- - {t("virtual_nursing_assistant")} - -
- - {t("created")} - -
+
{diffKeys.length > 0 ? ( Object.keys(diff).map((key) => ( diff --git a/src/Components/Facility/Consultations/DailyRoundsList.tsx b/src/Components/Facility/Consultations/DailyRoundsList.tsx index 46072c16dd8..b6954a4e132 100644 --- a/src/Components/Facility/Consultations/DailyRoundsList.tsx +++ b/src/Components/Facility/Consultations/DailyRoundsList.tsx @@ -10,6 +10,7 @@ import PageTitle from "../../Common/PageTitle"; import DailyRoundsFilter from "./DailyRoundsFilter"; import { ConsultationModel } from "../models"; import { useSlugs } from "../../../Common/hooks/useSlug"; +import { TimelineNode } from "../../../CAREUI/display/Timeline"; interface Props { consultation: ConsultationModel; @@ -45,20 +46,34 @@ export default function DailyRoundsList({ consultation }: Props) { - <> - {Array.from({ length: 3 }).map((_, i) => ( - - ))} - + className="flex grow flex-col gap-3"> {(item, items) => { if (item.rounds_type === "AUTOMATED") { return ( - + + + ); } @@ -69,12 +84,30 @@ export default function DailyRoundsList({ consultation }: Props) { : `${consultationUrl}/daily_rounds/${item.id}`; return ( - navigate(itemUrl)} - onUpdateLog={() => navigate(`${itemUrl}/update`)} - /> + + navigate(itemUrl)} + onUpdateLog={() => navigate(`${itemUrl}/update`)} + /> + ); }}