npm install @idyeah/diya
GitHub
Appearance
Color scheme
All screens

Bookings agenda

The staff side of bookings: the day’s appointments as a list, a drawer for each and a quick way to add one.

Viewport

1440 × 900

Try this

Press Next day three times for an empty day, open Hannah Becker to check her in or move her to 5:00 PM (Rafael is busy), or add a new booking.

Built with

Get code

One file, ready to paste. Steps 1 and 2 happen once per app.

Step 1: Install

Terminal, in your app’s folder
npm install @idyeah/diya lucide-react

Once per app. Screens draw their icons with lucide-react, so it comes along with DIYA.

No app yet? npm create diya@latest sets up Next.js or Vite with the styles and provider already in place. Then skip to step 3.

Step 2: Add the styles and provider

Once, at your app’s root: app/layout.tsx in Next.js, src/main.tsx in Vite. DIYA Sans comes with it.

Root layout or entry
import '@idyeah/diya/styles.css'
import { DiyaProvider } from '@idyeah/diya'

<DiyaProvider theme="dark">
  {children}
</DiyaProvider>

theme="dark" matches the catalog as you’re viewing it. theme="system" follows each visitor’s light or dark setting instead.

Step 3: Save this file

Next.js
app/bookings/page.tsx
Vite
src/Agenda.tsx, then render <AgendaScreen /> inside the provider
Agenda.tsx
'use client'
// Bookings agenda: a DIYA screen. Install: npm i @idyeah/diya lucide-react
// Next.js: save as app/bookings/page.tsx. Vite: save as src/Agenda.tsx and render it inside your DiyaProvider.
import { useState, useSyncExternalStore, type ReactNode } from 'react'
import {
  Alert, Avatar, Button, Calendar, ContentState, DatePicker, Dialog, Drawer, List, Select, SiteHeader, Stack, Tag, TextArea, TextInput, toast,
  useDiyaAppearance, type Tone,
} from '@idyeah/diya'
import { CalendarCheck, CalendarX2, ChevronLeft, ChevronRight, LucideProvider, Plus, UserCheck } from 'lucide-react'

// Your salon, its people and services, and who is booked when.
const PLACE = 'Kestrel'
const ME = 'Lucía Fernández'
// Closed on Sundays. The demo keeps today open, so its sample day always has bookings.
const isClosed = (day: string, today: string) => day !== today && new Date(`${day}T12:00:00Z`).getUTCDay() === 0
const NAV = ['Bookings', 'Clients', 'Services', 'Team', 'Reports'].map((label) => ({ value: label.toLowerCase(), label, href: `/${label.toLowerCase()}` }))
const STAFF = [
  { value: 'ana', label: 'Ana Lima' },
  { value: 'kofi', label: 'Kofi Mensah' },
  { value: 'mei', label: 'Mei Tanaka' },
  { value: 'rafa', label: 'Rafael Ortiz' },
]
const SERVICES = [
  { value: 'cut', label: 'Cut and finish', minutes: 60 },
  { value: 'color', label: 'Color, full head', minutes: 120 },
  { value: 'gloss', label: 'Gloss and blowout', minutes: 45 },
  { value: 'trim', label: 'Beard trim', minutes: 30 },
  { value: 'consult', label: 'Color consultation', minutes: 15 },
]
const OPEN = { from: 9 * 60, to: 19 * 60 }

type Status = 'confirmed' | 'arrived' | 'canceled' | 'no-show'
type Booking = { id: string; day: string; start: number; service: string; staff: string; client: string; phone: string; status: Status; notes: string }
const STATUS: Record<Status, { label: string; tone: Tone }> = {
  confirmed: { label: 'Confirmed', tone: 'neutral' },
  arrived: { label: 'Checked in', tone: 'success' },
  canceled: { label: 'Canceled', tone: 'neutral' },
  'no-show': { label: 'No-show', tone: 'warning' },
}
// Sample bookings. `day` counts open days from today (0 is today, -1 the last open day, 1 the next),
// so the demo never goes stale. Your API brings real dates.
type Sample = Omit<Booking, 'day'> & { day: number }
const row = (id: string, day: number, time: string, service: string, staff: string, client: string, status: Status = 'confirmed', notes = ''): Sample =>
  ({ id, day, start: toMinutes(time), service, staff, client, phone: `(555) 010-${String(2000 + Number(id) * 137).slice(-4)}`, status, notes })
