diff --git a/src/components/ui/calendar.tsx b/src/components/ui/calendar.tsx index 15cd3662a93..86a3e1525c5 100644 --- a/src/components/ui/calendar.tsx +++ b/src/components/ui/calendar.tsx @@ -50,7 +50,7 @@ function Calendar({ day_selected: "bg-gray-900 text-gray-50 hover:bg-gray-900 hover:text-gray-50 focus:bg-gray-900 focus:text-gray-50 dark:bg-gray-50 dark:text-gray-900 dark:hover:bg-gray-50 dark:hover:text-gray-900 dark:focus:bg-gray-50 dark:focus:text-gray-900", day_today: - "bg-gray-100 text-gray-900 dark:bg-gray-800 dark:text-gray-50", + "dark:bg-gray-800 dark:text-gray-50 border-2 border-green-500", day_outside: "day-outside text-gray-500 aria-selected:bg-gray-100/50 aria-selected:text-gray-500 dark:text-gray-400 dark:aria-selected:bg-gray-800/50 dark:aria-selected:text-gray-400", day_disabled: "text-gray-500 opacity-50 dark:text-gray-400", diff --git a/src/components/ui/date-range-picker.tsx b/src/components/ui/date-range-picker.tsx index af0ff628593..18e467c58b0 100644 --- a/src/components/ui/date-range-picker.tsx +++ b/src/components/ui/date-range-picker.tsx @@ -36,7 +36,7 @@ export function DateRangePicker({ id="date" variant={"outline"} className={cn( - "justify-start text-left font-normal", + "justify-center text-left font-normal", !date && "text-muted-foreground", )} > diff --git a/src/pages/Appointments/AppointmentsPage.tsx b/src/pages/Appointments/AppointmentsPage.tsx index 39d3431edb5..f6a4c21dd0a 100644 --- a/src/pages/Appointments/AppointmentsPage.tsx +++ b/src/pages/Appointments/AppointmentsPage.tsx @@ -1,5 +1,5 @@ import careConfig from "@careConfig"; -import { CaretDownIcon, CheckIcon, ReloadIcon } from "@radix-ui/react-icons"; +import { CaretDownIcon, CheckIcon } from "@radix-ui/react-icons"; import { PopoverClose } from "@radix-ui/react-popover"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { @@ -107,19 +107,30 @@ function DateRangeDisplay({ dateFrom, dateTo }: DateRangeDisplayProps) { const today = new Date(); - // Case 1: Today only + // Case 1: Today only or Yesterday only if ( - dateFrom === dateQueryString(today) && - dateTo === dateQueryString(today) + (dateFrom === dateQueryString(today) && + dateTo === dateQueryString(today)) || + (dateFrom === dateQueryString(subDays(today, 1)) && + dateTo === dateQueryString(subDays(today, 1))) ) { - return ( - <> - {t("today")} - - ({formatDate(dateFrom, "dd MMM yyyy")}) - - - ); + <> + {dateFrom === dateQueryString(today) ? ( + <> + {t("today")} + + ({formatDate(dateFrom, "dd MMM yyyy")}) + + + ) : ( + <> + {t("yesterday")} + + ({formatDate(dateFrom, "dd MMM yyyy")}) + + + )} + ; } // Case 2: Pre-defined ranges @@ -129,11 +140,6 @@ function DateRangeDisplay({ dateFrom, dateTo }: DateRangeDisplayProps) { from: subDays(today, 7), to: today, }, - { - label: t("yesterday"), - from: subDays(today, 1), - to: subDays(today, 1), - }, { label: t("next_week_short"), from: today, @@ -192,8 +198,8 @@ function DateRangeDisplay({ dateFrom, dateTo }: DateRangeDisplayProps) { return ( <> - {t("on")} - + {t("on")} + {formatDate(dateFrom, "dd MMM yyyy")} @@ -204,8 +210,8 @@ function DateRangeDisplay({ dateFrom, dateTo }: DateRangeDisplayProps) { if (dateFrom && !dateTo) { return ( <> - {t("after")} - + {t("after")} + {formatDate(dateFrom, "dd MMM yyyy")} @@ -215,8 +221,10 @@ function DateRangeDisplay({ dateFrom, dateTo }: DateRangeDisplayProps) { if (!dateFrom && dateTo) { return ( <> - {t("before")} - {formatDate(dateTo, "dd MMM yyyy")} + {t("before")} + + {formatDate(dateTo, "dd MMM yyyy")} + ); } @@ -445,19 +453,19 @@ export default function AppointmentsPage(props: { facilityId?: string }) {
- - - +
- - -
- - - setQParams({ - ...qParams, - date_from: date?.from ? dateQueryString(date.from) : null, - date_to: date?.to ? dateQueryString(date?.to) : null, - }) - } - /> -
-
- -
-
-