import type { ObjectifiedHours } from "../../../../ModelMixins/DiscretelyTimeVaryingMixin"; import { formatDateTime } from "../DateFormats"; import * as DTP from "./DateTimePickerStyles"; import { monthNames } from "./utils"; interface HourViewProps { year: number; month: number; day: number; datesObject: ObjectifiedHours; onSelectHour: (hour: number) => void; } export const HourView: React.FC = ({ year, month, day, datesObject, onSelectHour }) => { const dayData = datesObject; const timeOptions = dayData.dates.map((m) => ({ value: m, label: formatDateTime(m) })); if (timeOptions.length <= 24) { return null; } return ( {`Select an hour on ${day} ${monthNames[month + 1]} ${year}`} {dayData.index.map((hour) => ( onSelectHour(hour)}> {hour} : 00 - {hour + 1} : 00 {" "} ({dayData[hour].length} options) ))} ); };