const SAMPLE: Sample[] = [
  row('1', 0, '9:00', 'cut', 'ana', 'Maya Chen', 'arrived', 'Likes it short at the back. Oat milk in the coffee.'),
  row('2', 0, '9:30', 'color', 'mei', 'Priya Nair', 'arrived', 'Patch test done last week. Going two shades warmer.'),
  row('3', 0, '10:00', 'trim', 'kofi', 'Daniel Okoro', 'no-show'),
  row('4', 0, '10:30', 'gloss', 'rafa', 'Hannah Becker'),
  row('5', 0, '11:30', 'cut', 'ana', 'Tomás Rivera', 'canceled', 'Canceled by text yesterday. Wants to rebook next week.'),
  row('6', 0, '12:00', 'consult', 'mei', 'Aisha Rahman'),
  row('7', 0, '13:00', 'cut', 'kofi', 'Jonah Park'),
  row('8', 0, '14:00', 'color', 'ana', 'Sofia Rossi', 'confirmed', 'First visit. Box dye underneath, so allow extra time.'),
  row('9', 0, '15:30', 'gloss', 'mei', 'Grace Mensah'),
  row('10', 0, '17:00', 'cut', 'rafa', 'Leo Alvarez'),
  row('11', -3, '10:00', 'cut', 'ana', 'Nora Lindqvist', 'arrived'),
  row('12', -3, '13:00', 'trim', 'kofi', 'Samuel Adeyemi', 'arrived'),
  row('13', -2, '9:30', 'color', 'mei', 'Elena Petrova', 'arrived'),
  row('14', -2, '11:00', 'cut', 'rafa', 'Marcus Webb', 'arrived'),
  row('15', -2, '16:00', 'gloss', 'ana', 'Chloe Martin', 'no-show'),
  row('16', -1, '10:00', 'cut', 'kofi', 'Ravi Shah', 'arrived'),
  row('17', 1, '9:00', 'color', 'ana', 'Isabel Cruz'),
  row('18', 1, '11:00', 'cut', 'rafa', 'Kenji Watanabe'),
  row('19', 1, '15:00', 'trim', 'kofi', 'Omar Haddad'),
  row('20', 2, '10:00', 'gloss', 'mei', 'Zoe Laurent'),
  row('21', 2, '10:00', 'cut', 'ana', 'Femi Adebayo'),
  row('22', 2, '12:30', 'color', 'rafa', 'Lena Novak'),
  row('23', 6, '14:00', 'cut', 'ana', 'Tomás Rivera'),
]

type Route = '/bookings' | '/bookings/move' | '/bookings/cancel' | '/bookings/check-in' | '/bookings/notes'

// Replace with your API call. The stub waits a moment and saves everything.
// Overlaps are caught on the page first; your server should check them too.
async function api(route: Route, body: Record<string, unknown>) {
  await new Promise((resolve) => setTimeout(resolve, 700))
  return { route, body }
}

