failed
A Calendar week that could not be read, its hours kept.
Source
module Calendar = KitReact.Layouts.Calendar
let reader = Specimen_Reader.reader
let hour = (on): Calendar.DeskGrid.hour => {time: KitReact.Time.clock(reader, {hour: on, minute: 0}), props: {}}
let weekDay = (on): KitReact.Time.t => KitReact.Time.day(reader, {year: 2025, month: 4, day: on})
let weekHead = (on): Calendar.DeskGrid.head => {key: Int.toString(on), column: Day(weekDay(on)), props: {}}
let column = (key): Calendar.DeskGrid.column => {key, children: React.null, props: {}}
@react.component
let make = (~print: Specimen_Print.t) =>
<>
<p className="specimen-case-line">{React.string("A Calendar week that could not be read, its hours kept.")}</p>
<Calendar
printIdentity={print.identity} printSubject={print.subject} printStanding={print.standing} printTenant=?print.tenant
subjectState=Some(Failed({
state: Attention,
standing: [KitReact.Words.Text("This week's bookings could not be read")],
sentence: [KitReact.Words.Text("The booking service did not answer, so bookings may be missing below.")],
action: SecondaryAction({children: React.string("Try again")}),
}))
scopeId="state-failed-calendar-filters"
filtersLabel="Filters"
toolbarProps={{ariaLabel: "Calendar controls"}}
range={
days: KitReact.Time.dayRange(reader, ~first={year: 2025, month: 4, day: 21}, ~last={year: 2025, month: 4, day: 23}),
today: {label: "Today", props: {}},
previous: {label: "Previous week", href: "?week=previous", props: {rel: "prev"}},
next: {label: "Next week", href: "?week=next", props: {rel: "next"}},
date: {group: {id: "failed-date", label: React.string("Go to a date"), kind: KitReact.Roles.DateField.control({name: "date", reader, value: Day(KitReact.Time.day(reader, {year: 2025, month: 4, day: 21})), today: KitReact.Time.day(reader, {year: 2025, month: 4, day: 21}), direction: Either})}},
}
scope=[FormGroup({
id: "state-failed-calendar-scope-form-group",
kind: Select,
label: React.string("Hall"),
labelProps: {htmlFor: "state-failed-calendar-scope"},
controlProps: {id: "state-failed-calendar-scope"},
options: [{label: React.string("All halls"), value: "all", props: {}}],
})]
view={<KitReact.Roles.FormGroup id="state-failed-calendar-view-form-group"
label={React.string("View")}
kind={KitReact.Roles.SegmentedControl.controlSet({name: "state-failed-calendar-view", value: "week", options: Three({value: "week", content: React.string("Week")}, {value: "day", content: React.string("Day")}, {value: "month", content: React.string("Month")})})}
/>}
actions={content: [Calendar.PrimaryAction({children: React.string("New booking")})]}
content={subjectRegion => <>
<Calendar.DeskGrid subjectRegion
columnHeads=[weekHead(21), weekHead(22), weekHead(23)]
hours=[hour(9), hour(10), hour(11), hour(12)]
columns=[column("21"), column("22"), column("23")]
/>
<Calendar.Days subjectRegion>
{React.array([21, 22, 23]->Array.map(on => <Calendar.Day key={Int.toString(on)} day={weekDay(on)} />))}
</Calendar.Days>
</>}
/>
</>