import { useTranslation } from "react-i18next"; import { SendouDialog } from "~/components/elements/Dialog"; import { useDateTimeFormat } from "~/hooks/intl/useDateTimeFormat"; import { useSearchParamsTyped } from "~/modules/search-params/hooks"; import { scheduleWeekSearchParams } from "../availability-search-params"; import type { ScheduleWeekView } from "../availability-types"; import { ScheduleDayCell } from "./ScheduleDayCell"; import styles from "./ScheduleWeekDialog.module.css"; import { WeekToggle } from "./WeekToggle"; /** One person's reportable weeks as a read-only day-by-day list of their free time. */ export function ScheduleWeekDialog({ username, weeks, onClose, }: { username: string; weeks: Array; onClose: () => void; }) { const { t } = useTranslation(["schedule"]); const [{ week }, setParams] = useSearchParamsTyped(scheduleWeekSearchParams); const { formatter: headingFormatter } = useDateTimeFormat({ month: "short", day: "numeric", }); const shownWeek = weeks.find((candidate) => candidate.week === week) ?? weeks[0]; return (
{t("schedule:team.weekHeading", { week: shownWeek.weekNumber })} ยท{" "} {headingFormatter.formatRange( shownWeek.days[0].noonAt, shownWeek.days[6].noonAt, )} setParams({ week: value })} />
{shownWeek.reported ? ( ) : (
{t("schedule:team.noSchedule")}
)}
); } function WeekDays({ week }: { week: ScheduleWeekView }) { const { formatter: dayFormatter } = useDateTimeFormat({ weekday: "short", day: "numeric", }); return ( ); }