function toMinutes(time: string) { const [h, m] = time.split(':').map(Number); return h * 60 + m }
const noon = (day: string) => Date.parse(`${day}T12:00:00Z`)
const shift = (day: string, by: number) => new Date(noon(day) + by * 86400000).toISOString().slice(0, 10)
const dateText = (day: string, options: Intl.DateTimeFormatOptions) => new Intl.DateTimeFormat('en-US', { ...options, timeZone: 'UTC' }).format(noon(day))
const longDay = (day: string) => dateText(day, { weekday: 'long', month: 'long', day: 'numeric' })
const shortDay = (day: string) => dateText(day, { weekday: 'short', month: 'short', day: 'numeric' })
const weekday = (day: string) => dateText(day, { weekday: 'long' })
const clockFormat = new Intl.DateTimeFormat('en-US', { hour: 'numeric', minute: '2-digit', timeZone: 'UTC' })
const at = (minutes: number) => Date.UTC(2026, 0, 1, 0, minutes)
const clock = (minutes: number) => clockFormat.format(at(minutes))
const span = (start: number, length: number) => clockFormat.formatRange(at(start), at(start + length))
const service = (id: string) => SERVICES.find((s) => s.value === id)!
const person = (id: string) => STAFF.find((s) => s.value === id)!.label
const first = (name: string) => name.split(' ')[0]
const TIMES = Array.from({ length: (OPEN.to - OPEN.from) / 15 }, (_, i) => OPEN.from + i * 15).map((m) => ({ value: String(m), label: clock(m) }))
const stepOpen = (day: string, by: number, today: string) => { let next = shift(day, by); while (isClosed(next, today)) next = shift(next, by); return next }
// The sample's open-day offsets, as dates around today.
function openDay(today: string, offset: number) {
  let day = today
  for (let i = 0; i < Math.abs(offset); i++) day = stepOpen(day, Math.sign(offset), today)
  return day
}
const sampleFor = (today: string): Booking[] => SAMPLE.map((b) => ({ ...b, day: openDay(today, b.day) }))

// Today's date in the reader's browser. The server can't know it, so it renders '' and the agenda fills in once the page loads.
const subscribeNever = () => () => {}
function todayIso() {
  const now = new Date()
  return `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}`
}
const useToday = () => useSyncExternalStore(subscribeNever, todayIso, () => '')

// Another live booking for the same stylist that overlaps this time, if any.
function clash(bookings: Booking[], draft: Pick<Booking, 'day' | 'start' | 'service' | 'staff'>, except?: string) {
  const end = draft.start + service(draft.service).minutes
  return bookings.find((b) => b.id !== except && b.status !== 'canceled' && b.day === draft.day && b.staff === draft.staff
    && b.start < end && b.start + service(b.service).minutes > draft.start)
}
const clashText = (b: Booking) => `${first(person(b.staff))} is with ${b.client} from ${span(b.start, service(b.service).minutes)}. Pick another time or another stylist.`

