task-ep.1.7

This commit is contained in:
phaichayon
2026-07-13 16:55:55 +07:00
parent ab56852c47
commit e0fcb3992b
12 changed files with 1762 additions and 101 deletions

View File

@@ -0,0 +1,103 @@
# Task EP.1.7 My Day Workspace Foundation - 2026-07-13
## Scope Delivered
- added My Day feature module under `src/features/crm/my-day/**`
- added `/api/crm/my-day` route handler with organization access and CRM Activity read permission
- added `/dashboard/crm/my-day` workspace route with server prefetch, React Query hydration, loading states, and widget layout
- added My Day Widget Registry with widget id, title, priority, icon, permission, visibility, refresh strategy, and empty state
- added My Day service composition over existing foundations:
- Calendar Projection for today's schedule and due-today work
- Activity service for overdue Activity queue
- CRM Dashboard service for Hot Projects and pending approvals
- Timeline Projection for recent user-authored updates
- added priority queue ordering for overdue, due today, approvals, hot projects, and schedule items
- added CRM nav entry for My Day before CRM Dashboard
- preserved Activity, Calendar, Timeline, Opportunity, Quotation, Approval, Dashboard, Report, Notification behavior
## Review Summary
Reviewed before/during implementation:
- `AGENTS.md`
- `plans/task-ep.1.7.md`
- `LAYOUT.md`
- `docs/standards/engineering-constitution.md`
- `docs/standards/project-foundations.md`
- `docs/standards/architecture-rules.md`
- `docs/standards/ui-ux-rules.md`
- `docs/standards/task-review-checklist.md`
- `docs/security/crm-authorization-boundaries.md`
- `docs/business/relationship-sales-workspace-blueprint-v1.md`
- `docs/implementation/task-ar.2-workspace-ui-ux-design-note-2026-07-07.md`
- `docs/implementation/task-ep1.5-timeline-projection-foundation-2026-07-13.md`
- `docs/implementation/task-ep1.6-calendar-projection-workspace-big-calendar-foundation-2026-07-13.md`
- existing Activity, Calendar, Timeline, Dashboard, CRM security, and dashboard UI patterns
## Architecture Notes
My Day is read-oriented and does not own business data. It composes existing source-domain and projection services instead of introducing duplicate Activity, Calendar, Timeline, Approval, Opportunity, or Quotation logic.
Primary service:
- `src/features/crm/my-day/server/service.ts`
Public contracts:
- `src/features/crm/my-day/api/types.ts`
- `src/features/crm/my-day/api/service.ts`
- `src/features/crm/my-day/api/queries.ts`
Widget registry:
- `src/features/crm/my-day/server/widget-registry.ts`
## Widget Delivery
Implemented foundation widgets:
- Overdue Activities
- Today's Schedule
- Due Today priority items
- Hot Projects
- Pending Approvals
- Recently Updated
- My Statistics
Quotation Attention is represented in the registry and response contract, but no bespoke quotation-risk query was added in this slice to avoid duplicating Quotation/Dashboard logic before a governed urgency adapter exists.
## Security Notes
- Route requires active organization access and `crm.activity.read`.
- Activity visibility is enforced by existing Activity service.
- Calendar visibility is enforced by existing Calendar projection query service.
- Hot Projects and approvals reuse Dashboard service visibility rules.
- Recent Timeline is limited to the current actor to avoid organization-wide timeline leakage until team-scoped Timeline access is formalized.
- Manager mode is contract-ready but intentionally conservative while team graph scope remains a known governance limitation.
## UI/UX Review
- Follows AR.2 My Day design note: high-priority queue first, summary stats, active schedule, hot projects, approvals, recent updates.
- Uses `PageContainer`, shadcn cards, badges, buttons, and skeletons.
- Adds Add Activity entry point via existing Activity workspace instead of creating a duplicate form.
- Uses deterministic date/time display through `src/lib/date-format.ts`.
- Empty states exist per rendered widget.
- Status is not color-only: priority, source type, refresh strategy, and action labels are visible text.
## Known Follow-ups
- Wire Add Activity to an Activity form sheet with context-aware prefills once reusable Activity form entry is exposed outside the Activity listing.
- Implement source-owned Quotation Attention adapter for expiring soon, pending approval, and returned revision.
- Add manager team filter UI after team hierarchy/scope behavior is formalized.
- Add independent per-widget query endpoints if operational telemetry shows full workspace refetch is too coarse.
- Add workspace analytics for widget usage, quick action usage, Add Activity usage, and completion rate with sanitized payloads.
- Decide rollout for making My Day the post-login/default CRM landing without disrupting the existing dashboard route.
## Verification
- `npm run typecheck`
- `npx oxlint src/features/crm/my-day src/app/api/crm/my-day src/app/dashboard/crm/my-day src/config/nav-config.ts`
## Outcome
EP.1.7 now has a governed My Day Workspace foundation that lets users start from a prioritized operational queue while preserving source-domain ownership and existing CRM workflows.