{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "today-schedule",
  "title": "Today's schedule",
  "description": "Dashboard card with the next appointments and a live progress line.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "avatar",
    "badge",
    "button",
    "card"
  ],
  "files": [
    {
      "path": "registry/blocks/scheduling/today-schedule.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { CheckCircle2, Clock, Eye, EyeOff, MapPin, Video } from \"lucide-react\"\nimport { Avatar, AvatarFallback } from \"@/components/ui/avatar\"\nimport { Badge } from \"@/components/ui/badge\"\nimport { Button } from \"@/components/ui/button\"\nimport { Card, CardAction, CardContent, CardDescription, CardHeader, CardTitle } from \"@/components/ui/card\"\nimport { cn } from \"@/lib/utils\"\n\ntype Item = { id: string; title: string; client: string; from: number; to: number; place: \"room\" | \"video\"; location: string }\n\n// Times are hours from midnight; the list is anchored to today after mount.\nconst ITEMS: Item[] = [\n  { id: \"1\", title: \"Initial consultation\", client: \"Emma Clarke\", from: 8.5, to: 9.25, place: \"room\", location: \"Room 1\" },\n  { id: \"2\", title: \"Follow-up session\", client: \"Noah Patel\", from: 9.5, to: 10, place: \"video\", location: \"Google Meet\" },\n  { id: \"3\", title: \"Physiotherapy\", client: \"Ava Johnson\", from: 10.5, to: 11.5, place: \"room\", location: \"Room 2\" },\n  { id: \"4\", title: \"Treatment plan review\", client: \"Mia Wong\", from: 12, to: 12.5, place: \"video\", location: \"Zoom\" },\n  { id: \"5\", title: \"Sports massage\", client: \"Oscar Young\", from: 14, to: 15, place: \"room\", location: \"Room 1\" },\n  { id: \"6\", title: \"Check-up\", client: \"Ruby Hall\", from: 15.5, to: 16, place: \"room\", location: \"Room 3\" },\n  { id: \"7\", title: \"Online coaching\", client: \"Leo Garcia\", from: 17, to: 17.75, place: \"video\", location: \"Google Meet\" },\n]\n\nfunction useNow() {\n  const [now, setNow] = React.useState<Date | null>(null)\n  React.useEffect(() => {\n    setNow(new Date())\n    const id = setInterval(() => setNow(new Date()), 30_000)\n    return () => clearInterval(id)\n  }, [])\n  return now\n}\n\nexport default function TodaySchedule() {\n  const now = useNow()\n  const [checkedIn, setCheckedIn] = React.useState<Set<string>>(new Set())\n  const [hideDone, setHideDone] = React.useState(false)\n  if (!now) return <div className=\"h-[480px] p-4 md:p-6\"><div className=\"mx-auto h-full max-w-md animate-pulse rounded-xl bg-muted\" /></div>\n\n  const hourNow = now.getHours() + now.getMinutes() / 60\n  const at = (h: number) => new Date(now.getFullYear(), now.getMonth(), now.getDate(), Math.floor(h), Math.round((h % 1) * 60))\n  const fmt = (h: number) => new Intl.DateTimeFormat(undefined, { hour: \"numeric\", minute: \"2-digit\" }).format(at(h))\n  const next = ITEMS.find((i) => i.from > hourNow && !checkedIn.has(i.id))\n  const done = ITEMS.filter((i) => i.to <= hourNow).length\n  const items = hideDone ? ITEMS.filter((i) => i.to > hourNow) : ITEMS\n  const checkIn = (id: string) => setCheckedIn((s) => new Set(s).add(id))\n\n  return (\n    <div className=\"p-4 md:p-6\">\n      <Card className=\"mx-auto max-w-md\">\n        <CardHeader>\n          <CardTitle>Today</CardTitle>\n          <CardDescription>\n            {new Intl.DateTimeFormat(undefined, { weekday: \"long\", month: \"short\", day: \"numeric\" }).format(now)} · {done} of {ITEMS.length} done\n          </CardDescription>\n          <CardAction>\n            <Button variant=\"ghost\" size=\"sm\" onClick={() => setHideDone(!hideDone)} disabled={done === 0}>\n              {hideDone ? <Eye /> : <EyeOff />} {hideDone ? \"Show done\" : \"Hide done\"}\n            </Button>\n          </CardAction>\n        </CardHeader>\n        <CardContent className=\"flex flex-col gap-4\">\n          {next && (\n            <div className=\"flex items-center gap-3 rounded-lg bg-primary px-3 py-2.5 text-primary-foreground\">\n              <Clock className=\"size-4 shrink-0\" />\n              <div className=\"min-w-0 flex-1 text-sm\">\n                <span className=\"opacity-80\">Next: </span>\n                <span className=\"font-medium\">{next.client}</span>\n                <span className=\"opacity-80\"> in {Math.max(1, Math.round((next.from - hourNow) * 60))} min</span>\n              </div>\n              <Button size=\"sm\" variant=\"secondary\" className=\"h-7\" onClick={() => checkIn(next.id)}>Check in</Button>\n            </div>\n          )}\n          <ol className=\"relative flex flex-col\">\n            {items.map((item, i) => {\n              const live = item.from <= hourNow && hourNow < item.to\n              const past = item.to <= hourNow\n              const progress = live ? ((hourNow - item.from) / (item.to - item.from)) * 100 : 0\n              return (\n                <li key={item.id} className=\"relative flex gap-3 pb-4 last:pb-0\">\n                  <div className=\"w-16 shrink-0 pt-0.5 text-right text-xs text-muted-foreground tabular-nums\">{fmt(item.from)}</div>\n                  <div className=\"relative flex flex-col items-center\">\n                    <span className={cn(\"z-10 mt-1 size-2.5 rounded-full border-2 border-background ring-1\", live ? \"bg-emerald-500 ring-emerald-500\" : past ? \"bg-muted-foreground/40 ring-muted-foreground/40\" : \"bg-background ring-border\")} />\n                    {i < items.length - 1 && <span className=\"absolute top-3 bottom-[-4px] w-px bg-border\" />}\n                  </div>\n                  <div className={cn(\"min-w-0 flex-1 rounded-lg border p-3\", live && \"border-emerald-500/40 bg-emerald-500/5\", past && \"opacity-60\")}>\n                    <div className=\"flex items-start justify-between gap-2\">\n                      <div className=\"min-w-0\">\n                        <div className=\"truncate text-sm font-medium\">{item.title}</div>\n                        <div className=\"mt-1 flex items-center gap-2\">\n                          <Avatar className=\"size-5\"><AvatarFallback className=\"text-[9px]\">{item.client.split(\" \").map((p) => p[0]).join(\"\")}</AvatarFallback></Avatar>\n                          <span className=\"truncate text-xs text-muted-foreground\">{item.client}</span>\n                        </div>\n                      </div>\n                      {checkedIn.has(item.id) && !live ? (\n                        <Badge variant=\"secondary\" className=\"gap-1\"><CheckCircle2 className=\"size-3\" /> Checked in</Badge>\n                      ) : live ? (\n                        <Badge className=\"border-0 bg-emerald-500/15 text-emerald-700 dark:text-emerald-400\">Live</Badge>\n                      ) : (\n                        !past && item.from - hourNow < 1.5 ? (\n                          <Button size=\"xs\" variant=\"outline\" onClick={() => checkIn(item.id)}>Check in</Button>\n                        ) : (\n                        <span className=\"text-xs text-muted-foreground tabular-nums\">{Math.round((item.to - item.from) * 60)}m</span>\n                        )\n                      )}\n                    </div>\n                    <div className=\"mt-2 flex items-center gap-1 text-xs text-muted-foreground\">\n                      {item.place === \"video\" ? <Video className=\"size-3\" /> : <MapPin className=\"size-3\" />} {item.location}\n                    </div>\n                    {live && (\n                      <div className=\"mt-2 h-1 overflow-hidden rounded-full bg-emerald-500/15\">\n                        <div className=\"h-full rounded-full bg-emerald-500\" style={{ width: `${progress}%` }} />\n                      </div>\n                    )}\n                  </div>\n                </li>\n              )\n            })}\n          </ol>\n        </CardContent>\n      </Card>\n    </div>\n  )\n}\n",
      "type": "registry:component",
      "target": "components/goodui/today-schedule.tsx"
    }
  ],
  "categories": [
    "scheduling"
  ],
  "type": "registry:block"
}