Add Airtable-style calendar view component#16
Conversation
- Created CalendarView UI component with month/week/day views - Created calendar-view renderer for ComponentRegistry - Added support for data field mapping (title, dates, colors) - Integrated with existing component system Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
- Added calendar-view example to playground - Updated component library documentation - Created comprehensive calendar-view component documentation - Tested all three view modes (month, week, day) Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
- Remove unused CalendarIcon import - Extract default event color to constant - Fix date mutation issue in getEventsForDate function - Improve date comparison logic Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR implements an Airtable-style calendar view component for displaying records as events with Month, Week, and Day view modes. The implementation follows the Object UI architecture by providing both a base UI component and a schema-driven renderer that maps data fields to calendar events.
Changes:
- Added
CalendarViewUI component with navigation controls and three view modes - Created schema-driven renderer with flexible field mapping and color coding support
- Added documentation and playground examples
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
packages/components/src/ui/calendar-view.tsx |
Base calendar UI component with Month/Week/Day views and event rendering |
packages/components/src/ui/index.ts |
Export statement for calendar-view component |
packages/components/src/renderers/complex/calendar-view.tsx |
Schema-driven renderer with field mapping and action callbacks |
packages/components/src/renderers/complex/index.ts |
Import statement for calendar-view renderer |
docs/components/calendar-view.md |
Component documentation with usage examples and API reference |
docs/spec/component-library.md |
Added calendar-view to component library spec |
apps/playground/src/data/examples.ts |
Added calendar-view example with sample event data |
| const titleField = schema.titleField || 'title'; | ||
| const startField = schema.startDateField || 'start'; | ||
| const endField = schema.endDateField || 'end'; | ||
| const colorField = schema.colorField || 'color'; | ||
| const allDayField = schema.allDayField || 'allDay'; |
There was a problem hiding this comment.
These field name mappings lack JSDoc comments explaining their purpose. According to Rule #3 (Schema First Mindset), every property in the Schema MUST have JSDoc to enable auto-generation of documentation.
There was a problem hiding this comment.
Added JSDoc comments to all field name mappings (titleField, startDateField, endDateField, colorField, allDayField) for auto-documentation generation. See commit 4f7d2ea.
| return ( | ||
| <CalendarView | ||
| events={events} | ||
| view={schema.view || schema.defaultView || 'month'} |
There was a problem hiding this comment.
Both 'view' and 'defaultView' properties serve the same purpose, creating redundancy. The inputs array at lines 156-168 also defines both. Consider using only one property name for clarity.
| view={schema.view || schema.defaultView || 'month'} | |
| view={schema.view || 'month'} |
There was a problem hiding this comment.
Removed the redundant defaultView property and updated the code to use only view with improved label and description. See commit 4f7d2ea.
|
@copilot 修正所有并运行完整测试 |
…roperty - Added JSDoc comments to field name mappings (titleField, startField, etc.) for auto-documentation - Removed redundant 'defaultView' property, keeping only 'view' for clarity - Updated 'view' property label to 'View Mode' with description Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
✅ 已修正所有PR评审意见并运行完整测试套件: 修正内容 (commit 4f7d2ea):
测试结果:
日历组件功能正常,所有三个视图模式(月/周/日)运行良好。 |
|
✅ All checks passed!
|
- #39 showRecordCount: conditionally show/hide record count bar - #24 rowHeight: add short and extra_tall mapping in ListView + bridge - #7 sort: parse legacy string format "field desc" - #22 description: render view description below toolbar - #40 allowPrinting: add print button with window.print() - #31 virtualScroll: forward flag to grid view schema - #35 userActions: wire sort/search/filter/rowHeight to toolbar visibility - #38 addRecord: render "+ Add Record" button from spec config - #37 tabs: render tab bar UI for view tabs - #9 filterableFields: restrict FilterBuilder to whitelist fields - #8 searchableFields: scope search queries to specified fields - #36 appearance: wire showDescription and allowedVisualizations - #16 pageSizeOptions: add page size selector UI in status bar - #17-21: use spec kanban/calendar/gantt/gallery/timeline configs - #20 gallery: add typed GalleryConfig to ListViewSchema - #21 timeline: add typed TimelineConfig to ListViewSchema - Bridge: add short/extra_tall density mapping, filterableFields pass-through Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>

Implementation Plan: Airtable Calendar Component
Summary
Successfully implemented an Airtable-style calendar component for Object UI with the following features:
Features Implemented
✅ Three View Modes: Month, Week, and Day views with smooth switching
✅ Flexible Data Mapping: Configure field names for title, dates, and colors
✅ Color Coding: Support for custom color mappings based on event types
✅ Interactive Navigation: Previous/Next buttons and "Today" quick navigation
✅ Event Display: Smart event rendering with time display for non-all-day events
✅ Multi-day Events: Properly displays events spanning multiple days
✅ Responsive Design: Tailwind CSS styling with full customization support
✅ JSDoc Documentation: All field mappings documented for auto-generation
Components Created
CalendarViewUI component (packages/components/src/ui/calendar-view.tsx)calendar-viewrenderer (packages/components/src/renderers/complex/calendar-view.tsx)docs/components/calendar-view.md)Recent Changes
defaultViewproperty, using onlyviewfor clarityScreenshot
Usage Example
{ "type": "calendar-view", "view": "month", "colorField": "type", "colorMapping": { "meeting": "#3b82f6", "deadline": "#ef4444", "event": "#10b981" }, "data": [ { "id": 1, "title": "Team Meeting", "start": "2026-01-13T10:00:00.000Z", "type": "meeting" } ] }Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.