export default function AgendaScreen() {
  const { glass } = useDiyaAppearance()
  const today = useToday()
  const [changed, setBookings] = useState<Booking[]>()
  const bookings = changed ?? (today ? sampleFor(today) : [])
  const [picked, setDay] = useState('')
  const day = picked || today
  const closed = (d: string) => isClosed(d, today)
  const [staff, setStaff] = useState('all')
  const [openId, setOpenId] = useState<string>()
  const [adding, setAdding] = useState(false)

  const update = (id: string, change: Partial<Booking>) => setBookings((now = sampleFor(today)) => now.map((b) => (b.id === id ? { ...b, ...change } : b)))
  const onDay = bookings.filter((b) => b.day === day).sort((a, b) => a.start - b.start)
  const shown = onDay.filter((b) => staff === 'all' || b.staff === staff)
  const live = shown.filter((b) => b.status !== 'canceled')
  const hours = live.reduce((sum, b) => sum + service(b.service).minutes, 0) / 60
  const monday = day && shift(day, -((new Date(noon(day)).getUTCDay() + 6) % 7))
  const week = monday ? Array.from({ length: 7 }, (_, i) => shift(monday, i)).filter((d, i) => i < 6 || !closed(d)) : []
  const open = bookings.find((b) => b.id === openId)

  return (
    <LucideProvider size={18} strokeWidth={1.6}>
      <div className="agenda" data-glass={glass || undefined}>
        <style>{css}</style>
        <SiteHeader brand={<span className="agenda-brand"><span className="agenda-mark" aria-hidden="true">{PLACE[0]}</span>{PLACE}</span>}
          brandHref="/" brandLabel={`${PLACE}, home`} items={NAV} value="bookings" avatar={<Avatar name={ME} size="small" />} />
        <main className="agenda-main">
          <header className="agenda-header">
            <div className="agenda-stack">
              <h1 className="agenda-title">Bookings</h1>
              <p className="agenda-lede">{PLACE} Salon. Four stylists, one very good espresso machine.</p>
            </div>
            <Button onClick={() => setAdding(true)}><Plus /> New booking</Button>
          </header>
          {!today ? <p className="agenda-muted agenda-wait">Loading today’s bookings…</p> : (
          <div className="agenda-layout">
            <section className="agenda-day agenda-panel" aria-labelledby="agenda-day-title">
              <div className="agenda-day-head">
                <div className="agenda-stack">
                  <h2 id="agenda-day-title" className="agenda-day-title">
                    {longDay(day)}
                    {day === today && <Tag size="small" tone="brand">Today</Tag>}
                  </h2>
                  <p className="agenda-muted" role="status">
                    {live.length ? `${live.length} ${live.length === 1 ? 'booking' : 'bookings'}, ${hours.toLocaleString('en-US')} ${hours === 1 ? 'hour' : 'hours'} in the chair` : staff === 'all' ? 'Nothing booked yet' : `Nothing booked for ${first(person(staff))}`}
                    {shown.length > live.length && `, ${shown.length - live.length} canceled`}
                  </p>
                </div>
                <div className="agenda-tools">
                  <Button variant="outline" iconOnly aria-label="Previous day" onClick={() => setDay(stepOpen(day, -1, today))}><ChevronLeft /></Button>
                  <Button variant="outline" iconOnly aria-label="Next day" onClick={() => setDay(stepOpen(day, 1, today))}><ChevronRight /></Button>
                  <Button variant="outline" disabled={day === today} onClick={() => setDay(today)}>Today</Button>
                  <Select className="agenda-staff" label="Staff" hideLabel options={[{ value: 'all', label: 'Everyone' }, ...STAFF]} value={staff} onValueChange={setStaff} />
                </div>
              </div>
              {shown.length ? (
                <ol className="agenda-list" aria-label={`Bookings on ${longDay(day)}`}>
                  {shown.map((b) => (
                    <li key={b.id}>
                      <button type="button" className="agenda-row" data-status={b.status} aria-haspopup="dialog" onClick={() => setOpenId(b.id)}>
                        <strong className="agenda-clock">{clock(b.start)}</strong>
                        <span className="agenda-muted agenda-length">{service(b.service).minutes} min</span>
                        <strong className="agenda-client">{b.client}</strong>
                        <span className="agenda-muted agenda-service">{service(b.service).label} with {first(person(b.staff))}</span>
                        <span className="agenda-avatar" aria-hidden="true"><Avatar name={person(b.staff)} size="small" /></span>
                        <span className="agenda-status"><Tag size="small" tone={STATUS[b.status].tone} leading="dot">{STATUS[b.status].label}</Tag></span>
                      </button>
                    </li>
                  ))}
                </ol>
              ) : staff !== 'all' && onDay.length ? (
                <ContentState className="agenda-empty" headingLevel={3} icon={<CalendarCheck />} title={`${first(person(staff))} has nothing on ${weekday(day)}`}
                  description="Their chair is free all day." action={{ label: 'Show everyone', onClick: () => setStaff('all') }} />
              ) : (
                <ContentState className="agenda-empty" headingLevel={3} icon={<CalendarCheck />} title={`Nothing booked on ${weekday(day)}`}
                  description="A quiet day so far. Walk-ins welcome." action={{ label: 'New booking', onClick: () => setAdding(true) }} />
              )}
            </section>

            <aside className="agenda-rail" aria-label="Pick a day">
              <Calendar label="Jump to a day" value={day} onValueChange={setDay} isDateUnavailable={closed} />
              <div className="agenda-stack agenda-week">
                <h2 className="agenda-rail-title">Week of {dateText(monday, { month: 'long', day: 'numeric' })}</h2>
                <List className="agenda-week-list" label={`Bookings each day, week of ${dateText(monday, { month: 'long', day: 'numeric' })}`} size="small"
                  items={week.map((d) => {
                    const count = bookings.filter((b) => b.day === d && b.status !== 'canceled').length
                    return { id: d, label: shortDay(d), current: d === day, onSelect: () => setDay(d), disabled: closed(d),
                      trailing: <span className="agenda-muted">{closed(d) ? 'Closed' : count ? `${count} booked` : 'Open'}</span> }
                  })} />
              </div>
            </aside>
          </div>
          )}
        </main>

        {open && (
          <BookingDrawer key={open.id} today={today} booking={open} bookings={bookings} onClose={() => setOpenId(undefined)}
            onSaved={(change, title, text) => {
              update(open.id, change); setOpenId(undefined)
              toast({ tone: 'success', title, description: text, duration: 6000 })
            }} />
        )}
        {adding && (
          <NewBooking today={today} day={day} bookings={bookings} onClose={() => setAdding(false)}
            onAdded={(b) => {
              setBookings((now = sampleFor(today)) => [...now, b]); setDay(b.day); setStaff('all')
              toast({ tone: 'success', title: 'Booked', description: `${b.client}, ${shortDay(b.day)} at ${clock(b.start)} with ${first(person(b.staff))}.`, duration: 6000 })
            }} />
        )}
      </div>
    </LucideProvider>
  )
}

