@schandlergarcia/sf-web-components 1.9.48 → 1.9.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.a4drules/features/command-center-dashboard-rule.md +20 -7
- package/.a4drules/features/engine-dashboard-rule.md +302 -0
- package/.a4drules/features/phase2-data-pattern.md +166 -0
- package/.a4drules/features/pre-code-checklist.md +72 -0
- package/.a4drules/skills/command-center-builder/SKILL.md +635 -29
- package/.a4drules/skills/command-center-project/SKILL.md +4 -4
- package/.a4drules/skills/component-library/SKILL.md +1000 -27
- package/.a4drules/troubleshooting/graphql-introspection-failure.md +286 -0
- package/.a4drules/validation-requirements.md +211 -0
- package/.a4drules/webapp-data.md +353 -0
- package/.a4drules/webapp-ui.md +16 -0
- package/CHANGELOG.md +258 -0
- package/data/README.md +80 -17
- package/data/engine-command-center-prd.md +436 -0
- package/data/schema.graphql +292 -0
- package/package.json +1 -1
- package/scripts/generate-schema-from-sample.mjs +370 -0
- package/scripts/postinstall.mjs +94 -0
- package/scripts/reset-command-center.sh +317 -3
|
@@ -1,46 +1,652 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: command-center-builder
|
|
3
|
-
description:
|
|
3
|
+
description: >-
|
|
4
|
+
Strict rules for building command center pages, dashboards, components, and
|
|
5
|
+
layouts. Use when creating or editing dashboard pages, choosing components,
|
|
6
|
+
designing layouts, styling with dark mode, or working with charts, tables,
|
|
7
|
+
forms, filters, chat, or navigation in this project.
|
|
4
8
|
---
|
|
5
9
|
|
|
6
10
|
# Command Center Builder Rules
|
|
7
11
|
|
|
8
12
|
These rules apply when building dashboards rendered by `CommandCenter.tsx`. For full component API details, read the **component-library** skill.
|
|
9
13
|
|
|
10
|
-
##
|
|
14
|
+
## STOP — READ BEFORE WRITING ANY CODE
|
|
11
15
|
|
|
12
|
-
|
|
16
|
+
**Every time you build a dashboard, you MUST follow these non-negotiable rules. Violations are the #1 cause of rejected dashboards.**
|
|
13
17
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
| **[data-forms-ai.md](./data-forms-ai.md)** | Data mode (sample vs live), Forms & record modals, AI chat & agent, Tables | Working with data sources, forms, AI features |
|
|
20
|
-
| **[charts-visualization.md](./charts-visualization.md)** | Charts & visualizations (MANDATORY rules), Portals, Loading/error/empty states | Building charts, visualizations, data viz |
|
|
21
|
-
| **[completion-checklist.md](./completion-checklist.md)** | Pre-completion checklist, Post-completion verification (REQUIRED), Anti-patterns | Before reporting done — validation steps |
|
|
18
|
+
Before writing any code, read `.a4drules/features/pre-code-checklist.md` and verify all requirements. The most common mistakes are:
|
|
19
|
+
- Creating `.jsx` instead of `.tsx` files
|
|
20
|
+
- Creating files in `src/components/pages/` instead of `src/pages/`
|
|
21
|
+
- Using forbidden colors (`text-white`, `bg-black`)
|
|
22
|
+
- Hand-rolling HTML cards instead of using library components
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
1. **Actually write files to disk.** Use the file-writing tools to create `.tsx` files (NOT `.jsx`) in `src/pages/` (NOT `src/components/pages/`) and update `CommandCenter.tsx` to import your dashboard. This is a TypeScript project - all React components MUST use `.tsx` extension. If you only describe what you would build without creating the files, the dashboard will not render. Verify the files exist after writing them.
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
2. **Creating the page file?** → Check [page-layout.md](./page-layout.md) for wiring and structure
|
|
27
|
-
3. **Adding components?** → Use [components-styling.md](./components-styling.md) + **component-library** skill
|
|
28
|
-
4. **Building charts?** → Follow [charts-visualization.md](./charts-visualization.md) MANDATORY rules
|
|
29
|
-
5. **Before reporting done?** → Run [completion-checklist.md](./completion-checklist.md) verification
|
|
26
|
+
2. **Use ONLY library components** from `@/components/library` for all cards, charts, tables, lists, and feeds. The library has 30+ components — there is no reason to hand-roll HTML. See the component table below.
|
|
30
27
|
|
|
31
|
-
|
|
28
|
+
3. **No navigation inside the dashboard.** No `<nav>`, no header bar, no tab bar acting as page-level navigation. The app shell handles navigation. Your dashboard starts with content.
|
|
32
29
|
|
|
33
|
-
|
|
34
|
-
- **Never hand-roll HTML cards** — use library components only
|
|
35
|
-
- **Dark mode is MANDATORY** — all color choices must support it
|
|
36
|
-
- **Images are MANDATORY** — every dashboard needs relevant visuals
|
|
37
|
-
- **Charts have strict rules** — D3Chart only, specific templates required
|
|
38
|
-
- **No dashboard-level navigation** — dashboards are nav targets, not nav containers
|
|
39
|
-
- **Validation is REQUIRED** — run post-completion checklist before reporting done
|
|
30
|
+
4. **Max 4 MetricCards per row.** Never 5. Split into two rows if needed.
|
|
40
31
|
|
|
41
|
-
|
|
32
|
+
5. **All charts use `ChartCard` + `D3Chart` or `GeoMap`.** No Recharts, no Chart.js, no custom SVG, no canvas, no hand-drawn paths. The only charting tools allowed are `D3Chart` (with `D3ChartTemplates` or a custom `renderChart` function) and `GeoMap`.
|
|
42
33
|
|
|
43
|
-
|
|
34
|
+
6. **Never `npm install` Salesforce packages.** The `@salesforce/*` packages are platform-provided via broken symlinks. They are stubbed in `src/stubs/` and aliased in `vite.config.ts`. Do not try to install them — they don't exist on npm. If you see a TypeScript error about `@salesforce/vite-plugin-webapp-experimental`, ignore it — the build still succeeds via `vite build` (the `tsc` error is in `vite.config.ts` which is handled separately by `tsconfig.node.json`).
|
|
44
35
|
|
|
45
|
-
|
|
46
|
-
|
|
36
|
+
If your output violates any of these 6 rules, it will be rejected and you will need to redo the work.
|
|
37
|
+
|
|
38
|
+
## CRITICAL: Use Library Components — Never Hand-Roll HTML Cards
|
|
39
|
+
|
|
40
|
+
**This is the #1 mistake.** The component library (`@/components/library`) provides pre-built, themed, dark-mode-ready cards for every common dashboard need. You MUST use them instead of writing raw `<div>` cards with custom classes.
|
|
41
|
+
|
|
42
|
+
### Before writing ANY card-like UI, check this table:
|
|
43
|
+
|
|
44
|
+
| Need | MUST use | NEVER do |
|
|
45
|
+
|------|----------|----------|
|
|
46
|
+
| KPI / stat | `MetricCard` | `<div className="bg-white border ..."><h3>Total Spend</h3><span>$4,903</span></div>` |
|
|
47
|
+
| List of items | `ListCard` | `<div className="bg-white ..."><div className="space-y-3">` with custom item rows |
|
|
48
|
+
| Activity feed | `ActivityCard` or `FeedPanel` | `<div>` with hand-rolled interaction rows |
|
|
49
|
+
| Data table | `TableCard` | `<table>` or custom grid of rows |
|
|
50
|
+
| Stats panel | `WidgetCard` or `SectionCard` | `<div className="bg-white ... p-6">` with label/value pairs |
|
|
51
|
+
| Custom interactive content (expand/collapse, inline details) | `WidgetCard` (sections accept arbitrary JSX) or `ListCard` (with `onItemClick` + `itemActions`) | Hand-rolled `<div>` card with custom expand/collapse logic |
|
|
52
|
+
| Status items | `StatusCard` | `<div>` with custom status badges |
|
|
53
|
+
| Text summary | `NarrativeSummary` / `SectionCard` | `<div>` with headings and paragraphs |
|
|
54
|
+
| Alert / callout | `CalloutCard` | Custom banner div |
|
|
55
|
+
|
|
56
|
+
**Every visible section of a dashboard should be a library component.** If you find yourself writing `<div className="bg-white border rounded-[10px] shadow-sm p-6">` with content inside, STOP — you are hand-rolling a card. Find the library component that fits.
|
|
57
|
+
|
|
58
|
+
### Correct example:
|
|
59
|
+
|
|
60
|
+
```jsx
|
|
61
|
+
import { MetricCard, ListCard, ActivityCard, WidgetCard } from "@/components/library";
|
|
62
|
+
|
|
63
|
+
// KPIs — use MetricCard
|
|
64
|
+
<MetricCard title="Active Travelers" value={6} subtitle="Currently traveling" />
|
|
65
|
+
|
|
66
|
+
// List — use ListCard with items array
|
|
67
|
+
<ListCard title="Trip Activity" items={trips.map(t => ({
|
|
68
|
+
id: t.id, title: t.hotel, description: `${t.city} · ${t.dates}`,
|
|
69
|
+
status: t.status, avatar: t.travelerInitials
|
|
70
|
+
}))} />
|
|
71
|
+
|
|
72
|
+
// Activity feed — use ActivityCard
|
|
73
|
+
<ActivityCard title="Eva — Recent Interactions" items={interactions.map(i => ({
|
|
74
|
+
id: i.id, title: i.traveler, description: i.query,
|
|
75
|
+
status: i.status, timestamp: i.time
|
|
76
|
+
}))} />
|
|
77
|
+
|
|
78
|
+
// Stats panel — use WidgetCard
|
|
79
|
+
<WidgetCard title="Company Activity">
|
|
80
|
+
{/* structured content */}
|
|
81
|
+
</WidgetCard>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Wrong example (hand-rolled HTML):
|
|
85
|
+
|
|
86
|
+
```jsx
|
|
87
|
+
// ❌ NEVER DO THIS — this is a hand-rolled card
|
|
88
|
+
<div className="bg-white border border-engine-border rounded-[10px] shadow-sm">
|
|
89
|
+
<div className="p-6 border-b border-engine-border">
|
|
90
|
+
<h2 className="text-lg font-semibold">Trip Activity</h2>
|
|
91
|
+
</div>
|
|
92
|
+
<div className="p-6 space-y-4">
|
|
93
|
+
{trips.map(trip => (
|
|
94
|
+
<div key={trip.id} className="flex gap-4 p-4 rounded-lg border ...">
|
|
95
|
+
...
|
|
96
|
+
</div>
|
|
97
|
+
))}
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Images (MANDATORY)
|
|
103
|
+
|
|
104
|
+
The only image allowed in dashboards is the **company logo**: `src/assets/images/engine_logo.png`. Import it as a module and use it where a logo is needed (nav header, branding, etc.).
|
|
105
|
+
|
|
106
|
+
```jsx
|
|
107
|
+
import engineLogo from "@/assets/images/engine_logo.png";
|
|
108
|
+
|
|
109
|
+
<img src={engineLogo} alt="Engine" className="h-8 w-auto" />
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
- **Do not use external image URLs** (Unsplash, placeholder services, etc.) unless the user explicitly requests images.
|
|
113
|
+
- **Do not use other asset images** (codey-*.png, etc.) unless the user asks for them.
|
|
114
|
+
- **Preserve aspect ratio** — always use `w-auto` with a fixed height, or `h-auto` with a fixed width. Never set both `w-*` and `h-*` to fixed values on the logo or any image, as this distorts the aspect ratio.
|
|
115
|
+
|
|
116
|
+
```jsx
|
|
117
|
+
// ✅ Correct — aspect ratio preserved
|
|
118
|
+
<img src={engineLogo} alt="Engine" className="h-8 w-auto" />
|
|
119
|
+
<img src={engineLogo} alt="Engine" className="w-24 h-auto" />
|
|
120
|
+
|
|
121
|
+
// ❌ Wrong — aspect ratio distorted
|
|
122
|
+
<img src={engineLogo} alt="Engine" className="w-8 h-8" />
|
|
123
|
+
<div className="w-8 h-8 bg-black rounded" /> // placeholder box instead of logo
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## No Dashboard-Level Navigation (MANDATORY)
|
|
127
|
+
|
|
128
|
+
Dashboard pages must NOT include their own `<nav>`, header bar, or top navigation of any kind. Navigation is handled by `appLayout.tsx`. The dashboard renders inside the app shell — adding a nav inside the dashboard creates a duplicate header, which is the most visually obvious mistake.
|
|
129
|
+
|
|
130
|
+
- ❌ `<nav className="bg-white border-b ...">` inside a dashboard page
|
|
131
|
+
- ❌ A header bar with logo + nav links + user avatar inside the dashboard
|
|
132
|
+
- ❌ Tab bars that act as top-level navigation (Overview, Travelers, Spend, etc.)
|
|
133
|
+
- ❌ `useState("overview")` / `useState("travelers")` to toggle between views — this IS tab navigation even without a `<nav>` element
|
|
134
|
+
- ❌ `{activeView === "overview" && (...)}` / `{activeView === "travelers" && (...)}` — content-swapping IS multi-tab navigation
|
|
135
|
+
- ✅ Dashboard starts directly with content (metrics, then primary content)
|
|
136
|
+
- ✅ If you need sub-sections, use the library `Tabs` component **inside a card** — not as a full-width page-level switcher
|
|
137
|
+
- ✅ Build a single-page dashboard — all content visible by scrolling. Do NOT split into multiple tab "pages" that swap content.
|
|
138
|
+
|
|
139
|
+
**Self-check:** If your dashboard has `useState` for an "active tab" or "active view" that conditionally renders different page sections, you are building multi-tab navigation. Delete it and put all content on one scrollable page.
|
|
140
|
+
|
|
141
|
+
**Self-check:** If your dashboard JSX starts with `<nav>`, a sticky tab bar, or a `<div>` that spans the full width with nav links, you are violating this rule. Delete it.
|
|
142
|
+
|
|
143
|
+
### Why no multi-tab dashboards?
|
|
144
|
+
|
|
145
|
+
Splitting a dashboard into 5 tab "pages" (Overview, Travelers, Spend, Policy, Eva) means each tab is a separate mini-app. This violates the single-page dashboard pattern. Instead, put **all sections on one scrollable page** using the vertical page structure (metrics → primary content → secondary content). If content is too long, prioritize the most important sections and use cards with `maxBodyHeight` to constrain tall sections.
|
|
146
|
+
|
|
147
|
+
## Where Dashboards Live & How to Wire Them
|
|
148
|
+
|
|
149
|
+
- Dashboard page files: `src/pages/` (e.g. `EngineDashboard.tsx`, `FleetDashboard.tsx`) — **NOT** `src/components/pages/`
|
|
150
|
+
- File format: `.tsx` (MUST be TypeScript) — this is a TypeScript project, all React components use `.tsx`, NEVER `.jsx`.
|
|
151
|
+
- `CommandCenter.tsx` wraps with `AppThemeProvider` + `DataModeProvider` + `Toaster`. **Never recreate these providers in dashboard pages.**
|
|
152
|
+
|
|
153
|
+
### Wiring a new dashboard (REQUIRED STEPS)
|
|
154
|
+
|
|
155
|
+
You must do ALL of these or the dashboard will not render correctly:
|
|
156
|
+
|
|
157
|
+
**Step 1:** Create the dashboard file in `src/pages/` (NOT `src/components/pages/`):
|
|
158
|
+
```tsx
|
|
159
|
+
// src/pages/MyDashboard.tsx (NOTE: .tsx NOT .jsx, in src/pages/ NOT src/components/pages/)
|
|
160
|
+
import React from "react";
|
|
161
|
+
import { MetricCard, ListCard, ChartCard, D3Chart } from "@/components/library";
|
|
162
|
+
|
|
163
|
+
export default function MyDashboard() {
|
|
164
|
+
return (
|
|
165
|
+
<div className="space-y-6 p-6">
|
|
166
|
+
{/* dashboard content using library components */}
|
|
167
|
+
</div>
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Step 2:** Update `CommandCenter.tsx` to import and render it:
|
|
173
|
+
```tsx
|
|
174
|
+
// src/components/workspace/CommandCenter.tsx
|
|
175
|
+
import AppThemeProvider from "@/components/library/theme/AppThemeProvider";
|
|
176
|
+
import DataModeProvider from "@/components/library/data/DataModeProvider";
|
|
177
|
+
import { Toaster } from "sonner";
|
|
178
|
+
import MyDashboard from "../../pages/MyDashboard"; // ← change this import
|
|
179
|
+
|
|
180
|
+
export default function CommandCenter() {
|
|
181
|
+
return (
|
|
182
|
+
<AppThemeProvider initialMode="light">
|
|
183
|
+
<DataModeProvider initialMode="sample">
|
|
184
|
+
<MyDashboard /> {/* ← change this */}
|
|
185
|
+
<Toaster position="bottom-right" />
|
|
186
|
+
</DataModeProvider>
|
|
187
|
+
</AppThemeProvider>
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
**Step 2.5:** Update `Home.tsx` to render `CommandCenter`:
|
|
193
|
+
```tsx
|
|
194
|
+
// src/pages/Home.tsx
|
|
195
|
+
import CommandCenter from "@/components/workspace/CommandCenter";
|
|
196
|
+
|
|
197
|
+
export default function HomePage() {
|
|
198
|
+
return <CommandCenter />;
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
**Step 3:** Update `src/routes.tsx` to make the dashboard the home page. Replace the Search page index route with the Home/CommandCenter route:
|
|
203
|
+
```tsx
|
|
204
|
+
// src/routes.tsx — change the index route
|
|
205
|
+
{
|
|
206
|
+
index: true,
|
|
207
|
+
element: <SuspenseWrap><Home /></SuspenseWrap>,
|
|
208
|
+
handle: { showInNavigation: true, label: 'Dashboard' }
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
path: "search",
|
|
212
|
+
element: <SuspenseWrap><Search /></SuspenseWrap>,
|
|
213
|
+
handle: { showInNavigation: true, label: 'Search' }
|
|
214
|
+
},
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
The `Home` page renders `CommandCenter`, which renders your dashboard. The Search page moves to `/search`.
|
|
218
|
+
|
|
219
|
+
**Verify:** After writing all files, confirm:
|
|
220
|
+
1. Your dashboard `.tsx` file exists in `src/pages/`
|
|
221
|
+
2. `CommandCenter.tsx` (in `src/components/workspace/`) imports your dashboard (not `BlankDashboard`)
|
|
222
|
+
3. `Home.tsx` (in `src/pages/`) imports and renders `CommandCenter` (not search interface)
|
|
223
|
+
4. `src/routes.tsx` has `Home` as the index route and `Search` at `/search`
|
|
224
|
+
|
|
225
|
+
## Page Structure
|
|
226
|
+
|
|
227
|
+
Every page follows this vertical order — never rearrange:
|
|
228
|
+
1. Context (NarrativeSummary or heading) — optional
|
|
229
|
+
2. KPI metrics (MetricsStrip or MetricCard grid) — required for dashboards
|
|
230
|
+
3. Primary content (tables, charts, status)
|
|
231
|
+
4. Secondary content (lists, logs, supporting data) — optional
|
|
232
|
+
5. Actions — optional
|
|
233
|
+
|
|
234
|
+
Wrap all page content in `<div className="space-y-6">`. Do NOT use `mb-6` between sections — the wrapper handles spacing.
|
|
235
|
+
|
|
236
|
+
## Layout Grids
|
|
237
|
+
|
|
238
|
+
Only these grid patterns — do not invent new ones:
|
|
239
|
+
|
|
240
|
+
- **4 metrics (MAXIMUM per row — never 5 or more):** `grid grid-cols-2 gap-3 lg:grid-cols-4`
|
|
241
|
+
- **3 metrics:** `grid grid-cols-1 gap-3 sm:grid-cols-3`
|
|
242
|
+
- **Wide/narrow split:** `grid grid-cols-1 items-start gap-4 lg:grid-cols-3` with `lg:col-span-2` on the wide side
|
|
243
|
+
- **3-col balanced:** `grid grid-cols-1 items-start gap-4 lg:grid-cols-3`
|
|
244
|
+
- **Equal two-col:** `grid grid-cols-1 items-start gap-4 lg:grid-cols-2`
|
|
245
|
+
- **Full-width:** `<div className="w-full">` — charts with 24+ data points
|
|
246
|
+
|
|
247
|
+
`gap-4` for content grids, `gap-3` for metric rows. Start `grid-cols-1` (or `grid-cols-2` for metrics) for mobile. Only `sm:` and `lg:` breakpoints unless justified.
|
|
248
|
+
|
|
249
|
+
**Max 4 KPIs per row — NEVER 5 or more.** If you have 5+ metrics, split into two rows (e.g. 4 + 1, or 3 + 2). Always `items-start` on grids pairing different-height cards. Use `maxBodyHeight={px}` for long card bodies. Actions go in card `actions` slot. Place `FilterBar` near the data it controls.
|
|
250
|
+
|
|
251
|
+
## Layout Differentiation
|
|
252
|
+
|
|
253
|
+
Every dashboard needs a unique layout structure and at least one domain-specific "signature element" that couldn't exist in another dashboard. Vary section ordering, grid proportions, density, and visual rhythm.
|
|
254
|
+
|
|
255
|
+
## Map Layout
|
|
256
|
+
|
|
257
|
+
GeoMap should be placed in a **wide/narrow grid** (`lg:grid-cols-3` with `lg:col-span-2`), not full-width hero. Full-width maps dominate the page and waste space.
|
|
258
|
+
|
|
259
|
+
**Pattern: Map + sidebar at matched height**
|
|
260
|
+
|
|
261
|
+
```jsx
|
|
262
|
+
<div className="grid grid-cols-1 gap-4 lg:grid-cols-3">
|
|
263
|
+
<div className="lg:col-span-2 relative overflow-hidden rounded-xl h-[300px]">
|
|
264
|
+
<GeoMap
|
|
265
|
+
markers={locations}
|
|
266
|
+
arcs={arcs}
|
|
267
|
+
overlays={overlays}
|
|
268
|
+
initialBounds={{ sw: [-130, 24], ne: [-65, 50], padding: 30 }}
|
|
269
|
+
theme="dark"
|
|
270
|
+
width={960}
|
|
271
|
+
height={480}
|
|
272
|
+
zoomable
|
|
273
|
+
className="h-full w-full"
|
|
274
|
+
/>
|
|
275
|
+
</div>
|
|
276
|
+
{/* Sidebar card — use maxBodyHeight to match map height */}
|
|
277
|
+
{/* Map h-[300px] ≈ ListCard maxBodyHeight={236} + ~64px header */}
|
|
278
|
+
<ListCard title="Activity" items={items} maxBodyHeight={236} showStatus />
|
|
279
|
+
</div>
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
Key rules:
|
|
283
|
+
- **Do NOT wrap GeoMap in ChartCard** — GeoMap has its own background/borders
|
|
284
|
+
- **Match heights** — set map `h-[Xpx]` and sidebar `maxBodyHeight` so they align. Account for ~64px card header padding.
|
|
285
|
+
- **Use `initialBounds`** to auto-zoom to the region with data: `{ sw: [lonMin, latMin], ne: [lonMax, latMax], padding: 30 }`
|
|
286
|
+
- **Always pass `arcs`** for flight routes and `overlays` for disruption zones — not just markers
|
|
287
|
+
- **Use ListCard** (not ActivityCard) for the sidebar — ListCard supports `maxBodyHeight` for scroll, ActivityCard does not
|
|
288
|
+
- Keep map height at 280–320px — not 400+
|
|
289
|
+
|
|
290
|
+
## Component Selection
|
|
291
|
+
|
|
292
|
+
| Need | Component |
|
|
293
|
+
|------|-----------|
|
|
294
|
+
| Single KPI | `MetricCard` |
|
|
295
|
+
| Row of 2–4 KPIs | `MetricsStrip` (schema) / `MetricCard` grid |
|
|
296
|
+
| Tabular data | `TableCard` |
|
|
297
|
+
| Time series / distribution | `ChartCard` + `D3Chart` |
|
|
298
|
+
| Geographic / flight map | `GeoMap` |
|
|
299
|
+
| System health | `StatusCard` |
|
|
300
|
+
| Feed / item list | `ListCard` |
|
|
301
|
+
| Scrollable side panel | `FeedPanel` |
|
|
302
|
+
| Activity feed | `ActivityCard` |
|
|
303
|
+
| User avatar | `Avatar` |
|
|
304
|
+
| Text summary | `NarrativeSummary` (schema) / `SectionCard` |
|
|
305
|
+
| Actions | `ActionList` (schema) / `UIButton` group |
|
|
306
|
+
| Alert / callout | `CalloutCard` |
|
|
307
|
+
| Multi-section panel | `WidgetCard` |
|
|
308
|
+
|
|
309
|
+
## Component Data Contract
|
|
310
|
+
|
|
311
|
+
Common card props: `title`, `subtitle`, `actions`, `loading`, `error`, `emptyMessage`, `...cardProps`.
|
|
312
|
+
|
|
313
|
+
Item shape (StatusCard, ListCard, ItemList): `{ id?, title, description?, status?, timestamp?, value?, unit?, avatar? }`. `title` is primary; `name` is alias.
|
|
314
|
+
|
|
315
|
+
Never use hardcoded `indigo-*` — use `brand-*` classes.
|
|
316
|
+
|
|
317
|
+
## Metric Formatting
|
|
318
|
+
|
|
319
|
+
Use `fmtK()` helper — never manually append K/M/B:
|
|
320
|
+
|
|
321
|
+
```js
|
|
322
|
+
function fmtK(n) {
|
|
323
|
+
if (n >= 1e6) return `${(n / 1e6).toFixed(1)}M`;
|
|
324
|
+
if (n >= 1e3) return `${(n / 1e3).toFixed(1)}K`;
|
|
325
|
+
return n.toLocaleString();
|
|
326
|
+
}
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
## Brand & Accent Colors
|
|
330
|
+
|
|
331
|
+
Defined in `global.css` (`--color-brand-*` and `--color-engine-*`), available as Tailwind classes.
|
|
332
|
+
|
|
333
|
+
- `engine-*` for the Engine brand: `engine-teal`, `engine-coral`, `engine-orange`, `engine-savings`, `engine-text`, `engine-muted`, `engine-label`, `engine-border`, `engine-bg`
|
|
334
|
+
- `brand-*` for the legacy command center palette (indigo-based)
|
|
335
|
+
- Tailwind built-in colors for status (green/amber/red). Never use brand for status.
|
|
336
|
+
|
|
337
|
+
## Semantic Colors
|
|
338
|
+
|
|
339
|
+
- `"default"` — neutral | `"primary"` — brand | `"success"` — healthy | `"warning"` — attention | `"danger"` — critical
|
|
340
|
+
|
|
341
|
+
`changeType` reflects good/bad, not direction. Revenue down = `"negative"`. Incidents down = `"positive"`.
|
|
342
|
+
|
|
343
|
+
## Status Values
|
|
344
|
+
|
|
345
|
+
Canonical: `"operational"`, `"degraded"`, `"outage"`, `"maintenance"`. Always show color + text label.
|
|
346
|
+
|
|
347
|
+
## Dark Mode (MANDATORY)
|
|
348
|
+
|
|
349
|
+
Every visible element needs both light and dark styles. Library components handle this automatically — which is another reason to use them.
|
|
350
|
+
|
|
351
|
+
For any custom markup you do write:
|
|
352
|
+
|
|
353
|
+
| Role | Light | Dark |
|
|
354
|
+
|------|-------|------|
|
|
355
|
+
| Background | `bg-white` | `dark:bg-slate-900` |
|
|
356
|
+
| Surface | `bg-slate-50` | `dark:bg-slate-950/30` |
|
|
357
|
+
| Border | `border-slate-200` | `dark:border-slate-800` |
|
|
358
|
+
| Text primary | `text-slate-900` | `dark:text-slate-50` |
|
|
359
|
+
| Text secondary | `text-slate-600` | `dark:text-slate-300` |
|
|
360
|
+
| Text muted | `text-slate-500` | `dark:text-slate-400` |
|
|
361
|
+
| Brand tint | `brand-50` | `brand-950` |
|
|
362
|
+
|
|
363
|
+
**Never use `text-black` or `text-white`.** Use the slate scale. Never use `bg-black` for surfaces — use `bg-slate-900` / `dark:bg-slate-950`.
|
|
364
|
+
|
|
365
|
+
## Icons (Command Center)
|
|
366
|
+
|
|
367
|
+
**Heroicons 2** (`@heroicons/react`) exclusively inside command center pages. No Lucide, no Font Awesome, no inline SVGs.
|
|
368
|
+
|
|
369
|
+
- `24/outline` — default | `24/solid` — status/active | `20/solid` — chips/badges
|
|
370
|
+
- Sizes: `h-4 w-4` compact, `h-5 w-5` default, `h-6 w-6` emphasis, `h-8 w-8` hero only
|
|
371
|
+
- Always set a color class. Pass rendered elements: `icon={<UsersIcon className="h-5 w-5 text-brand-500" />}`
|
|
372
|
+
- ❌ Never use inline `<svg>` when a Heroicon exists for the same purpose
|
|
373
|
+
- ❌ Never guess icon names — Heroicons uses specific names that don't always match what you'd expect. Common mistakes: `PlaneIcon` (doesn't exist → use `PaperAirplaneIcon`), `FlightIcon` (doesn't exist → use `PaperAirplaneIcon`), `HotelIcon` (doesn't exist → use `BuildingOfficeIcon`), `MoneyIcon` (doesn't exist → use `BanknotesIcon`), `AlertIcon` (doesn't exist → use `ExclamationTriangleIcon`), `PersonIcon` (doesn't exist → use `UserIcon`)
|
|
374
|
+
|
|
375
|
+
## Fonts
|
|
376
|
+
|
|
377
|
+
Fonts are set in `global.css` via `@theme` block (`--font-sans`, `--font-mono`). No `next/font` in this project (that's the starter). No Google Fonts `<link>` tags.
|
|
378
|
+
|
|
379
|
+
## Filtering & Data Utilities
|
|
380
|
+
|
|
381
|
+
Three layers: `filterUtils.js` (pure) → `usePageFilters` hook (state) → `FilterBar` + components (UI).
|
|
382
|
+
|
|
383
|
+
- Pass `sortedData` (not `filteredData`) to components
|
|
384
|
+
- Disable `TableCard.searchable` when `FilterBar` provides search
|
|
385
|
+
- Declare filter definitions outside component body (or memoize)
|
|
386
|
+
|
|
387
|
+
## Data Mode (Sample vs Live)
|
|
388
|
+
|
|
389
|
+
`useDataMode()` returns `{ mode, isSample, isLive, toggle, setMode }`. `useDataSource({ sample, live })` picks based on mode.
|
|
390
|
+
|
|
391
|
+
- Every page works in both modes. Default to `"sample"`.
|
|
392
|
+
- Same layout for both modes — only data changes.
|
|
393
|
+
- Sample data: 10–50 items, realistic, deterministic (no `Math.random()`).
|
|
394
|
+
- Define sample data as constants outside the component body.
|
|
395
|
+
|
|
396
|
+
```jsx
|
|
397
|
+
// ✅ Correct: data defined outside, selected by mode
|
|
398
|
+
const SAMPLE_TRIPS = [ ... ];
|
|
399
|
+
|
|
400
|
+
export default function Dashboard() {
|
|
401
|
+
const trips = useDataSource({ sample: SAMPLE_TRIPS, live: liveTrips });
|
|
402
|
+
...
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// ❌ Wrong: hardcoded data inside the component with no mode switching
|
|
406
|
+
export default function Dashboard() {
|
|
407
|
+
const trips = [ ... ]; // no useDataSource, no mode awareness
|
|
408
|
+
}
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
## Forms & Record Modals
|
|
412
|
+
|
|
413
|
+
Schema-driven: `sections[] → fields[]`. Use `FormModal` (modal) or `FormRenderer` (inline). `useFormState` for state.
|
|
414
|
+
|
|
415
|
+
Define schemas outside component body. Always `required: true` on mandatory fields. Submissions enforce 4s minimum spinner.
|
|
416
|
+
|
|
417
|
+
## AI Chat & Agent
|
|
418
|
+
|
|
419
|
+
Use `ChatBar` (command palette, ⌘K) for dashboards. `ChatPanel` for full-page chat.
|
|
420
|
+
|
|
421
|
+
- Always provide 3–5 `suggestions` for starter prompts
|
|
422
|
+
- Return `components` for structured data — never markdown tables in text
|
|
423
|
+
- Always set height on `ChatPanel`
|
|
424
|
+
- Extract `onSend` handlers to module scope when shared
|
|
425
|
+
|
|
426
|
+
## Tables
|
|
427
|
+
|
|
428
|
+
`searchable` when 10+ rows (unless `FilterBar` handles search). `sortable` on comparable columns. `paginated` when 10+ rows. Use built-in column `type` before custom `render`.
|
|
429
|
+
|
|
430
|
+
## Charts & Visualizations (MANDATORY)
|
|
431
|
+
|
|
432
|
+
**All charts, graphs, maps, and visualizations MUST use library components.** Never use Recharts, Chart.js, Nivo, or any third-party charting library. Never hand-roll SVG, canvas, or custom chart markup. The ONLY charting tools allowed are `D3Chart` (via `D3ChartTemplates` or a custom `renderChart` function) and `GeoMap`.
|
|
433
|
+
|
|
434
|
+
| Visualization | MUST use | NEVER do |
|
|
435
|
+
|--------------|----------|----------|
|
|
436
|
+
| Line chart | `ChartCard` + `D3Chart` with `D3ChartTemplates.lineChart` | Custom `<svg>` with hand-drawn paths/circles |
|
|
437
|
+
| Grouped bar chart | `ChartCard` + `D3Chart` with `D3ChartTemplates.groupedBarChart` | Custom `<svg>` bar elements |
|
|
438
|
+
| Map / geographic | `GeoMap` | Custom SVG map or embedded iframe |
|
|
439
|
+
| Custom visualization | `ChartCard` + `D3Chart` with a custom `renderChart` function | Inline SVG/canvas |
|
|
440
|
+
|
|
441
|
+
### D3Chart API (CRITICAL — read carefully)
|
|
442
|
+
|
|
443
|
+
`D3Chart` does NOT use a `template` prop. It uses a `renderChart` callback function:
|
|
444
|
+
|
|
445
|
+
```jsx
|
|
446
|
+
<D3Chart
|
|
447
|
+
data={array} // data array
|
|
448
|
+
renderChart={D3ChartTemplates.lineChart} // function reference, NOT a string
|
|
449
|
+
responsive={true} // enables ResizeObserver
|
|
450
|
+
height={280} // height in px
|
|
451
|
+
/>
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
### ChartCard + D3Chart usage
|
|
455
|
+
|
|
456
|
+
`ChartCard` takes a `chart` prop (a React element). Pass the `D3Chart` as the `chart` value:
|
|
457
|
+
|
|
458
|
+
```jsx
|
|
459
|
+
import { ChartCard, D3Chart, D3ChartTemplates } from "@/components/library";
|
|
460
|
+
|
|
461
|
+
// ✅ Line chart — data must have { x, y } shape (numeric x)
|
|
462
|
+
const spendData = [
|
|
463
|
+
{ x: 1, y: 2400 }, { x: 2, y: 3100 }, { x: 3, y: 2800 }, ...
|
|
464
|
+
];
|
|
465
|
+
<ChartCard
|
|
466
|
+
title="30-Day Spend"
|
|
467
|
+
subtitle="Engine savings"
|
|
468
|
+
chart={
|
|
469
|
+
<D3Chart
|
|
470
|
+
data={spendData}
|
|
471
|
+
renderChart={D3ChartTemplates.lineChart}
|
|
472
|
+
options={{ stroke: "#5BC8C8", xKey: "x", yKey: "y" }}
|
|
473
|
+
responsive
|
|
474
|
+
height={280}
|
|
475
|
+
/>
|
|
476
|
+
}
|
|
477
|
+
/>
|
|
478
|
+
|
|
479
|
+
// ✅ Grouped bar chart — data must have { x, group1, group2 } shape
|
|
480
|
+
const monthlyData = [
|
|
481
|
+
{ x: "Jan", Hotels: 12000, Flights: 8000 },
|
|
482
|
+
{ x: "Feb", Hotels: 14000, Flights: 9000 }, ...
|
|
483
|
+
];
|
|
484
|
+
<ChartCard
|
|
485
|
+
title="Monthly Spend"
|
|
486
|
+
chart={
|
|
487
|
+
<D3Chart
|
|
488
|
+
data={monthlyData}
|
|
489
|
+
renderChart={D3ChartTemplates.groupedBarChart}
|
|
490
|
+
options={{ xKey: "x", groups: ["Hotels", "Flights"], colors: ["#5BC8C8", "#6366F1"] }}
|
|
491
|
+
responsive
|
|
492
|
+
height={280}
|
|
493
|
+
/>
|
|
494
|
+
}
|
|
495
|
+
/>
|
|
496
|
+
|
|
497
|
+
// ✅ Custom renderChart function (for donut, horizontal bar, etc.)
|
|
498
|
+
function renderDonut(svgEl, data, dims, opts) {
|
|
499
|
+
// Use d3 to draw into svgEl
|
|
500
|
+
const d3svg = d3.select(svgEl);
|
|
501
|
+
d3svg.selectAll("*").remove();
|
|
502
|
+
// ... d3 drawing code
|
|
503
|
+
}
|
|
504
|
+
<ChartCard title="By Department" chart={<D3Chart data={deptData} renderChart={renderDonut} responsive height={280} />} />
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
### Available D3ChartTemplates
|
|
508
|
+
|
|
509
|
+
- `D3ChartTemplates.lineChart` — options: `{ xKey, yKey, stroke, strokeWidth, margin, showAxes, showGrid }`
|
|
510
|
+
- `D3ChartTemplates.groupedBarChart` — options: `{ xKey, groups, colors, barRadius, margin, yFormat, showGrid }`
|
|
511
|
+
|
|
512
|
+
**There is NO `D3ChartTemplates.LINE`, `.BAR`, `.DONUT`, `.AREA`.** Only `lineChart` and `groupedBarChart`. For donut/pie/horizontal bar, write a custom `renderChart` function using d3.
|
|
513
|
+
|
|
514
|
+
### GeoMap API
|
|
515
|
+
|
|
516
|
+
```jsx
|
|
517
|
+
import { GeoMap } from "@/components/library";
|
|
518
|
+
|
|
519
|
+
// markers: array of { id, lon, lat, active?, label? }
|
|
520
|
+
const markers = [
|
|
521
|
+
{ id: "sf", lon: -122.4, lat: 37.8, active: true, label: "San Francisco" },
|
|
522
|
+
{ id: "nyc", lon: -74.0, lat: 40.7, active: true, label: "New York" },
|
|
523
|
+
];
|
|
524
|
+
|
|
525
|
+
<ChartCard title="Active Locations" chart={
|
|
526
|
+
<GeoMap
|
|
527
|
+
markers={markers}
|
|
528
|
+
theme="dark"
|
|
529
|
+
height={400}
|
|
530
|
+
width={800}
|
|
531
|
+
zoomable
|
|
532
|
+
/>
|
|
533
|
+
} />
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
GeoMap props: `width`, `height`, `projection` (`"naturalEarth"` | `"mercator"` | `"equirectangular"`), `theme` (`"dark"` | `"light"`), `markers`, `arcs`, `overlays`, `zoomable`, `minZoom`, `maxZoom`, `onMarkerClick`.
|
|
537
|
+
|
|
538
|
+
### Common mistakes
|
|
539
|
+
|
|
540
|
+
```jsx
|
|
541
|
+
// ❌ WRONG — third-party chart libraries are forbidden
|
|
542
|
+
import { BarChart, Bar } from "recharts";
|
|
543
|
+
<BarChart data={data}><Bar dataKey="count" /></BarChart>
|
|
544
|
+
|
|
545
|
+
// ❌ WRONG — template prop doesn't exist
|
|
546
|
+
<D3Chart template={D3ChartTemplates.LINE} data={data} />
|
|
547
|
+
|
|
548
|
+
// ❌ WRONG — passing as children instead of chart prop
|
|
549
|
+
<ChartCard title="Spend"><D3Chart ... /></ChartCard>
|
|
550
|
+
|
|
551
|
+
// ❌ WRONG — non-numeric x values with lineChart (use groupedBarChart for categorical x)
|
|
552
|
+
<D3Chart data={[{x: "Jan", y: 100}]} renderChart={D3ChartTemplates.lineChart} />
|
|
553
|
+
|
|
554
|
+
// ✅ CORRECT
|
|
555
|
+
<ChartCard title="Spend" chart={<D3Chart data={data} renderChart={D3ChartTemplates.lineChart} responsive height={280} />} />
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
## Portals
|
|
559
|
+
|
|
560
|
+
Any `position: fixed` component **must** use `createPortal(... , document.body)`.
|
|
561
|
+
|
|
562
|
+
## Loading / Error / Empty States
|
|
563
|
+
|
|
564
|
+
Every data component handles loading. Error messages are human-readable. Empty states explain what would appear.
|
|
565
|
+
|
|
566
|
+
## Pre-Completion Checklist
|
|
567
|
+
|
|
568
|
+
Before finishing a dashboard page, verify ALL of these:
|
|
569
|
+
|
|
570
|
+
- [ ] **Every card/panel is a library component** (MetricCard, ListCard, ActivityCard, WidgetCard, TableCard, etc.) — no hand-rolled `<div className="bg-white border ...">` cards
|
|
571
|
+
- [ ] **Every chart/visualization is a library component** (ChartCard + D3Chart, GeoMap) — no hand-rolled SVG/canvas
|
|
572
|
+
- [ ] **No `<nav>`, header bar, or sticky tab bar** — navigation is handled by appLayout.tsx
|
|
573
|
+
- [ ] **Single scrollable page** — no multi-tab layout that swaps content
|
|
574
|
+
- [ ] **Max 4 KPIs per row** — if 5+, split across rows
|
|
575
|
+
- [ ] **Charts render** — using `renderChart` callback (not `template` prop), data format matches (numeric x for lineChart)
|
|
576
|
+
- [ ] **`<div className="space-y-6">` wraps all content** — no `mb-*` for section spacing
|
|
577
|
+
- [ ] **Dark mode works** — every custom element has `dark:` variants; no `text-black`, `text-white`, or `bg-black`
|
|
578
|
+
- [ ] **No inline `style={{}}` or `<style>` tags** — use Tailwind classes or CSS in global.css
|
|
579
|
+
- [ ] **No inline `<svg>`** — use Heroicons from `@heroicons/react`
|
|
580
|
+
- [ ] **`position: fixed` uses `createPortal`** — FABs, modals, toasts
|
|
581
|
+
- [ ] **Data uses `useDataSource`** — sample data defined outside the component
|
|
582
|
+
- [ ] **Only uses company logo** (`@/assets/images/engine_logo.png`) — no external URLs, no placeholder boxes
|
|
583
|
+
- [ ] **Images preserve aspect ratio** — one dimension auto, never both fixed
|
|
584
|
+
- [ ] **Imports only from `@/components/library`** — no shadcn, no Lucide, no `cn()`
|
|
585
|
+
- [ ] **Grid patterns match the approved list** — no custom grid layouts
|
|
586
|
+
|
|
587
|
+
## Post-Completion Verification (REQUIRED — MUST RUN BEFORE REPORTING DONE)
|
|
588
|
+
|
|
589
|
+
After building the dashboard, you MUST run the validator and fix ALL errors before reporting the dashboard as complete:
|
|
590
|
+
|
|
591
|
+
```bash
|
|
592
|
+
# Run from the web app directory
|
|
593
|
+
npm run validate:dashboard
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
**Do NOT run `npm run build` or `tsc`.** The TypeScript build has known issues with platform-only Salesforce packages that are not relevant to dashboard development. Only run the validator.
|
|
597
|
+
|
|
598
|
+
The validator (`scripts/validate-dashboard.sh`) automatically checks for:
|
|
599
|
+
- Hand-rolled HTML cards, tables, and SVGs (must use library components)
|
|
600
|
+
- Forbidden colors (`text-black`, `text-white`, `bg-black`)
|
|
601
|
+
- Inline `style={{}}` and `<style>` tags
|
|
602
|
+
- Missing `useDataSource` for sample/live mode
|
|
603
|
+
- Grid layouts with 5+ columns
|
|
604
|
+
- `position: fixed` without `createPortal`
|
|
605
|
+
- shadcn/Lucide imports in command center code
|
|
606
|
+
- Missing `space-y-6` wrappers
|
|
607
|
+
- `.jsx` files where `.tsx` is required (this is a TypeScript project)
|
|
608
|
+
- Dashboard navigation (`<nav>` elements)
|
|
609
|
+
|
|
610
|
+
**If the validator reports errors, you MUST fix them ALL — zero errors required.** Do not report the dashboard as complete with any errors. Do not dismiss errors as "acceptable", "justified", or "expected". Every error has a fix — usually by switching to the correct library component. The validator exits with code 1 on errors — treat this like a failing test.
|
|
611
|
+
|
|
612
|
+
**Common validator errors and their fixes:**
|
|
613
|
+
- **Hand-rolled card** → Wrap content in `WidgetCard`, `ListCard`, `BaseCard`, or another library card component. `WidgetCard` with a single section can wrap any arbitrary JSX content.
|
|
614
|
+
- **Forbidden colors** (`text-white`, `bg-black`) → Use slate scale (`text-slate-50`, `bg-slate-900`)
|
|
615
|
+
- **shadcn/Lucide imports** → Replace with library components and Heroicons
|
|
616
|
+
|
|
617
|
+
**Do not skip or ignore the validator.** Do not run `npm run build` or `tsc` — only run `npm run validate:dashboard`.
|
|
618
|
+
|
|
619
|
+
## Anti-Patterns (never do these)
|
|
620
|
+
|
|
621
|
+
- Hand-rolling HTML cards instead of using library components (MetricCard, ListCard, etc.)
|
|
622
|
+
- Using Recharts, Chart.js, Nivo, or any chart library other than D3Chart/GeoMap
|
|
623
|
+
- Hand-rolling SVG/canvas charts instead of using ChartCard + D3Chart or GeoMap
|
|
624
|
+
- Adding a `<nav>`, header bar, sticky tab bar, or top navigation inside a dashboard page
|
|
625
|
+
- Multi-tab layouts that swap content (Overview/Travelers/Spend/etc tabs) — build one scrollable page
|
|
626
|
+
- More than 4 KPIs in a single row (max is `lg:grid-cols-4`)
|
|
627
|
+
- Using `template` prop on D3Chart (doesn't exist) — use `renderChart={D3ChartTemplates.lineChart}`
|
|
628
|
+
- Passing D3Chart as children to ChartCard — use `chart={<D3Chart ... />}` prop
|
|
629
|
+
- CSS Modules, styled-components, or inline `style={{}}` for layout
|
|
630
|
+
- `<style>` tags with keyframes or custom CSS inside components
|
|
631
|
+
- Inline `<svg>` elements when a Heroicon exists
|
|
632
|
+
- Importing shadcn components (`src/components/ui/`) into command center pages — `Button`, `Card`, `Input`, `Select`, `Alert`, `Skeleton`, `Label`, `Spinner`, etc. are ALL forbidden. Use the library equivalents from `@/components/library` (`UIButton`, `BaseCard`/`WidgetCard`, `UIInput`, `Select`, `Alert`, `Skeleton`, etc.)
|
|
633
|
+
- Importing Lucide icons (`lucide-react`) into command center pages — use Heroicons (`@heroicons/react`) instead
|
|
634
|
+
- Using `cn()` helper in command center pages (that's shadcn's utility — use Tailwind classes directly)
|
|
635
|
+
- `useEffect` for data in schema components
|
|
636
|
+
- `bg-indigo-*` or raw colors for brand — use `brand-*` or `engine-*`
|
|
637
|
+
- Recreating providers (`AppThemeProvider`, `DataModeProvider`) in dashboard pages — `CommandCenter.tsx` already provides them
|
|
638
|
+
- Tables without search on 10+ rows, charts without tooltips, empty states without messages
|
|
639
|
+
- Hard-coded pixel widths or skipping dark mode
|
|
640
|
+
- `text-black`, `text-white`, `bg-black` — use slate scale
|
|
641
|
+
- `lg:grid-cols-6` for metrics (max 4), manually appending K/M/B
|
|
642
|
+
- `mb-6` between sections instead of `space-y-6` wrapper
|
|
643
|
+
- Same layout across dashboards, no signature element
|
|
644
|
+
- `ChatPanel` in dashboard grid — use `ChatBar`
|
|
645
|
+
- `position: fixed` without `createPortal`
|
|
646
|
+
- `Math.random()` in sample data, different layouts based on data mode
|
|
647
|
+
- Re-declaring filter/form definitions inside component render
|
|
648
|
+
- Dismissing validator errors as "acceptable" or "justified" instead of fixing them — every error has a library component fix
|
|
649
|
+
- Hardcoded data without `useDataSource` for sample/live mode switching
|
|
650
|
+
- External image URLs (Unsplash, placeholders) unless user explicitly requests them
|
|
651
|
+
- Placeholder boxes (`<div className="w-8 h-8 bg-black rounded" />`) instead of the actual logo
|
|
652
|
+
- Fixed width AND height on images — always let one dimension be `auto` to preserve aspect ratio
|