@schandlergarcia/sf-web-components 1.9.63 → 1.9.65
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 -46
- package/.a4drules/features/engine-dashboard-rule.md +36 -288
- package/.a4drules/features/phase2-data-pattern.md +8 -159
- package/.a4drules/features/pre-code-checklist.md +16 -205
- package/.a4drules/skills/command-center-builder/SKILL.md +6 -30
- package/.a4drules/skills/command-center-builder/completion-checklist.md +3 -29
- package/.a4drules/skills/command-center-builder/improved-build-process.md +20 -331
- package/.a4drules/skills/command-center-builder/page-layout.md +4 -2
- package/.a4drules/skills/command-center-guide/SKILL.md +23 -257
- package/.a4drules/skills/command-center-project/SKILL.md +1 -1
- package/CHANGELOG.md +34 -0
- package/data/engine-command-center-prd.md +11 -13
- package/data/engine-sample-data.js +20 -8
- package/package.json +1 -1
|
@@ -1,215 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
paths:
|
|
3
|
-
- "**/pages/*.tsx"
|
|
4
|
-
- "**/components/pages/*.tsx"
|
|
5
|
-
---
|
|
1
|
+
# Pre-Code Checklist
|
|
6
2
|
|
|
7
|
-
|
|
3
|
+
This is a reference checklist. For build instructions, use the phase files in `.a4drules/phases/`.
|
|
8
4
|
|
|
9
|
-
Before
|
|
5
|
+
## Before creating a dashboard file
|
|
10
6
|
|
|
11
|
-
|
|
7
|
+
- [ ] File path: `src/pages/DashboardName.tsx` (NOT `src/components/pages/`)
|
|
8
|
+
- [ ] File extension: `.tsx` (NOT `.jsx`)
|
|
9
|
+
- [ ] Imports: `@/components/library` only (NOT `@/components/ui/`, NOT `lucide-react`)
|
|
10
|
+
- [ ] Theme hook: `import { useThemeMode } from "@/components/library/theme/AppThemeProvider"`
|
|
11
|
+
- [ ] Data hook: `import useDataSource from "@/components/library/data/useDataSource"` (default export)
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
1. `.a4drules/skills/component-library/SKILL.md` (lines 15-40) - Import Pattern section
|
|
15
|
-
2. `engine-command-center-prd.md` - Phase 1 Placeholder Rules section
|
|
16
|
-
3. This file - Phase 1 Code Template section
|
|
13
|
+
## Color Reference
|
|
17
14
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
- [ ] What "Phase 1 placeholder" means (data panels ONLY, not entire dashboard)
|
|
21
|
-
- [ ] Which colors are forbidden (`text-white`, `text-black`, `bg-black` without opacity)
|
|
22
|
-
|
|
23
|
-
## File Creation Checklist
|
|
24
|
-
|
|
25
|
-
When creating a new dashboard file, confirm:
|
|
26
|
-
|
|
27
|
-
1. **File path:** `src/pages/DashboardName.tsx` (NOT `src/components/pages/`)
|
|
28
|
-
2. **File extension:** `.tsx` (NOT `.jsx`) — this is a TypeScript project
|
|
29
|
-
3. **Imports:** `@/components/library` ONLY (NOT `@/components/ui/`, NOT `lucide-react`, NOT `recharts`)
|
|
30
|
-
4. **Import names:** Check SKILL.md for exact names — DO NOT guess or invent import names
|
|
31
|
-
- Theme toggle: `useThemeMode` (NOT `useAppTheme`, NOT `useTheme`)
|
|
32
|
-
- Data source: `import useDataSource from "..."` (default export, NOT named)
|
|
33
|
-
5. **Colors:** Slate scale ONLY (NOT `text-white`, NOT `text-black`, NOT `bg-black`)
|
|
34
|
-
|
|
35
|
-
## Phase 1 Code Template
|
|
36
|
-
|
|
37
|
-
**START WITH THIS EXACT STRUCTURE:**
|
|
38
|
-
|
|
39
|
-
```tsx
|
|
40
|
-
import { GeoMap, BaseCard } from "@/components/library";
|
|
41
|
-
import { useThemeMode } from "@/components/library/theme/AppThemeProvider";
|
|
42
|
-
import { /* Heroicons */ } from "@heroicons/react/24/outline";
|
|
43
|
-
|
|
44
|
-
export default function EngineDashboard() {
|
|
45
|
-
const { mode, toggle } = useThemeMode();
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<div className="flex flex-col bg-slate-50 dark:bg-slate-950">
|
|
49
|
-
{/* Header Bar - h-12, sticky, slate-900 bg */}
|
|
50
|
-
<header className="sticky top-0 z-50 flex h-12 items-center justify-between border-b border-slate-800 bg-slate-900 px-4">
|
|
51
|
-
{/* Logo + title with text-slate-50 (NOT text-white) */}
|
|
52
|
-
</header>
|
|
53
|
-
|
|
54
|
-
{/* Hero Map - fixed height h-[520px], GeoMap renders world automatically */}
|
|
55
|
-
<div className="relative h-[520px]">
|
|
56
|
-
<GeoMap width={960} height={520} theme={mode === "dark" ? "dark" : "light"} className="h-full w-full" />
|
|
57
|
-
|
|
58
|
-
{/* Glass KPI overlays - positioned absolutely, text-slate-50 */}
|
|
59
|
-
<div className="absolute left-3 top-3 flex gap-2">
|
|
60
|
-
{/* 4 KPI divs with border-white/10, bg-black/40, backdrop-blur-md */}
|
|
61
|
-
</div>
|
|
62
|
-
|
|
63
|
-
{/* Flight status strip - positioned absolutely at bottom */}
|
|
64
|
-
<div className="absolute bottom-3 left-3 right-3 flex gap-2 overflow-x-auto">
|
|
65
|
-
{/* 4 flight divs with status badges */}
|
|
66
|
-
</div>
|
|
67
|
-
</div>
|
|
68
|
-
|
|
69
|
-
{/* Data Panels - natural flow, full-page scroll, 4 panels total */}
|
|
70
|
-
<div className="px-4 py-5">
|
|
71
|
-
<div className="space-y-6">
|
|
72
|
-
{/* Row 1: Disruptions (1/3) + Active Travelers (2/3) */}
|
|
73
|
-
<div className="grid grid-cols-1 items-start gap-4 lg:grid-cols-3">
|
|
74
|
-
<BaseCard>
|
|
75
|
-
<div className="flex h-48 items-center justify-center text-slate-400">
|
|
76
|
-
Disruptions Panel
|
|
77
|
-
</div>
|
|
78
|
-
</BaseCard>
|
|
79
|
-
<div className="lg:col-span-2">
|
|
80
|
-
<BaseCard>
|
|
81
|
-
<div className="flex h-48 items-center justify-center text-slate-400">
|
|
82
|
-
Active Travelers Panel
|
|
83
|
-
</div>
|
|
84
|
-
</BaseCard>
|
|
85
|
-
</div>
|
|
86
|
-
</div>
|
|
87
|
-
|
|
88
|
-
{/* Row 2: Escalations (1/2) + Monthly Spend Chart (1/2) */}
|
|
89
|
-
<div className="grid grid-cols-1 items-start gap-4 lg:grid-cols-2">
|
|
90
|
-
<BaseCard>
|
|
91
|
-
<div className="flex h-48 items-center justify-center text-slate-400">
|
|
92
|
-
Escalations Panel
|
|
93
|
-
</div>
|
|
94
|
-
</BaseCard>
|
|
95
|
-
<BaseCard>
|
|
96
|
-
<div className="flex h-48 items-center justify-center text-slate-400">
|
|
97
|
-
Travel Spend Panel
|
|
98
|
-
</div>
|
|
99
|
-
</BaseCard>
|
|
100
|
-
</div>
|
|
101
|
-
</div>
|
|
102
|
-
</div>
|
|
103
|
-
</div>
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
## During Code Generation Checklist
|
|
109
|
-
|
|
110
|
-
As you write the dashboard code:
|
|
111
|
-
|
|
112
|
-
1. **Every card** is a library component (MetricCard, ListCard, WidgetCard, etc.) — NO hand-rolled `<div className="bg-white border rounded...">`
|
|
113
|
-
2. **Every chart** uses `ChartCard` + `D3Chart` or `GeoMap` — NO Recharts, NO Chart.js, NO custom SVG
|
|
114
|
-
3. **Every color** uses semantic classes or slate scale — NO `text-white`, NO `bg-black`, NO hardcoded hex
|
|
115
|
-
4. **Dark mode** on every element — `dark:` variants on all custom styling
|
|
116
|
-
5. **Phase 1 scope - Build COMPLETE layout structure:**
|
|
117
|
-
- ✅ Outer container: `className="flex flex-col bg-slate-50 dark:bg-slate-950"` (NO `h-screen` - full-page scroll)
|
|
118
|
-
- ✅ Header bar (logo, title, actions) with slate scale colors (NO text-white)
|
|
119
|
-
- ✅ Header text: ONLY "ENGINE" + "Travel Command Center" (NO "Powered by..." branding in Phase 1)
|
|
120
|
-
- ✅ Hero map container: `className="relative h-[520px]"` (fixed height, NOT flex-based)
|
|
121
|
-
- ✅ Hero map (GeoMap component with NO markers/arcs/overlays PROPS, `className="h-full w-full"`)
|
|
122
|
-
- ✅ Glass KPI overlays (4 hardcoded KPIs, positioned absolutely over map)
|
|
123
|
-
- ✅ Flight status strip (4 hardcoded flights, positioned at map bottom)
|
|
124
|
-
- ✅ Data panels container: `className="px-4 py-5"` (NO `overflow-y-auto`, NO flex constraints - natural flow)
|
|
125
|
-
- ✅ **4 data panel placeholders** (2 rows: Disruptions/Travelers, Escalations/Destinations) - BaseCard with NO title prop, centered text
|
|
126
|
-
- ❌ **Phase 1 EXCLUDES:** Salesforce/Data Cloud branding (Phase 4), ChatBar (Phase 4), real data (Phase 2+)
|
|
127
|
-
- "Placeholder" means data panels below the map, NOT the header/overlays/map
|
|
128
|
-
- **Full-page scroll:** Entire dashboard scrolls naturally (map scrolls up as user scrolls down)
|
|
129
|
-
|
|
130
|
-
## After Code Generation Checklist
|
|
131
|
-
|
|
132
|
-
After writing the dashboard code:
|
|
133
|
-
|
|
134
|
-
1. **Wiring:**
|
|
135
|
-
- [ ] `CommandCenter.tsx` imports your dashboard
|
|
136
|
-
- [ ] `Home.tsx` renders `CommandCenter`
|
|
137
|
-
- [ ] `routes.tsx` has correct routes
|
|
138
|
-
|
|
139
|
-
2. **Completion:**
|
|
140
|
-
- [ ] All files wired correctly
|
|
141
|
-
- [ ] **DO NOT run `npm run dev` or `npm run validate:dashboard`** - not required for ANY phase completion
|
|
142
|
-
|
|
143
|
-
## Color Reference (CRITICAL)
|
|
144
|
-
|
|
145
|
-
**NEVER use these:**
|
|
146
|
-
|
|
147
|
-
| ❌ FORBIDDEN | ✅ USE INSTEAD | Where |
|
|
148
|
-
|-------------|---------------|-------|
|
|
15
|
+
| Forbidden | Use instead | Where |
|
|
16
|
+
|-----------|------------|-------|
|
|
149
17
|
| `text-white` | `text-slate-50` | Header text, overlay text |
|
|
150
18
|
| `text-black` | `text-slate-900` | Body text (light mode) |
|
|
151
19
|
| `bg-black` | `bg-slate-900` or `bg-black/40` (with opacity) | Backgrounds |
|
|
152
|
-
| `bg-white` | `bg-slate-50` | Page background (light mode) |
|
|
153
|
-
|
|
154
|
-
**Exception:** `bg-black/40`, `bg-white/10`, `border-white/10` are allowed (opacity variants for glass effect)
|
|
155
|
-
|
|
156
|
-
## Verification Checklist
|
|
157
|
-
|
|
158
|
-
After building, you should see:
|
|
159
|
-
- [ ] Header bar with Engine logo and "Travel Command Center" title
|
|
160
|
-
- [ ] **World map visible** (blue/teal land on dark background OR gray land on light background)
|
|
161
|
-
- [ ] 4 glass KPI boxes in top-left of map (semi-transparent with numbers)
|
|
162
|
-
- [ ] 4 flight status boxes at bottom of map (with colored badges)
|
|
163
|
-
- [ ] **4 white/dark cards below map** (2 rows: row 1 has 1/3 + 2/3 split, row 2 has 1/2 + 1/2 split)
|
|
164
|
-
- [ ] Page scrolls when you scroll the data panels section
|
|
165
|
-
- [ ] Theme toggle works (sun/moon icon in header)
|
|
166
|
-
|
|
167
|
-
## Quick Reference
|
|
168
|
-
|
|
169
|
-
| Question | Answer |
|
|
170
|
-
|----------|--------|
|
|
171
|
-
| File path? | `src/pages/EngineDashboard.tsx` |
|
|
172
|
-
| Extension? | `.tsx` (TypeScript) |
|
|
173
|
-
| Import from? | `@/components/library` |
|
|
174
|
-
| Hook import? | `import { useThemeMode } from "@/components/library/theme/AppThemeProvider"` |
|
|
175
|
-
| Colors? | Slate scale (`text-slate-50`, `bg-slate-900`) - NEVER `text-white` |
|
|
176
|
-
| Cards? | Library components (MetricCard, ListCard, etc.) |
|
|
177
|
-
| Charts? | `ChartCard` + `D3Chart` or `GeoMap` |
|
|
178
|
-
| After building? | Wire into CommandCenter/Home/routes - DO NOT run dev server |
|
|
179
|
-
|
|
180
|
-
## Common Mistakes to Avoid
|
|
181
|
-
|
|
182
|
-
❌ `src/pages/EngineDashboard.tsx` → ✅ `src/pages/EngineDashboard.tsx`
|
|
183
|
-
❌ `EngineDashboard.jsx` → ✅ `EngineDashboard.tsx`
|
|
184
|
-
❌ `text-white` → ✅ `text-slate-50`
|
|
185
|
-
❌ `bg-black` → ✅ `bg-slate-900`
|
|
186
|
-
❌ `<div className="bg-white border rounded-lg p-4">` → ✅ `<BaseCard>` or `<WidgetCard>`
|
|
187
|
-
❌ `import { Button } from '@/components/ui/button'` → ✅ `import { UIButton } from '@/components/library'`
|
|
188
|
-
❌ `import { useAppTheme } from '@/components/library'` → ✅ `import { useThemeMode } from '@/components/library'`
|
|
189
|
-
❌ `"Powered by Salesforce Data Cloud"` in Phase 1 → ✅ This is Phase 4 only (see PRD Section 10)
|
|
190
|
-
❌ Running `npm run dev` after building → ✅ Not needed - validation is sufficient
|
|
191
|
-
|
|
192
|
-
## Troubleshooting
|
|
193
|
-
|
|
194
|
-
**If you get TypeScript error about imports:**
|
|
195
|
-
1. ❌ DO NOT follow "did you mean default import?" suggestion
|
|
196
|
-
2. ✅ READ `.a4drules/skills/component-library/SKILL.md` Import Pattern section
|
|
197
|
-
3. ✅ USE the exact import shown in the docs
|
|
198
|
-
|
|
199
|
-
**If map doesn't render:**
|
|
200
|
-
1. ✅ Verify container has `style={{ flex: "1.15 1 0", minHeight: 0 }}`
|
|
201
|
-
2. ✅ Verify GeoMap has `className="h-full w-full"`
|
|
202
|
-
3. ✅ GeoMap shows world map automatically - no props needed
|
|
203
|
-
|
|
204
|
-
**If colors look wrong:**
|
|
205
|
-
1. ✅ Search your code for `text-white` - should be `text-slate-50`
|
|
206
|
-
2. ✅ Search your code for `text-black` - should be `text-slate-900`
|
|
207
|
-
3. ✅ Exception: `bg-black/40` and `border-white/10` (with opacity) are OK
|
|
208
|
-
|
|
209
|
-
**If data panels don't scroll:**
|
|
210
|
-
1. ✅ Verify data panels container has `overflow-y-auto` className
|
|
211
|
-
2. ✅ Verify it has `style={{ flex: "1 1 0" }}`
|
|
212
20
|
|
|
213
|
-
##
|
|
21
|
+
## After creating the dashboard
|
|
214
22
|
|
|
215
|
-
|
|
23
|
+
- [ ] `CommandCenter.tsx` imports your dashboard
|
|
24
|
+
- [ ] `Home.tsx` renders `CommandCenter`
|
|
25
|
+
- [ ] `routes.tsx` has correct routes
|
|
26
|
+
- [ ] DO NOT run `npm run dev` or `npm run validate:dashboard`
|
|
@@ -254,7 +254,9 @@ Every dashboard needs a unique layout structure and at least one domain-specific
|
|
|
254
254
|
|
|
255
255
|
## Map Layout
|
|
256
256
|
|
|
257
|
-
|
|
257
|
+
**Default pattern:** GeoMap in a **wide/narrow grid** (`lg:grid-cols-3` with `lg:col-span-2`). This works well for dashboards where the map is one of several equal-weight sections.
|
|
258
|
+
|
|
259
|
+
**If the PRD specifies a "visualization-hero" layout**, the map is full-width hero with glass overlays. The PRD always overrides this default pattern.
|
|
258
260
|
|
|
259
261
|
**Pattern: Map + sidebar at matched height**
|
|
260
262
|
|
|
@@ -584,37 +586,11 @@ Before finishing a dashboard page, verify ALL of these:
|
|
|
584
586
|
- [ ] **Imports only from `@/components/library`** — no shadcn, no Lucide, no `cn()`
|
|
585
587
|
- [ ] **Grid patterns match the approved list** — no custom grid layouts
|
|
586
588
|
|
|
587
|
-
## Post-Completion Verification
|
|
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.
|
|
589
|
+
## Post-Completion Verification
|
|
611
590
|
|
|
612
|
-
**
|
|
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
|
|
591
|
+
**DO NOT run `npm run validate:dashboard`, `npm run dev`, `npm run build`, or `tsc` during builds.** These waste time and are not required for phase completion.
|
|
616
592
|
|
|
617
|
-
|
|
593
|
+
Instead, verify correctness by reviewing the code against the Pre-Completion Checklist above. Confirm that all three wiring files are updated (CommandCenter.tsx, Home.tsx, routes.tsx).
|
|
618
594
|
|
|
619
595
|
## Anti-Patterns (never do these)
|
|
620
596
|
|
|
@@ -19,37 +19,11 @@ Before finishing a dashboard page, verify ALL of these:
|
|
|
19
19
|
- [ ] **Imports only from `@/components/library`** — no shadcn, no Lucide, no `cn()`
|
|
20
20
|
- [ ] **Grid patterns match the approved list** — no custom grid layouts
|
|
21
21
|
|
|
22
|
-
## Post-Completion Verification
|
|
22
|
+
## Post-Completion Verification
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
**DO NOT run `npm run validate:dashboard`, `npm run dev`, `npm run build`, or `tsc` during builds.** These waste time and are not required for phase completion.
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
# Run from the web app directory
|
|
28
|
-
npm run validate:dashboard
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
**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.
|
|
32
|
-
|
|
33
|
-
The validator (`scripts/validate-dashboard.sh`) automatically checks for:
|
|
34
|
-
- Hand-rolled HTML cards, tables, and SVGs (must use library components)
|
|
35
|
-
- Forbidden colors (`text-black`, `text-white`, `bg-black`)
|
|
36
|
-
- Inline `style={{}}` and `<style>` tags
|
|
37
|
-
- Missing `useDataSource` for sample/live mode
|
|
38
|
-
- Grid layouts with 5+ columns
|
|
39
|
-
- `position: fixed` without `createPortal`
|
|
40
|
-
- shadcn/Lucide imports in command center code
|
|
41
|
-
- Missing `space-y-6` wrappers
|
|
42
|
-
- `.jsx` files where `.tsx` is required (this is a TypeScript project)
|
|
43
|
-
- Dashboard navigation (`<nav>` elements)
|
|
44
|
-
|
|
45
|
-
**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.
|
|
46
|
-
|
|
47
|
-
**Common validator errors and their fixes:**
|
|
48
|
-
- **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.
|
|
49
|
-
- **Forbidden colors** (`text-white`, `bg-black`) → Use slate scale (`text-slate-50`, `bg-slate-900`)
|
|
50
|
-
- **shadcn/Lucide imports** → Replace with library components and Heroicons
|
|
51
|
-
|
|
52
|
-
**Do not skip or ignore the validator.** Do not run `npm run build` or `tsc` — only run `npm run validate:dashboard`.
|
|
26
|
+
Instead, verify correctness by reviewing the code against the Pre-Completion Checklist above. Confirm that all three wiring files are updated (CommandCenter.tsx, Home.tsx, routes.tsx).
|
|
53
27
|
|
|
54
28
|
## Anti-Patterns (never do these)
|
|
55
29
|
|