type DrawerProps = { today: string; booking: Booking; bookings: Booking[]; onClose: () => void; onSaved: (change: Partial<Booking>, title: string, text: string) => void }

function BookingDrawer({ today, booking: b, bookings, onClose, onSaved }: DrawerProps) {
  const closed = (d: string) => isClosed(d, today)
  const [mode, setMode] = useState<'view' | 'move' | 'cancel'>('view')
  const [busy, setBusy] = useState<Route>()
  const [date, setDate] = useState(b.day < today ? today : b.day)
  const [time, setTime] = useState(String(b.start))
  const [timeError, setTimeError] = useState<string>()
  const [notes, setNotes] = useState(b.notes)
  const s = service(b.service)
  const canceled = b.status === 'canceled'
  const checkIn = b.status === 'confirmed' && b.day === today

  async function run(route: Route, change: Partial<Booking>, title: string, text: string) {
    setBusy(route)
    await api(route, { id: b.id, ...change })
    setBusy(undefined)
    setMode('view')
    onSaved(change, title, text)
  }

  function move() {
    const draft = { day: date, start: Number(time), service: b.service, staff: b.staff }
    const other = clash(bookings, draft, b.id)
    if (other) return setTimeError(clashText(other))
    run('/bookings/move', { day: date, start: draft.start, status: 'confirmed' }, canceled ? 'Rebooked' : 'Moved',
      `${b.client} is now ${shortDay(date)} at ${clock(draft.start)} with ${first(person(b.staff))}.`)
  }

  const footer: ReactNode = mode === 'cancel' ? (
    <div className="agenda-confirm" role="group" aria-labelledby="agenda-confirm-text">
      <p id="agenda-confirm-text" className="agenda-text">Cancel {first(b.client)}’s {clock(b.start)} booking? We text them that it’s off.</p>
      <div className="agenda-actions">
        <Button variant="destructive" loading={busy === '/bookings/cancel'}
          onClick={() => run('/bookings/cancel', { status: 'canceled' }, 'Booking canceled', `${b.client}’s ${clock(b.start)} slot is open again.`)}>Cancel booking</Button>
        <Button variant="quiet" disabled={busy !== undefined} onClick={() => setMode('view')}>Keep it</Button>
      </div>
    </div>
  ) : mode === 'move' ? (
    <div className="agenda-actions">
      <Button loading={busy === '/bookings/move'} onClick={move}>{canceled ? 'Rebook' : 'Move booking'}</Button>
      <Button variant="quiet" disabled={busy !== undefined} onClick={() => { setMode('view'); setTimeError(undefined) }}>Never mind</Button>
    </div>
  ) : (
    <div className="agenda-actions">
      {checkIn && (
        <Button loading={busy === '/bookings/check-in'} onClick={() => run('/bookings/check-in', { status: 'arrived' }, 'Checked in', `${first(b.client)} is here. ${first(person(b.staff))} gets a ping.`)}>
          <UserCheck /> Check in
        </Button>
      )}
      <Button variant={checkIn ? 'outline' : 'solid'} onClick={() => setMode('move')}>{canceled ? 'Rebook' : 'Reschedule'}</Button>
      {!canceled && <Button variant="quiet" onClick={() => setMode('cancel')}><CalendarX2 /> Cancel booking</Button>}
    </div>
  )

  return (
    <Drawer open onOpenChange={(next) => !next && !busy && onClose()} title={b.client} headingLevel={2}
      description={`${s.label}, ${s.minutes} minutes`} footer={footer}>
      <Stack gap={6}>
        <dl className="agenda-facts">
          <div><dt>Status</dt><dd><Tag size="small" tone={STATUS[b.status].tone} leading="dot">{STATUS[b.status].label}</Tag></dd></div>
          <div><dt>When</dt><dd>{longDay(b.day)}, {span(b.start, s.minutes)}</dd></div>
          <div><dt>With</dt><dd>{person(b.staff)}</dd></div>
          <div><dt>Phone</dt><dd>{b.phone}</dd></div>
        </dl>
        {mode === 'move' && (
          <section className="agenda-stack agenda-gap" aria-labelledby="agenda-move-title">
            <h3 id="agenda-move-title" className="agenda-rail-title">{canceled ? 'Rebook for' : 'Move to'}</h3>
            <div className="agenda-pair">
              <DatePicker label="Date" value={date} min={today} isDateUnavailable={closed} onValueChange={(value) => { setDate(value || date); setTimeError(undefined) }} />
              <Select label="Time" options={TIMES} value={time} onValueChange={(value) => { setTime(value); setTimeError(undefined) }}
                error={timeError ? 'Overlaps another booking.' : undefined} />
            </div>
            {timeError && <Alert tone="error" urgent title="That time overlaps">{timeError}</Alert>}
          </section>
        )}
        <section className="agenda-stack agenda-gap" aria-labelledby="agenda-notes-title">
          <h3 id="agenda-notes-title" className="agenda-rail-title">Notes</h3>
          <TextArea label="Notes for the team" hideLabel rows={4} value={notes} onValueChange={setNotes} placeholder="Allergies, preferences, the dog’s name…" />
          <Button variant="outline" size="small" className="agenda-start" disabled={notes === b.notes} loading={busy === '/bookings/notes'}
            onClick={() => run('/bookings/notes', { notes }, 'Notes saved', `The team sees them on ${first(b.client)}’s booking.`)}>Save notes</Button>
        </section>
      </Stack>
    </Drawer>
  )
}

