What's coming, grouped by day: times, places, repeats and stays over several days.
Tuesday, December 8
Wednesday, December 9
import { UiSchema } from "@effect/ui"import { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { Schema } from "effect"import { Agenda } from "./ui/uicontext/components/schedule/Agenda.ts"import { expandEvents } from "./ui/uicontext/components/schedule/Events.ts"import { SegmentedControl } from "./ui/uicontext/components/SegmentedControl.ts"import { sx } from "./ui/uicontext/components/Sx.ts"import { space } from "./ui/uicontext/components/tokens.stylex.ts"import { now, teamEvents, today, zone } from "./schedule.ts"// The team's next week as a list: the offsite says which of its two days it is, the migration that// runs past midnight shows under both days, and a press marks the event it would open. Next month// is empty, and says so.const styles = stylex.create({ frame: { display: "grid", gap: space.md, inlineSize: "min(100%, 36rem)", maxBlockSize: 560, overflowY: "auto" },})const Message = UiSchema.TaggedEnum({ OpenedEvent: { occurrence: Schema.String }, PickedRange: { range: Schema.String } })export const TeamAgenda = Html.component({ name: "TeamAgenda", model: Schema.Struct({ selected: Schema.NullOr(Schema.String), range: Schema.String }), message: Message,}).make({ init: () => ({ selected: null, range: "week" }), update: { OpenedEvent: ($, { occurrence }) => $.evolve({ selected: $.model.selected === occurrence ? null : occurrence }), PickedRange: ($, { range }) => $.evolve({ range }), }, view: (h, { selected, range }) => h.div.attrs(sx(styles.frame)).children( SegmentedControl(h, { label: "Range", size: "sm", value: range, options: [{ value: "week", label: "This week" }, { value: "january", label: "January" }], onPick: (value) => Message.PickedRange({ range: value }) }), Agenda(h, { occurrences: expandEvents(teamEvents, "2026-12-01T00:00:00Z", "2027-02-01T00:00:00Z").filter((o) => range === "week" || o.repeats !== true), from: range === "week" ? today : "2027-01-01", days: range === "week" ? 7 : 31, timeZone: zone, now, locale: "en-US", label: "Upcoming", selected, onOpen: (occurrence) => Message.OpenedEvent({ occurrence }), empty: [h.a.key("add").attrs({ href: "#" }).children("Add an event")], }), ),})Installation
pnpm dlx shadcn@latest add checkfu/uicontext/agendaUsage
import { Agenda } from "./ui/uicontext/components/schedule/Agenda.ts"import type { Occurrence } from "./ui/uicontext/components/schedule/Events.ts"const Message = UiSchema.TaggedEnum({ OpenedEvent: { occurrence: Schema.String } })// the next two weeks; days with nothing are left outexport const Upcoming = (h: Html.H<typeof Message.Type>, occurrences: ReadonlyArray<Occurrence>, today: string, now: string) => Agenda(h, { occurrences, from: today, days: 14, timeZone: "America/New_York", now, onOpen: (occurrence) => Message.OpenedEvent({ occurrence }) })API reference
Options
| Name | Type | Description |
|---|---|---|
occurrencesrequired | Occurrence[] | — |
fromrequired | IsoDate | The first day listed, and how many |
daysrequired | number | — |
timeZonerequired | string | The zone days and times read in |
nowrequired | string | The app's current instant (ISO) |
locale | string | — |
hour12 | boolean | — |
onOpenrequired | (occurrence: string) => Message | — |
selected | string | null | The occurrence whose details are open |
empty | View.Children | What an empty period shows under "Nothing scheduled": a button to add an event |
label | string | Names the list: "Upcoming" |