Aller au contenu principal

UI Design System & AI Coder Instructions (Ui Reference)

Every page across https://api.gpkeys.com/ and https://api.gpkeys.com/api/ is built on the DropX Admin UI system located in the local workspace folder `Ui Reference /` (excluded from TypeScript compilation in tsconfig.json).

If you are an AI coding assistant or contributor, follow these standards on every new page, section, card, table, and graph.


1. Visual Shell & Tokens (src/css/custom.css)​

  • Shell Architecture (src/theme/Layout/index.tsx): Collapsible DropX Sidebar (256px expanded / 68px icon-only collapsed / drawer < 1024px), sticky 68px Header (Ctrl + K Quick Search modal, theme toggle, fullscreen toggle, EN/FR locale menu), and full-width responsive content container (360px mobile to 3840px 4K TV).
  • Theme Tokens:
    • Light: canvas --background: #f9fafb, surface --card: #ffffff, border --border: #e5e7eb, primary #4f46e5 / #6366f1.
    • Dark ([data-theme='dark'] + .dark): canvas --background: #0f172a, surface --card: #1e293b, border --border: #334155, primary #818cf8.
    • Chart Palette: --chart-1 (#6366f1 / #818cf8) through --chart-7.

2. Reusable UI Components (src/components/ui/index.tsx)​

Import DropX UI primitives instead of writing one-off cards or badges:

import {
AnimatedProgress,
Badge,
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
GradientCard,
PageHeader,
} from '@site/src/components/ui'
  • PageHeader: Breadcrumb, eyebrow badges, <h1> title, subtitle, and right-aligned action buttons.
  • GradientCard: KPI stat cards supporting primary, success, warning, danger, info, purple, pink, ocean, and sunset gradients.
  • Card + .data-table: Rounded 12px (--radius-xl) cards with --shadow-card elevation; wrap tables in .gp-table-wrap with class gp-table data-table.

3. Recharts Graphs (src/components/ui/chart-theme.ts)​

All graphs use Recharts (AreaChart, BarChart, PieChart, LineChart) paired with DropX theme helpers and <BrowserOnly> for safe static SSR builds:

import BrowserOnly from '@docusaurus/BrowserOnly'
import { Area, AreaChart, CartesianGrid, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts'
import { axisTick, chartColors, tooltipProps } from '@site/src/components/ui/chart-theme'

Graph rules:

  1. Always style strokes/fills via chartColors, ticks via axisTick, and tooltips via {...tooltipProps}.
  2. Wrap <ResponsiveContainer> inside <BrowserOnly> with a fixed-height container (height: 220px or 260px) and direction: ltr.
  3. Clearly badge sample/mock data as Sandbox Reference unless fetched from a live API endpoint.
  4. Keep existing charts (src/components/ApiTelemetryDashboard.tsx) synchronized with openapi.yaml and docs/rate-limits.md.

4. Navigation, i18n & Verification​

  • Navigation: Register new pages in both sidebars.ts and src/config/navigation.ts (SIDEBAR_NAV_GROUPS + QUICK_SEARCH_ENTRIES).
  • Localization: Translate UI strings in i18n/fr/code.json, and preserve dir="ltr" isolation on URLs, code snippets, and charts.
  • Footer Credit: Preserve the "Designed & developed by DataDropX" (https://datadropx.net) credit in src/theme/Footer/index.tsx.
  • Verify Every Edit: Run pnpm typecheck && pnpm verify before committing or deploying.