{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "card-studio-calendar-upcoming-2",
  "type": "registry:block",
  "title": "Upcoming",
  "description": "Workspace card from the overtrue/ui workspace examples. Editable source, scoped styles, and demo interactions.",
  "categories": [
    "cards",
    "workspace"
  ],
  "registryDependencies": [
    "https://ui.overtrue.xyz/r/overtrue-card-foundation.json"
  ],
  "files": [
    {
      "path": "src/blocks/registry/studio-calendar-upcoming-2.tsx",
      "type": "registry:component",
      "target": "components/overtrue/blocks/studio-calendar-upcoming-2.tsx",
      "content": "\"use client\";\nimport { BlockFrame } from \"./runtime/blocks/frame\";\nimport \"./runtime/cards.css\";\n// Extracted from src/components/overtrue/scenes/content-workbench.tsx:136.\nimport { useState } from \"react\";\nimport { type EventCalendarEvent } from \"./runtime/registry/overtrue/event-calendar\";\nimport { WorkflowDialog } from \"./runtime/components/overtrue/scenes/workflows\";\nimport { SceneCard, Action } from \"./runtime/components/overtrue/scenes/shared\";\nconst calendarEvents: EventCalendarEvent[] = [\n  {\n    id: \"planning\",\n    title: \"Studio planning\",\n    start: new Date(2026, 8, 21, 9),\n    end: new Date(2026, 8, 21, 10),\n    color: \"chart-2\",\n    location: \"Studio / Main room\",\n  },\n  {\n    id: \"review\",\n    title: \"Visitor concept review\",\n    start: new Date(2026, 8, 23, 10),\n    end: new Date(2026, 8, 23, 11),\n    color: \"primary\",\n    location: \"Culture venue\",\n  },\n  {\n    id: \"handover\",\n    title: \"Identity handover\",\n    start: new Date(2026, 8, 24, 14),\n    end: new Date(2026, 8, 24, 15),\n    color: \"chart-3\",\n    location: \"Video call\",\n  },\n  {\n    id: \"focus\",\n    title: \"Focus afternoon\",\n    start: new Date(2026, 8, 25, 13),\n    end: new Date(2026, 8, 25, 16),\n    color: \"chart-2\",\n    location: \"Studio\",\n  },\n];\nfunction dateInput(date: Date) {\n  return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, \"0\")}-${String(date.getDate()).padStart(2, \"0\")}`;\n}\nfunction CardExample() {\n  const [events, setEvents] = useState(calendarEvents);\n  const [category] = useState(\"All events\");\n  const [draft, setDraft] = useState<{\n    id?: string;\n    title: string;\n    date: string;\n    time: string;\n    duration: string;\n    location: string;\n  } | null>(null);\n  const [, setNotice] = useState(\"\");\n  const begin = (\n    start = new Date(2026, 8, 21, 10),\n    event?: EventCalendarEvent,\n  ) =>\n    setDraft({\n      id: event?.id,\n      title: event?.title ?? \"\",\n      date: dateInput(start),\n      time: `${String(start.getHours()).padStart(2, \"0\")}:${String(start.getMinutes()).padStart(2, \"0\")}`,\n      duration: String(\n        event ? (event.end.getTime() - event.start.getTime()) / 60000 : 60,\n      ),\n      location: event?.location ?? \"Studio\",\n    });\n  const filtered = events.filter(\n    (event) =>\n      category === \"All events\" ||\n      (category === \"Reviews\"\n        ? event.title.toLowerCase().includes(\"review\")\n        : !event.title.toLowerCase().includes(\"review\")),\n  );\n\n  return (\n    <>\n      <div\n        className=\"overtrue-block-content\"\n        data-workspace-page=\"fullcalendar\"\n      >\n        <SceneCard title=\"Upcoming\">\n          <div className=\"scene-note-list\">\n            {[...filtered]\n              .sort((a, b) => a.start.getTime() - b.start.getTime())\n              .slice(0, 3)\n              .map((event) => (\n                <div key={event.id}>\n                  <button\n                    className=\"scene-text-button\"\n                    onClick={() => begin(event.start, event)}\n                  >\n                    {event.title}\n                  </button>\n                  <p>\n                    {event.start.toLocaleDateString(\"en-GB\", {\n                      month: \"short\",\n                      day: \"numeric\",\n                    })}{\" \"}\n                    ·{\" \"}\n                    {event.start.toLocaleTimeString(\"en-GB\", {\n                      hour: \"2-digit\",\n                      minute: \"2-digit\",\n                    })}\n                  </p>\n                </div>\n              ))}\n          </div>\n        </SceneCard>\n        <WorkflowDialog\n          open={!!draft}\n          onOpenChange={(open) => {\n            if (!open) setDraft(null);\n          }}\n          title={draft?.id ? \"Edit event\" : \"New event\"}\n          description=\"Set a time and place for your team.\"\n        >\n          {draft && (\n            <form\n              className=\"scene-form\"\n              onSubmit={(e) => {\n                e.preventDefault();\n                const start = new Date(`${draft.date}T${draft.time}`);\n                const item = {\n                  id: draft.id ?? crypto.randomUUID(),\n                  title: draft.title.trim(),\n                  start,\n                  end: new Date(\n                    start.getTime() + Number(draft.duration) * 60000,\n                  ),\n                  location: draft.location,\n                };\n                if (!item.title) return;\n                setEvents((items) =>\n                  draft.id\n                    ? items.map((event) =>\n                        event.id === draft.id ? item : event,\n                      )\n                    : [...items, item],\n                );\n                setNotice(`${item.title} ${draft.id ? \"updated\" : \"added\"}.`);\n                setDraft(null);\n              }}\n            >\n              <label>\n                Event title\n                <input\n                  required\n                  value={draft.title}\n                  onChange={(e) =>\n                    setDraft({ ...draft, title: e.target.value })\n                  }\n                />\n              </label>\n              <div className=\"scene-grid-two\">\n                <label>\n                  Date\n                  <input\n                    type=\"date\"\n                    required\n                    value={draft.date}\n                    onChange={(e) =>\n                      setDraft({ ...draft, date: e.target.value })\n                    }\n                  />\n                </label>\n                <label>\n                  Start time\n                  <input\n                    type=\"time\"\n                    required\n                    value={draft.time}\n                    onChange={(e) =>\n                      setDraft({ ...draft, time: e.target.value })\n                    }\n                  />\n                </label>\n              </div>\n              <label>\n                Duration\n                <select\n                  value={draft.duration}\n                  onChange={(e) =>\n                    setDraft({ ...draft, duration: e.target.value })\n                  }\n                >\n                  {[30, 60, 90, 120, 180].map((value) => (\n                    <option key={value} value={value}>\n                      {value} minutes\n                    </option>\n                  ))}\n                </select>\n              </label>\n              <label>\n                Location\n                <input\n                  value={draft.location}\n                  onChange={(e) =>\n                    setDraft({ ...draft, location: e.target.value })\n                  }\n                />\n              </label>\n              <div className=\"scene-actions\">\n                <Action primary type=\"submit\">\n                  Save event\n                </Action>\n                {draft.id && (\n                  <Action\n                    onClick={() => {\n                      setEvents((items) =>\n                        items.filter((event) => event.id !== draft.id),\n                      );\n                      setNotice(\"Event deleted.\");\n                      setDraft(null);\n                    }}\n                  >\n                    Delete event\n                  </Action>\n                )}\n              </div>\n            </form>\n          )}\n        </WorkflowDialog>\n      </div>\n    </>\n  );\n}\n\nexport default function Block() { return <BlockFrame><CardExample /></BlockFrame>; }\n"
    }
  ],
  "docs": "Documentation: https://ui.overtrue.xyz/blocks/studio-calendar-upcoming-2. Includes the shared card foundation and hosted demo imagery. Replace sample data and navigation with your application data."
}
