Files
zeekay 80d1370ad3 fix: Resolve registry structure and build errors for deployment
Fixed critical issues preventing successful GitHub Pages deployment:

Registry Access Pattern:
- Updated getRegistryItem() and getRegistryComponent() to accept style parameter
- Fixed Index access from Index[name] to Index[style][name]
- Updated block-display.tsx to pass style parameter to registry functions

Build Process Fixes:
- Removed problematic Zod validation in _getAllBlocks() and _getBlockCode()
- Disabled syntax highlighting (Shiki) for static export compatibility
- Convert null to undefined in block metadata extraction

Technical Details:
- Registry structure is Index[style][componentName], not Index[componentName]
- Shiki's getHighlighter() incompatible with Next.js static export
- Block schema expected string/undefined but got null for optional fields

Files Modified:
- app/lib/registry.ts - Added style param to registry functions
- app/components/block-display.tsx - Pass style to getCachedRegistryItem
- app/lib/blocks.ts - Removed Zod validation, fixed null values
- app/lib/highlight-code.ts - Disabled highlighting, added fallback
- LLM.md - Documented all fixes and remaining issues

Remaining Issues:
- Some blocks (login-01, login-02, sidebar-02) have Server Component errors
- These will need separate fixes or exclusion from static generation

Related: #deployment #build-fix #registry
2025-10-18 22:25:19 -07:00

15 lines
1.8 KiB
JSON

{
"name": "calendar-21",
"registryDependencies": [
"calendar"
],
"files": [
{
"name": "calendar-21.tsx",
"content": "\"use client\"\n\nimport * as React from \"react\"\nimport { DateRange } from \"react-day-picker\"\n\nimport { cn } from \"@/lib/utils\"\nimport { buttonVariants } from \"@/registry/default/ui/button\"\nimport { Calendar } from \"@/registry/default/ui/calendar\"\n\nexport default function Calendar21() {\n const [range, setRange] = React.useState<DateRange | undefined>({\n from: new Date(2025, 5, 12),\n to: new Date(2025, 5, 17),\n })\n\n return (\n <Calendar\n mode=\"range\"\n defaultMonth={range?.from}\n selected={range}\n onSelect={setRange}\n numberOfMonths={1}\n captionLayout=\"dropdown\"\n className=\"rounded-lg border shadow-sm [--cell-size:2.75rem] md:[--cell-size:3rem]\"\n formatters={{\n formatMonthDropdown: (date) => {\n return date.toLocaleString(\"default\", { month: \"long\" })\n },\n }}\n components={{\n DayButton: ({ children, modifiers, day, ...props }) => {\n const isWeekend = day.date.getDay() === 0 || day.date.getDay() === 6\n\n return (\n <button\n className={cn(\n buttonVariants({ variant: \"ghost\" }),\n \"relative flex flex-col items-center justify-center h-9 w-9 p-0 font-normal aria-selected:opacity-100\"\n )}\n {...props}\n >\n <div>{children}</div>\n {!modifiers.outside && (\n <span className=\"text-xs\">{isWeekend ? \"$220\" : \"$100\"}</span>\n )}\n </button>\n )\n },\n }}\n />\n )\n}\n"
}
],
"type": "components:block",
"category": "Application",
"subcategory": "Calendar"
}