c_agri_trade/04_generated_documentation/06_wireframes/DESIGN.md

3.9 KiB

Frontend Design Guideline & Component Standard

Field Value
Document DESIGN.md
System Universal Enterprise Platform (UEP)
Governed by UP-AI v1.0 Stage 11 Design Standard
Status Baselined
Scope Cross-portal frontend design & component guideline for Stage 11 (up-wireframe-spec) and Stage 13 (up-code-generate)

0. Purpose

This document establishes the universal design tokens, layout shells, screen archetypes, and component composition rules across all frontend portals in the platform.

It eliminates UI drift and guarantees that:

  1. All screens compose from standardized design system primitives (Radix UI / shadcn / Tailwind CSS).
  2. Wireframe screen shapes map deterministically to component patterns.
  3. Common cross-portal behaviors (OIDC redirect, RBAC menu filtering, toast notifications, error handling) are implemented consistently.

1. Design System Foundation & Tokens

1.1 Technology Stack

  • Framework: React 19 + TypeScript + Vite
  • Styling: Tailwind CSS v4 with CSS-first custom tokens
  • Component Primitives: Radix UI / shadcn/ui (class-variance-authority)
  • Icons: lucide-react
  • Charts: recharts / shadcn chart wrapper

1.2 Core Color & Semantic Tokens (index.css)

Token HSL / Value Semantic Purpose
--primary hsl(221, 83%, 53%) Primary brand action, active navigation, focus rings
--background hsl(0, 0%, 100%) / hsl(222, 47%, 11%) Canvas background (Light / Dark mode)
--card hsl(0, 0%, 100%) / hsl(217, 33%, 17%) Surface container for table/form/metric cards
--success hsl(142, 76%, 36%) Active, Confirmed, Delivered, Resolved states
--warning hsl(38, 92%, 50%) Pending, In-Progress, Expiring-Soon states
--destructive hsl(0, 84%, 60%) Failed, Rejected, Cancelled, Overdue states
--info hsl(199, 89%, 48%) Informational, Draft, Awaiting-Approval states

2. Universal Layout Shell (MainLayout.tsx)

Every authenticated portal route runs under a standard layout shell:

+-------------------------------------------------------------------------+
| [Logo] Tenant Name            [Search / Quick Actions]  [User Avatar]   |  <-- Header
+-------------------+-----------------------------------------------------+
| Navigation:       |                                                     |
| - Dashboard       |  Breadcrumbs / PageHeader(Title, Actions)          |
| - Management      |                                                     |
| - Settings        |  [Routed Page Content: Table / Form / Dashboard]    |
| - Audit Logs      |                                                     |
|                   |                                                     |
+-------------------+-----------------------------------------------------+
| [Collapse Sidebar]| Global Toaster                                      |
+-------------------+-----------------------------------------------------+
  • Route Guarding: Unauthenticated state immediately triggers OIDC redirect to Keycloak.
  • RBAC Filtering: Sidebar items and action buttons evaluate user role claims before rendering.

3. Seven Screen Archetypes → Component Mapping

  1. List / Table + Filters: Card + FilterBar + Table + Pagination + row action DropdownMenu.
  2. Dashboard / Metrics: MetricCard (KPI tiles) + Chart (Recharts) + ActivityFeed.
  3. Multi-Step Form / Wizard: Stepper + Form (React Hook Form + Zod) + ButtonGroup.
  4. Detail / Split-Panel View: PageHeader + Tabs (Overview, History, Permissions, Audit).
  5. Modal / Action Dialog: Dialog / AlertDialog (one dialog per distinct row action).
  6. Live Telemetry / Stream: Map canvas or event stream + collapsible filter drawer + status legend.
  7. Error / Empty State: EmptyStateCard with descriptive icon, friendly title, and primary recovery action button.