type NewProps = { today: string; day: string; bookings: Booking[]; onClose: () => void; onAdded: (booking: Booking) => void }

function NewBooking({ today, day, bookings, onClose, onAdded }: NewProps) {
  const closed = (d: string) => isClosed(d, today)
  const [draft, setDraft] = useState({ client: '', phone: '', service: 'cut', staff: 'ana', day: day < today ? today : day, start: '', notes: '' })
  const [errors, setErrors] = useState<{ client?: string; start?: string; clash?: string }>({})
  const [busy, setBusy] = useState(false)
  const edit = (key: keyof typeof draft, value: string) => {
    setDraft({ ...draft, [key]: value })
    setErrors(key === 'client' ? { ...errors, client: undefined } : { client: errors.client })
  }

  async function add() {
    const other = draft.start ? clash(bookings, { ...draft, start: Number(draft.start) }) : undefined
    const found = {
      client: draft.client.trim() ? undefined : 'Enter the client’s name.',
      start: !draft.start ? 'Pick a time.' : other ? 'Overlaps another booking.' : undefined,
      clash: other && clashText(other),
    }
    setErrors(found)
    if (found.client || found.start) return false
    setBusy(true)
    await api('/bookings', draft)
    onAdded({ id: String(Date.now()), day: draft.day, start: Number(draft.start), service: draft.service, staff: draft.staff, client: draft.client.trim(),
      phone: draft.phone.trim() || 'Not given', status: 'confirmed', notes: draft.notes })
  }

  return (
    <Dialog open onOpenChange={(open) => !open && onClose()} title="New booking" description="We text the client a confirmation."
      confirmLabel="Add booking" loading={busy} onConfirm={add} divided>
      <Stack gap={4}>
        {errors.clash && <Alert tone="error" urgent title="That time overlaps">{errors.clash}</Alert>}
        <div className="agenda-pair">
          <TextInput label="Client" autoComplete="off" value={draft.client} error={errors.client} onValueChange={(v) => edit('client', v)} />
          <TextInput label="Phone (optional)" type="tel" inputMode="tel" autoComplete="off" value={draft.phone} onValueChange={(v) => edit('phone', v)} />
        </div>
        <div className="agenda-pair">
          <Select label="Service" options={SERVICES.map(({ value, label, minutes }) => ({ value, label: `${label}, ${minutes} min` }))} value={draft.service} onValueChange={(v) => edit('service', v)} />
          <Select label="Stylist" options={STAFF} value={draft.staff} onValueChange={(v) => edit('staff', v)} />
        </div>
        <div className="agenda-pair">
          <DatePicker label="Date" value={draft.day} min={today} isDateUnavailable={closed} onValueChange={(v) => edit('day', v || draft.day)} />
          <Select label="Time" placeholder="Choose" options={TIMES} value={draft.start} error={errors.start} onValueChange={(v) => edit('start', v)} />
        </div>
        <TextArea label="Notes (optional)" rows={2} value={draft.notes} onValueChange={(v) => edit('notes', v)} />
      </Stack>
    </Dialog>
  )
}

