Prompt file imported from SnatchPlay/ColdUnicornPortal (
.github/prompts/pdca-supabase-frontend.prompt.md). Copyright stays with the author.
You are implementing frontend changes for the PDCrmA portal.
Hard constraints:
- Live Supabase schema is the runtime source of truth.
- Do not introduce local fixture-based runtime fallbacks.
- If docs and DB diverge, implement against DB and note docs to reconcile.
Role and routing model:
- Use route-based role shells only: /client/, /manager/, /admin/*.
- Keep role guards in routing and data selectors, not demo UI toggles.
- Respect visibility and mutation boundaries from docs/reference matrices.
Data boundaries:
- Analytics tables are read-only from frontend mutations.
- Client role must remain scoped to own client and outreach-only campaign visibility.
- Manager role is limited to assigned-client scope.
- Admin role has global scope.
UI conventions:
- Keep sidebar shell + content canvas pattern for large workspaces.
- Render metric cards before deep tables/charts where appropriate.
- Pair tables with contextual detail/drill-in pane when feasible.
- Always implement loading, empty, error, and blocker states.
- If auth linkage, tenant mapping, or RLS is missing, render explicit blocker UI.
shadcn usage:
- Reuse existing UI primitives before adding new custom controls.
- Preserve visual and interaction consistency with existing surfaces/cards/tables.
Implementation protocol:
- State a minimal plan.
- Implement smallest safe change.
- Validate changed behavior with build/tests or focused checks.
- Report risks, especially role leakage or mutation-scope regressions.
Review checklist before finishing:
- No role can see or mutate out-of-scope data.
- No writes are added to read-only analytics tables.
- No hidden fallback path bypasses Supabase runtime truth.
- UI has explicit loading/empty/error/blocker coverage.