Files
alla-allaos-fullstack/docs/implementation/task-ep1.6.2-direct-big-calendar-ui-adoption-2026-07-13.md
2026-07-13 22:29:11 +07:00

66 lines
3.7 KiB
Markdown

# Task EP.1.6.2 - Direct Big Calendar UI Adoption
Date: 2026-07-13
Status: Foundation Implemented
Upstream reviewed: `lramos33/big-calendar`
Upstream commit: `fbb8485e3d54b267261056c784632229ba6f7bc3`
License: MIT, upstream concepts retained with local ALLA OS adaptation.
## Summary
EP.1.6.2 replaces the CRM calendar workspace's custom tab/grid renderer with a local Big Calendar layer adapted from the upstream component architecture. The implementation preserves ALLA OS backend ownership: Activity, Business Events, Calendar Projection, Projection Runtime, permissions, and API contracts remain unchanged.
The UI now flows through:
```text
CalendarProjectionItem
-> mapCalendarProjectionToBigCalendarEvent()
-> BigCalendarProvider
-> BigCalendarHeader
-> Day / Week / Month / Agenda views
-> Activity reschedule command
```
## Adopted Components And Concepts
- Added `src/features/crm/calendar/big-calendar/provider.tsx` for local calendar state, selected date, selected view, user filter, drag state, working hours, and Activity command dispatch.
- Added `src/features/crm/calendar/big-calendar/header.tsx` for upstream-style Today, previous, next, range display, user filter, and view switching.
- Added `src/features/crm/calendar/big-calendar/views.tsx` for Day, Week, Month, and Agenda rendering.
- Added `src/features/crm/calendar/big-calendar/calendar-slot.tsx` for calendar slots, empty overlays, and HTML5 drop handling.
- Added `src/features/crm/calendar/big-calendar/event-card.tsx` for draggable event cards and resize command affordance.
- Added `src/features/crm/calendar/big-calendar/helpers.ts` and `types.ts` for local view, slot, date range, and command contracts.
- Updated `src/features/crm/calendar/components/calendar-workspace.tsx` to use the Big Calendar provider/header/views instead of local custom renderers.
- Updated `src/features/crm/calendar/components/calendar-adapter.ts` with `mapBigCalendarActionToActivityCommand()`.
- Extended `BigCalendarEvent.source` with `ownerId` and `assigneeId` so the provider can support user filtering without reading database rows.
## Rejected Upstream Demo Code
- Did not import the upstream app shell, demo stores, or mock data ownership.
- Did not add React Hook Form; this repository forbids new RHF usage.
- Did not add upstream persistence or direct database reads.
- Did not mutate `crm_calendar_projection` rows from UI interactions.
- Did not replace the Activity API or Business Event flow.
## Interaction Behavior
- Editable Activity events can emit reschedule commands through `rescheduleActivity()`.
- Drag/drop maps a dropped editable Activity to an Activity reschedule request.
- Resize currently uses a command-based duration extension affordance rather than full upstream edge-resize parity.
- Read-only milestones do not emit Activity commands.
- After successful reschedule, Calendar, Activity, and My Day query groups are invalidated.
- Day, Week, and Month retain EP.1.6.1 behavior by always rendering grid slots, including empty states.
- Agenda keeps list-style empty behavior.
## Upgrade Strategy
Future upstream sync should compare against commit `fbb8485e3d54b267261056c784632229ba6f7bc3`, then port only rendering and interaction improvements into `src/features/crm/calendar/big-calendar/**`. Keep ALLA OS adapter and command boundaries stable.
Full upstream parity still requires a deliberate dependency review for `react-dnd`, upstream resize behavior, and any accessibility changes before adding them to this Next.js 16 / React 19 / shadcn / TanStack stack.
## Verification
- Passed: `npm run typecheck`
- Passed: `npx oxlint src/features/crm/calendar`
- Not run: `npm run db:generate` because EP.1.6.2 made no schema changes.
- Not automated: browser drag/drop, resize, responsive, and screen-reader regression checks.