const css = `
.agenda { min-height: 100dvh; color: var(--diya-color-text); }
.agenda:not([data-glass]) { background: var(--diya-color-recessed); }
.agenda-brand { display: inline-flex; align-items: center; gap: var(--diya-space-3); font-size: var(--diya-text-large); font-weight: 600; letter-spacing: -0.01em; }
.agenda-mark {
  display: grid; place-items: center; width: 28px; height: 28px;
  border-radius: calc(9px * var(--diya-corner-scale, 1));
  background: var(--diya-color-accent); color: var(--diya-color-accent-text);
  font-size: var(--diya-text-body); font-weight: 650; line-height: 1;
}
.agenda-main { display: grid; gap: var(--diya-space-6); width: 100%; max-width: calc(1176px + 2 * var(--diya-space-7)); margin: 0 auto; padding: var(--diya-space-7) var(--diya-space-7) var(--diya-space-8); }
.agenda-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--diya-space-4); }
.agenda-title { margin: 0; font-size: 28px; font-weight: 600; line-height: var(--diya-leading-tight); letter-spacing: -0.02em; }
.agenda-lede { margin: 0; color: var(--diya-color-muted); font-size: var(--diya-text-body); line-height: var(--diya-leading-body); }
.agenda-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--diya-space-6); align-items: start; }
.agenda-panel { border: 1px solid var(--diya-color-line); border-radius: var(--diya-radius-surface); background: var(--diya-color-raised); }
.agenda[data-glass] .agenda-panel {
  background: color-mix(in srgb, var(--diya-color-raised) 64%, transparent);
  backdrop-filter: blur(28px) saturate(1.15);
}
.agenda-day { min-width: 0; padding: var(--diya-space-5) 0 var(--diya-space-3); }
.agenda-day-head { display: flex; flex-wrap: wrap; align-items: start; justify-content: space-between; gap: var(--diya-space-4); padding: 0 var(--diya-space-5) var(--diya-space-5); border-bottom: 1px solid var(--diya-color-line); }
.agenda-stack { display: grid; gap: var(--diya-space-1); min-width: 0; }
.agenda-gap { gap: var(--diya-space-3); }
.agenda-day-title { display: flex; flex-wrap: wrap; align-items: center; gap: var(--diya-space-3); margin: 0; font-size: var(--diya-text-title); font-weight: 600; line-height: var(--diya-leading-tight); letter-spacing: -0.015em; }
.agenda-muted { margin: 0; color: var(--diya-color-muted); font-size: var(--diya-text-caption); line-height: var(--diya-leading-body); }
.agenda-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--diya-space-2); }
.agenda-staff { flex: none; width: 176px; }
.agenda-list { display: grid; margin: 0; padding: var(--diya-space-2) var(--diya-space-3) 0; list-style: none; }
.agenda-list li + li { border-top: 1px solid var(--diya-color-line); }
.agenda-row {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) auto auto; grid-template-areas: 'clock client avatar status' 'length service avatar status';
  align-items: center; gap: 0 var(--diya-space-4);
  width: 100%; padding: var(--diya-space-3); border: 0; border-radius: var(--diya-radius-control);
  background: none; color: inherit; font: inherit; font-size: var(--diya-text-body); text-align: start; cursor: pointer;
}
.agenda-row:hover { background: var(--diya-color-hover); }
.agenda-row:focus-visible { outline: 2px solid var(--diya-color-accent); outline-offset: 2px; }
.agenda-row > * { min-width: 0; line-height: var(--diya-leading-body); }
.agenda-clock { grid-area: clock; font-weight: 600; font-variant-numeric: tabular-nums; }
.agenda-length { grid-area: length; }
.agenda-client { grid-area: client; font-weight: 500; overflow-wrap: anywhere; }
.agenda-service { grid-area: service; }
.agenda-status { grid-area: status; display: inline-flex; justify-self: end; }
.agenda-row[data-status='canceled'] .agenda-client,
.agenda-row[data-status='canceled'] .agenda-clock { color: var(--diya-color-muted); text-decoration: line-through; }
.agenda-avatar { grid-area: avatar; display: inline-flex; }
.agenda-wait { padding-block: var(--diya-space-8); text-align: center; }
.agenda-empty { max-width: none; margin: 0; padding: var(--diya-space-8) var(--diya-space-5); border: 0; background: none; }
.agenda-rail { display: grid; gap: var(--diya-space-6); position: sticky; top: var(--diya-space-5); }
.agenda-rail-title { margin: 0; font-size: var(--diya-text-body); font-weight: 600; line-height: var(--diya-leading-tight); }
.agenda-week { gap: var(--diya-space-3); }
.agenda-week-list { max-width: none; }
.agenda-facts { display: grid; margin: 0; font-size: var(--diya-text-body); line-height: var(--diya-leading-body); }
.agenda-facts div { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: var(--diya-space-4); align-items: center; padding-block: var(--diya-space-3); border-top: 1px solid var(--diya-color-line); }
.agenda-facts div:last-child { border-bottom: 1px solid var(--diya-color-line); }
.agenda-facts dt { color: var(--diya-color-muted); }
.agenda-facts dd { margin: 0; justify-self: start; font-weight: 500; }
.agenda-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--diya-space-4); align-items: start; }
.agenda-text { margin: 0; font-size: var(--diya-text-body); line-height: var(--diya-leading-body); }
.agenda-confirm { display: grid; gap: var(--diya-space-3); }
.agenda-actions { display: flex; flex-wrap: wrap; gap: var(--diya-space-2); }
.agenda-start { justify-self: start; }
@media (prefers-reduced-transparency: reduce) {
  .agenda[data-glass] .agenda-panel { background: var(--diya-color-raised); backdrop-filter: none; }
}
@media (max-width: 960px) {
  .agenda-main { padding: var(--diya-space-5) var(--diya-space-4) var(--diya-space-7); gap: var(--diya-space-5); }
  .agenda-layout { grid-template-columns: minmax(0, 1fr); }
  .agenda-rail { position: static; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); align-items: start; }
}
@media (max-width: 640px) {
  .agenda-rail { grid-template-columns: minmax(0, 1fr); }
  .agenda-day-head { padding-inline: var(--diya-space-4); }
  .agenda-tools { width: 100%; }
  .agenda-staff { flex: 1; width: auto; min-width: 0; }
  .agenda-list { padding-inline: var(--diya-space-2); }
  .agenda-row { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: 'clock client client' 'service service status'; gap: 2px var(--diya-space-3); padding-inline: var(--diya-space-2); }
  .agenda-avatar,
  .agenda-length { display: none; }
  .agenda-pair { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 380px) {
  .agenda-staff { flex-basis: 100%; }
}
`

It’s the file this page previews, with sample data and every state working. Anything that would call a server is marked // Replace with your API call.