@schandlergarcia/sf-web-components 1.9.75 → 1.9.77

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.
@@ -8,6 +8,22 @@ paths:
8
8
 
9
9
  These rules apply to all dashboard files. For Engine-specific rules, see `engine-dashboard-rule.md`.
10
10
 
11
+ **Read `.a4drules/skills/command-center-builder/SKILL.md` before building any dashboard.** It has the full conventions, component rules, and wiring steps.
12
+
13
+ ## Wiring — MANDATORY (do not skip)
14
+
15
+ After creating a dashboard, you MUST update all 3 files or the dashboard will never appear:
16
+
17
+ 1. **`CommandCenter.tsx`** — import and render your dashboard (change only the import line)
18
+ 2. **`Home.tsx`** — REWRITE to render `CommandCenter` (it ships as Account Search by default):
19
+ ```tsx
20
+ import CommandCenter from "@/components/workspace/CommandCenter";
21
+ export default function HomePage() { return <CommandCenter />; }
22
+ ```
23
+ 3. **`routes.tsx`** — set `Home` as index route with label "Dashboard", move Search to `/search`
24
+
25
+ **If you skip this, the user sees the Account Search page instead of your dashboard.**
26
+
11
27
  ## Core Constraints
12
28
 
13
29
  1. Dashboard files: `.tsx` in `src/pages/` — never `.jsx`, never `src/components/pages/`
@@ -21,13 +37,6 @@ These rules apply to all dashboard files. For Engine-specific rules, see `engine
21
37
  9. DO NOT run `npm run dev`, `npm run validate:dashboard`, or `npm run build` during builds
22
38
  10. DO NOT `npm install` any packages — everything needed is already installed
23
39
 
24
- ## Wiring
25
-
26
- After creating a dashboard, update all 3 files:
27
- 1. `CommandCenter.tsx` — import and render your dashboard
28
- 2. `Home.tsx` — render `CommandCenter`
29
- 3. `routes.tsx` — set `Home` as index route
30
-
31
40
  ## Component API
32
41
 
33
42
  For full component props and data shapes, read `.a4drules/skills/component-library/SKILL.md`.
@@ -33,13 +33,19 @@ These rules load automatically when editing Engine dashboard files. For full bui
33
33
 
34
34
  Complete each phase fully before starting the next. Read the relevant phase file for detailed instructions and code templates.
35
35
 
36
- ## Wiring Checklist
36
+ ## Wiring Checklist — MANDATORY
37
37
 
38
- After creating or updating `EngineDashboard.tsx`:
38
+ After creating or updating `EngineDashboard.tsx`, update ALL 3 files:
39
39
 
40
- 1. `CommandCenter.tsx` imports `EngineDashboard` (not `BlankDashboard`)
41
- 2. `Home.tsx` renders `CommandCenter`
42
- 3. `routes.tsx` has `Home` as index route, `Search` at `/search`
40
+ 1. **`CommandCenter.tsx`** imports `EngineDashboard` (not `BlankDashboard`)
41
+ 2. **`Home.tsx`** REWRITE to render `CommandCenter` (it ships as Account Search by default):
42
+ ```tsx
43
+ import CommandCenter from "@/components/workspace/CommandCenter";
44
+ export default function HomePage() { return <CommandCenter />; }
45
+ ```
46
+ 3. **`routes.tsx`** — has `Home` as index route with label "Dashboard", `Search` at `/search`
47
+
48
+ **If you skip steps 2-3, the user sees the Account Search page instead of the dashboard.**
43
49
 
44
50
  ## Component Quick Reference
45
51
 
@@ -1,6 +1,6 @@
1
1
  # Pre-Code Checklist
2
2
 
3
- This is a reference checklist. For build instructions, use the phase files in `.a4drules/phases/`.
3
+ Read `.a4drules/skills/command-center-builder/SKILL.md` before building. It has the full conventions and wiring steps.
4
4
 
5
5
  ## Before creating a dashboard file
6
6
 
@@ -18,9 +18,32 @@ This is a reference checklist. For build instructions, use the phase files in `.
18
18
  | `text-black` | `text-slate-900` | Body text (light mode) |
19
19
  | `bg-black` | `bg-slate-900` or `bg-black/40` (with opacity) | Backgrounds |
20
20
 
21
- ## After creating the dashboard
21
+ ## After creating the dashboard — WIRE IT (MANDATORY)
22
22
 
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`
23
+ **All 3 steps are required or the dashboard will never render on screen.**
24
+
25
+ - [ ] **`CommandCenter.tsx`** change the import to your dashboard:
26
+ ```tsx
27
+ // src/components/workspace/CommandCenter.tsx
28
+ import MyDashboard from "../../pages/MyDashboard"; // ← your dashboard
29
+ // ... render <MyDashboard /> inside the existing providers
30
+ ```
31
+
32
+ - [ ] **`Home.tsx`** — REPLACE the entire file (it ships as Account Search by default):
33
+ ```tsx
34
+ // src/pages/Home.tsx — REPLACE EVERYTHING
35
+ import CommandCenter from "@/components/workspace/CommandCenter";
36
+ export default function HomePage() {
37
+ return <CommandCenter />;
38
+ }
39
+ ```
40
+
41
+ - [ ] **`routes.tsx`** — set Home as the index route with label "Dashboard":
42
+ ```tsx
43
+ { index: true, element: <Home />, handle: { showInNavigation: true, showNavBar: true, label: "Dashboard" } },
44
+ { path: "search", element: <Search />, handle: { showInNavigation: true, showNavBar: true, label: "Search" } },
45
+ ```
46
+
47
+ - [ ] DO NOT run `npm run dev` or `npm run validate:dashboard` during builds
48
+
49
+ **If you skip the wiring steps, the user will see the Account Search page instead of your dashboard.**
@@ -13,15 +13,133 @@ description: >-
13
13
 
14
14
  These rules apply when building dashboards rendered by `CommandCenter.tsx`. For full component API details, read the **component-library** skill.
15
15
 
16
+ > **BUILD GUIDE:** The dashboard is built in 3 phases. Read [`getting-started.md`](getting-started.md) for what to build (and what to skip) in each phase. Do NOT build ahead — only build what the current phase asks for.
17
+
18
+ ## WIRING — DO THIS FIRST (before building the dashboard)
19
+
20
+ **Building a dashboard requires updating 4 files. If you only create the dashboard file, the user will never see it — they'll see the old Account Search page instead.**
21
+
22
+ Read the existing `Home.tsx`, `CommandCenter.tsx`, and `routes.tsx` BEFORE you start building. Plan all 4 file changes up front:
23
+
24
+ 1. `src/pages/YourDashboard.tsx` — the dashboard component
25
+ 2. `src/components/workspace/CommandCenter.tsx` — import and render your dashboard
26
+ 3. `src/pages/Home.tsx` — **MUST be rewritten** to render CommandCenter (it ships as Account Search)
27
+ 4. `src/routes.tsx` — set Home as index route with label "Dashboard"
28
+
29
+ **Home.tsx ships as an Account Search page by default.** You MUST replace its entire contents:
30
+
31
+ ```tsx
32
+ // src/pages/Home.tsx — REPLACE the entire file
33
+ import CommandCenter from "@/components/workspace/CommandCenter";
34
+
35
+ export default function HomePage() {
36
+ return <CommandCenter />;
37
+ }
38
+ ```
39
+
40
+ **CommandCenter.tsx** — only change the dashboard import. Preserve the `heroui-scope` wrapper and `Toast.Provider`:
41
+
42
+ ```tsx
43
+ // src/components/workspace/CommandCenter.tsx
44
+ import AppThemeProvider from "@/components/library/theme/AppThemeProvider";
45
+ import DataModeProvider from "@/components/library/data/DataModeProvider";
46
+ import { Toast } from "@heroui/react";
47
+ import MyDashboard from "../../pages/MyDashboard"; // ← change ONLY this import
48
+
49
+ export default function CommandCenter() {
50
+ return (
51
+ <div className="heroui-scope">
52
+ <AppThemeProvider initialMode="light">
53
+ <DataModeProvider initialMode="sample">
54
+ <MyDashboard />
55
+ <Toast.Provider placement="bottom end" />
56
+ </DataModeProvider>
57
+ </AppThemeProvider>
58
+ </div>
59
+ );
60
+ }
61
+ ```
62
+
63
+ **routes.tsx** — make Home the index route, move Search to `/search`:
64
+
65
+ ```tsx
66
+ {
67
+ index: true,
68
+ element: <Home />,
69
+ handle: { showInNavigation: true, showNavBar: true, label: "Dashboard" }
70
+ },
71
+ {
72
+ path: "search",
73
+ element: <Search />,
74
+ handle: { showInNavigation: true, showNavBar: true, label: "Search" }
75
+ },
76
+ ```
77
+
78
+ **After writing all files, verify:**
79
+ 1. Your dashboard `.tsx` file exists in `src/pages/`
80
+ 2. `CommandCenter.tsx` imports your dashboard (not `BlankDashboard`)
81
+ 3. `Home.tsx` imports and renders `CommandCenter` (NOT the Account Search interface)
82
+ 4. `routes.tsx` has `Home` as the index route with label "Dashboard"
83
+
84
+ **If any of these are missing, the dashboard will not render.** This is the #1 cause of "I built the dashboard but I can't see it."
85
+
86
+ ---
87
+
88
+ ## Quick Import Reference
89
+
90
+ Use these exact imports. Do NOT read component source files to discover imports — this list is authoritative.
91
+
92
+ ```tsx
93
+ // Library components — named imports from barrel
94
+ import {
95
+ BaseCard, MetricCard, ChartCard, TableCard, ListCard, ActivityCard,
96
+ StatusCard, WidgetCard, SectionCard, FeedPanel, CalloutCard, ActionList,
97
+ MetricsStrip, D3Chart, D3ChartTemplates, GeoMap, Avatar, UIButton,
98
+ UIChip, UIText, EmptyState, Spinner, ChatBar, FilterBar,
99
+ FormModal, toast,
100
+ } from "@/components/library";
101
+
102
+ // Theme — named export
103
+ import { useThemeMode } from "@/components/library/theme/AppThemeProvider";
104
+
105
+ // Data — DEFAULT export (no braces)
106
+ import useDataSource from "@/components/library/data/useDataSource";
107
+
108
+ // Icons — Heroicons ONLY (not Lucide) — use 24/outline by default
109
+ import {
110
+ UsersIcon, BellIcon, SunIcon, MoonIcon, SparklesIcon,
111
+ CheckCircleIcon, ArrowPathIcon, ClockIcon, BanknotesIcon,
112
+ ShieldCheckIcon, ChevronDownIcon, ChevronUpIcon,
113
+ ExclamationTriangleIcon, PaperAirplaneIcon, BuildingOfficeIcon,
114
+ MapPinIcon, GlobeAltIcon, UserIcon,
115
+ } from "@heroicons/react/24/outline";
116
+
117
+ // Sample data
118
+ import {
119
+ MAP_MARKERS, MAP_ARCS, MAP_OVERLAYS, FLIGHT_STATUS_LIST,
120
+ TRAVELER_CARDS, DISRUPTION_CARDS, ESCALATION_CARDS,
121
+ MONTHLY_SPEND, METRICS,
122
+ } from "@/data/engine-sample-data.js";
123
+
124
+ // Logo
125
+ import engineLogo from "@/assets/images/engine_logo.png";
126
+ ```
127
+
128
+ **Common mistakes:** `PlaneIcon` doesn't exist (use `PaperAirplaneIcon`), `HotelIcon` doesn't exist (use `BuildingOfficeIcon`), `import { useDataSource }` fails (it's a default export — no braces).
129
+
130
+ ---
131
+
16
132
  ## Core Conventions
17
133
 
18
134
  The following conventions apply to all dashboard development in this project.
19
135
 
20
- Before writing any code, read `.a4drules/features/pre-code-checklist.md` and verify all requirements. The most common mistakes are:
136
+ The most common mistakes are:
137
+ - **Forgetting to update Home.tsx and routes.tsx** (dashboard exists but never renders)
21
138
  - Creating `.jsx` instead of `.tsx` files
22
139
  - Creating files in `src/components/pages/` instead of `src/pages/`
23
140
  - Using forbidden colors (`text-white`, `bg-black`)
24
141
  - Hand-rolling HTML cards instead of using library components
142
+ - Reading component source files instead of using this skill's documentation
25
143
 
26
144
  1. **Write `.tsx` files** in `src/pages/` and update `CommandCenter.tsx` to import the dashboard. This is a TypeScript project — all React components use `.tsx` extension.
27
145
 
@@ -106,85 +224,12 @@ The logo is black — use `brightness-0 invert` to make it white when placed on
106
224
 
107
225
  No `<nav>`, header bar, tab bar, or content-swapping via `useState("activeTab")` inside dashboard pages. The app shell handles navigation. Dashboards are single scrollable pages — all content visible by scrolling.
108
226
 
109
- ## Where Dashboards Live & How to Wire Them
227
+ ## Where Dashboards Live
110
228
 
111
229
  - Dashboard page files: `src/pages/` (e.g. `EngineDashboard.tsx`, `FleetDashboard.tsx`) — **NOT** `src/components/pages/`
112
230
  - File format: `.tsx` (MUST be TypeScript) — this is a TypeScript project, all React components use `.tsx`, NEVER `.jsx`.
113
231
  - `CommandCenter.tsx` wraps with `heroui-scope` div + `AppThemeProvider` + `DataModeProvider` + `Toast.Provider` from `@heroui/react`. **Never recreate these providers in dashboard pages.** When wiring a new dashboard, only change the import — preserve the `heroui-scope` wrapper and `Toast.Provider` exactly as-is. For toasts inside dashboards, import `toast` from `@heroui/react` (or `@/components/library`) — NOT from `sonner`.
114
-
115
- ### Wiring a new dashboard (REQUIRED STEPS)
116
-
117
- All three steps are required for the dashboard to render:
118
-
119
- **Step 1:** Create the dashboard file in `src/pages/` (NOT `src/components/pages/`):
120
- ```tsx
121
- // src/pages/MyDashboard.tsx (NOTE: .tsx NOT .jsx, in src/pages/ NOT src/components/pages/)
122
- import React from "react";
123
- import { MetricCard, ListCard, ChartCard, D3Chart } from "@/components/library";
124
-
125
- export default function MyDashboard() {
126
- return (
127
- <div className="space-y-6 p-6">
128
- {/* dashboard content using library components */}
129
- </div>
130
- );
131
- }
132
- ```
133
-
134
- **Step 2:** Update `CommandCenter.tsx` to import and render it. Only change the import line — preserve `heroui-scope` and `Toast.Provider`:
135
- ```tsx
136
- // src/components/workspace/CommandCenter.tsx
137
- import AppThemeProvider from "@/components/library/theme/AppThemeProvider";
138
- import DataModeProvider from "@/components/library/data/DataModeProvider";
139
- import { Toast } from "@heroui/react";
140
- import MyDashboard from "../../pages/MyDashboard"; // ← change ONLY this import
141
-
142
- export default function CommandCenter() {
143
- return (
144
- <div className="heroui-scope"> {/* ← preserve this wrapper */}
145
- <AppThemeProvider initialMode="light">
146
- <DataModeProvider initialMode="sample">
147
- <MyDashboard /> {/* ← change this */}
148
- <Toast.Provider placement="bottom end" /> {/* ← preserve this */}
149
- </DataModeProvider>
150
- </AppThemeProvider>
151
- </div>
152
- );
153
- }
154
- ```
155
-
156
- **Step 2.5:** Update `Home.tsx` to render `CommandCenter`:
157
- ```tsx
158
- // src/pages/Home.tsx
159
- import CommandCenter from "@/components/workspace/CommandCenter";
160
-
161
- export default function HomePage() {
162
- return <CommandCenter />;
163
- }
164
- ```
165
-
166
- **Step 3:** Update `src/routes.tsx` to make the dashboard the home page. Replace the Search page index route with the Home/CommandCenter route:
167
- ```tsx
168
- // src/routes.tsx — change the index route
169
- {
170
- index: true,
171
- element: <SuspenseWrap><Home /></SuspenseWrap>,
172
- handle: { showInNavigation: true, label: 'Dashboard' }
173
- },
174
- {
175
- path: "search",
176
- element: <SuspenseWrap><Search /></SuspenseWrap>,
177
- handle: { showInNavigation: true, label: 'Search' }
178
- },
179
- ```
180
-
181
- The `Home` page renders `CommandCenter`, which renders your dashboard. The Search page moves to `/search`.
182
-
183
- **Verify:** After writing all files, confirm:
184
- 1. Your dashboard `.tsx` file exists in `src/pages/`
185
- 2. `CommandCenter.tsx` (in `src/components/workspace/`) imports your dashboard (not `BlankDashboard`)
186
- 3. `Home.tsx` (in `src/pages/`) imports and renders `CommandCenter` (not search interface)
187
- 4. `src/routes.tsx` has `Home` as the index route and `Search` at `/search`
232
+ - **Wiring is covered at the top of this file** — see "WIRING — DO THIS FIRST".
188
233
 
189
234
  ## Page Structure
190
235
 
@@ -1 +1,98 @@
1
- See SKILL.md Core Conventions, Library Components, Images, Navigation sections.
1
+ # Engine Travel Command Center Build Guide
2
+
3
+ The dashboard is built in **3 phases**, one per user prompt. Each phase adds a layer. Do NOT build ahead — only build what the current phase asks for.
4
+
5
+ ---
6
+
7
+ ## Phase 1 — Build the Dashboard (sample data only)
8
+
9
+ **What to build:**
10
+ - `src/pages/EngineDashboard.tsx` with:
11
+ - Sticky header (h-12, Engine logo, "Travel Command Center", "Powered by Agentforce" badge, bell icon, theme toggle)
12
+ - Hero GeoMap (h-[520px]) with markers, arcs, overlays from sample data
13
+ - Glass KPI overlays on the map (Active Travelers, Spend MTD, Compliance %, Eva Resolved)
14
+ - Flight status strip (horizontal scroll, glass pills)
15
+ - Escalations panel (BaseCard with "Assign to Agent" buttons, toast on click)
16
+ - Disruptions panel (severity dots, flight info, Eva action lines)
17
+ - Active Travelers panel (expandable cards with Avatar, details grid, "View in Salesforce" links)
18
+ - Monthly Spend chart (ChartCard + D3Chart groupedBarChart)
19
+ - All data from `src/data/engine-sample-data.js` via `useDataSource({ sample: SAMPLE_DATA, live: [] })`
20
+ - Brand tokens in `global.css`
21
+
22
+ **What to wire:**
23
+ - `CommandCenter.tsx` → import EngineDashboard
24
+ - `Home.tsx` → REPLACE with CommandCenter wrapper
25
+ - `routes.tsx` → Home as index route with label "Dashboard"
26
+
27
+ **What NOT to build (saved for later phases):**
28
+ - No ChatBar or Eva AI chat — that's Phase 3
29
+ - No AgentforceConversationClient — that's Phase 3
30
+ - No `useEngineLiveData` or live data wiring — that's Phase 2
31
+ - No Salesforce metadata (custom fields, platform events, Apex) — that's Phases 2-3
32
+ - Leave `live:` props empty (`live: []` or `live: undefined`) — Phase 2 fills them in
33
+
34
+ ---
35
+
36
+ ## Phase 2 — Connect to Live Data
37
+
38
+ **What to build:**
39
+ - Import `useEngineLiveData` from `src/hooks/useEngineLiveData.ts`
40
+ - Wire `live` prop on every `useDataSource` call:
41
+ ```tsx
42
+ const live = useEngineLiveData();
43
+ const markers = useDataSource({ sample: MAP_MARKERS, live: live.mapMarkers });
44
+ const arcs = useDataSource({ sample: MAP_ARCS, live: live.mapArcs });
45
+ ```
46
+ - Update KPI overlays to use active metrics:
47
+ ```tsx
48
+ const activeMetrics = live.loading ? METRICS : live.metrics;
49
+ ```
50
+
51
+ **What to do after wiring:**
52
+ - Proactively suggest creating `Flight__c.Weather_Impact__c` custom field
53
+ - If confirmed, create SFDX XML from PRD section 14a and deploy
54
+
55
+ **What NOT to build:**
56
+ - No ChatBar or Eva — that's Phase 3
57
+ - No platform events or Apex — that's Phase 3
58
+
59
+ ---
60
+
61
+ ## Phase 3 — Add Agentforce
62
+
63
+ **What to build:**
64
+ - `ChatBar` between the map and data panels:
65
+ ```tsx
66
+ <div className="px-4 pt-4">
67
+ <ChatBar
68
+ title="Eva"
69
+ placeholder="Ask Eva anything about travelers, bookings, policy, or spend…"
70
+ suggestions={CHAT_SUGGESTIONS}
71
+ onSend={handleChat}
72
+ />
73
+ </div>
74
+ ```
75
+ - Suggestions: weather warning, rebooking policy, notify travelers, create support case
76
+ - `handleChat` mock response at module scope
77
+ - `AgentforceConversationClient` with `agentId="0Xxa5000000relhCAA"` and `agentLabel="Eva"`
78
+
79
+ **What to do after adding Eva:**
80
+ - Proactively suggest creating `Travel_Disruption_Alert__e` platform event
81
+ - If confirmed, create SFDX XML from PRD section 14b and deploy
82
+ - Then suggest creating `TravelDisruptionEventService` Apex class
83
+ - If confirmed, create from PRD section 14c and deploy
84
+
85
+ ---
86
+
87
+ ## Phase Summary
88
+
89
+ | | Phase 1 | Phase 2 | Phase 3 |
90
+ |---|---------|---------|---------|
91
+ | Dashboard layout & panels | Build | — | — |
92
+ | Sample data | Wire | — | — |
93
+ | Live data | Skip | Wire | — |
94
+ | Custom field metadata | Skip | Suggest | — |
95
+ | ChatBar (Eva) | Skip | Skip | Build |
96
+ | AgentforceConversationClient | Skip | Skip | Build |
97
+ | Platform event | Skip | Skip | Suggest |
98
+ | Apex service | Skip | Skip | Suggest |
@@ -1 +1,32 @@
1
- See the PRD (engine-command-center-prd.md) section 13 for the 4-phase build process.
1
+ # Efficient Build Process
2
+
3
+ ## Speed Rules
4
+
5
+ 1. **Load only 2 files before building:** the PRD and this skill (command-center-builder). Do NOT load component-library, command-center-project, or outer-app skills — they add latency and aren't needed for the initial build.
6
+
7
+ 2. **Do NOT read component source files.** The props for every component (GeoMap, BaseCard, Avatar, ChartCard, D3Chart, etc.) are documented in this skill and the PRD. Reading `GeoMap.jsx`, `BaseCard.jsx`, etc. wastes time and produces no new information.
8
+
9
+ 3. **Write the dashboard in one pass.** Plan the full file before writing. Do not write a partial dashboard and iterate — write the complete component with all imports, data, and JSX in a single Write call.
10
+
11
+ 4. **Write all 4 files without stopping.** After the dashboard, immediately write CommandCenter.tsx, Home.tsx, and edit routes.tsx. Do not run build commands between files.
12
+
13
+ 5. **Do NOT run `npm run build`, `npm run dev`, `tsc`, or `npm run validate:dashboard` during the build.** These waste time. The Vite build handles JSX/TSX regardless of TypeScript errors, and pre-existing TS7016 errors (from untyped .jsx library files) are normal.
14
+
15
+ ## File Write Order
16
+
17
+ ```
18
+ 1. src/pages/EngineDashboard.tsx ← full dashboard, one pass
19
+ 2. src/components/workspace/CommandCenter.tsx ← import dashboard
20
+ 3. src/pages/Home.tsx ← REPLACE with CommandCenter wrapper
21
+ 4. src/routes.tsx ← edit index route label to "Dashboard"
22
+ ```
23
+
24
+ ## Common Time Wasters
25
+
26
+ | Waste | Fix |
27
+ |-------|-----|
28
+ | Loading 4-5 skills before starting | Load only command-center-builder + PRD |
29
+ | Reading GeoMap.jsx, Avatar.jsx, BaseCard.jsx source | Props are in this skill — trust the docs |
30
+ | Running `npm run build` after writing | Don't — Vite handles it, TS errors are pre-existing |
31
+ | Fixing imports iteratively (wrong icon names, wrong exports) | Check the PRD and this skill for exact import names before writing |
32
+ | Writing Home.tsx with Account Search content | REPLACE it with the 3-line CommandCenter wrapper (see WIRING section) |
@@ -10,37 +10,45 @@ description: >-
10
10
 
11
11
  # Command Center Development Guide
12
12
 
13
- ## Engine Travel Command Center
13
+ ## How to Build Efficiently
14
14
 
15
- The product spec is in `engine-command-center-prd.md` at the React app root (`force-app/main/default/uiBundles/reactcursor1/`). It defines the layout, components, data model, and brand tokens for the dashboard.
15
+ **Read these two files, then start building. Do not load other skills or explore component source files.**
16
16
 
17
- Sample data is pre-built in `src/data/engine-sample-data.js` with dashboard-ready exports.
17
+ 1. **`.a4drules/skills/command-center-builder/SKILL.md`** has the wiring steps, conventions, component APIs, and everything you need
18
+ 2. **`engine-command-center-prd.md`** — the product spec (layout, data model, brand tokens)
18
19
 
19
- ## Skills
20
+ That's it. The builder skill already contains the component API reference inline. Do NOT separately load `component-library`, `command-center-project`, or `outer-app` skills — they add latency and you don't need them for the initial build. Do NOT read individual component source files (GeoMap.jsx, Avatar.jsx, etc.) — the builder skill documents all the props.
20
21
 
21
- | Skill | What it covers |
22
- |-------|---------------|
23
- | **component-library** | Component API reference — props, data shapes, import patterns |
24
- | **command-center-builder** | Dashboard conventions — layout, styling, component selection, dark mode |
25
- | **command-center-project** | Project structure — routing, file locations, tech stack, wiring |
26
- | **outer-app** | Outer app — navigation, shadcn/ui, non-dashboard pages |
22
+ ## Build Order (write files in this exact order)
27
23
 
28
- ## Workflow
24
+ 1. **Read** the PRD and builder skill
25
+ 2. **Write** `src/pages/EngineDashboard.tsx` (or your dashboard name) — the full dashboard in one pass
26
+ 3. **Write** `src/components/workspace/CommandCenter.tsx` — import your dashboard
27
+ 4. **Write** `src/pages/Home.tsx` — REPLACE with CommandCenter (it ships as Account Search):
28
+ ```tsx
29
+ import CommandCenter from "@/components/workspace/CommandCenter";
30
+ export default function HomePage() { return <CommandCenter />; }
31
+ ```
32
+ 5. **Edit** `src/routes.tsx` — set Home as index route with label "Dashboard"
33
+ 6. **Done** — do NOT run `npm run build`, `npm run dev`, or `tsc`
29
34
 
30
- 1. Read the PRD (`engine-command-center-prd.md`) for what to build
31
- 2. Reference **component-library** for component APIs
32
- 3. Follow **command-center-builder** conventions for layout and styling
33
- 4. Reference **command-center-project** for file locations and wiring
35
+ ## Other Skills (load only when needed later)
36
+
37
+ | Skill | When to load |
38
+ |-------|-------------|
39
+ | **component-library** | Only if you need detailed props not covered in the builder skill |
40
+ | **command-center-project** | Only if you need project architecture context |
41
+ | **outer-app** | Only for non-dashboard pages (search, navigation) |
34
42
 
35
43
  ## Salesforce Data Integration
36
44
 
37
- For live data, use these global skills:
45
+ For live data (prompt 2), use these global skills:
38
46
  - **exploring-webapp-graphql-schema** — Look up objects and fields in `schema.graphql`
39
47
  - **generating-webapp-graphql-read-query** — Generate typed GraphQL queries
40
48
  - **using-webapp-graphql** — Create data hooks with `{ data, loading, error }`
41
49
 
42
50
  ## Agentforce Integration
43
51
 
44
- For AI agent features, use:
52
+ For AI agent features (prompt 3), use:
45
53
  - **managing-webapp-agentforce-conversation-client** — Full Agentforce setup
46
54
  - **component-library** (`chat-data.md`) — ChatBar component API
package/CHANGELOG.md CHANGED
@@ -5,6 +5,31 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.9.77] - 2026-04-04
9
+
10
+ ### Added
11
+ - **Three-phase build guide (`getting-started.md`)** — Replaced one-liner pointer with a full phase-by-phase guide telling the agent exactly what to build and what to skip in each phase. Includes code snippets, explicit "NOT in this phase" callouts, and a summary table
12
+ - **Build guide callout in SKILL.md** — Added a prominent callout at the top of the builder skill pointing to the build guide so agents see it immediately
13
+
14
+ **Context:** Agent was building everything (including Eva ChatBar) in Phase 1 because there was no guide telling it to stop. The PRD had phase instructions but nothing in the skills enforced it. Now `getting-started.md` defines exactly what belongs in each of the 3 phases.
15
+
16
+ ## [1.9.76] - 2026-04-04
17
+
18
+ ### Fixed
19
+ - **Dashboard wiring failure** — Agent was building the dashboard but not updating Home.tsx and routes.tsx, so users saw the Account Search page instead of their dashboard
20
+ - **Slow builds** — Agent was loading 5 skills and reading component source files before writing anything
21
+
22
+ ### Changed
23
+ - **Builder skill (SKILL.md)** — Moved wiring instructions to the very top as "WIRING — DO THIS FIRST". Added Quick Import Reference with all component, icon, and data imports so the agent doesn't need to read source files
24
+ - **Guide skill (SKILL.md)** — Simplified to "load 2 files, then start building" instead of loading 4-5 skills. Added explicit Build Order (write files 1-2-3-4, done)
25
+ - **improved-build-process.md** — Replaced one-liner with full speed rules, file write order, and Common Time Wasters table
26
+ - **pre-code-checklist.md** — Added explicit code snippets for all 3 wiring files (CommandCenter.tsx, Home.tsx, routes.tsx)
27
+ - **command-center-dashboard-rule.md** — Moved wiring above constraints with Home.tsx code example
28
+ - **engine-dashboard-rule.md** — Expanded wiring checklist with Home.tsx replacement code
29
+ - **PRD build prompts (section 13)** — Rewrote all 3 prompts in natural language. Prompt 1 now says "Make it the home page when you're done". Added agent checklists and common failure notes below each prompt
30
+
31
+ **Context:** Agent was creating EngineDashboard.tsx and CommandCenter.tsx but leaving Home.tsx as the default Account Search page and not updating routes.tsx. The dashboard existed but never rendered. Root cause: wiring was buried 115 lines deep in the builder skill, the guide skill told the agent to load 5 skills before building, and the prompt didn't mention wiring. Fixed by moving wiring to the top of every skill file, simplifying the skill loading, and rewriting prompts.
32
+
8
33
  ## [1.9.75] - 2026-04-02
9
34
 
10
35
  ### Updated
@@ -320,51 +320,65 @@ Every element supports light and dark. GeoMap: `theme={mode === "dark" ? "dark"
320
320
 
321
321
  ## 13. Build Prompts
322
322
 
323
- Build incrementally in 3 prompts. Each prompt builds on the previous result.
323
+ Build incrementally in 3 prompts. Each prompt builds on the previous result. The user prompt (blockquote) is what you copy-paste. The agent instructions below each prompt are guidance for the AI — not shown to the user.
324
324
 
325
325
  ---
326
326
 
327
- ### Build the Dashboard
327
+ ### Prompt 1 — Build the Dashboard
328
328
 
329
- > Build the Engine Travel Command Center dashboard. Read the PRD for the full spec. Create the visualization-hero layout with the sticky header, hero GeoMap, glass KPI overlays, flight status strip, and all 4 data panels — Escalations, Disruptions, Active Travelers, and Monthly Spend Trend. Wire up the sample data from `src/data/engine-sample-data.js` so we can see real travelers, flights, and map markers. Include the "Assign to Agent" buttons on open escalations, the "View in Salesforce" links in traveler details, the "Powered by Agentforce" badge in the header, and the Salesforce signal toasts. Skip the Eva ChatBar for nowwe'll add that after we connect to live data.
329
+ > Build me a travel command center for Engine. There's a PRD with the full spec. I want the big hero map showing where all our travelers are with flight arcs, glass KPI overlays on top of the map, a flight status ticker, and then below that the main panels escalations that need attention, active disruptions, our traveler roster with expandable details, and a spend trend chart. Hook it all up to the sample data so it looks real. Don't worry about the AI assistant or live data yet we'll layer those on after. Make it the home page when you're done I want to see it when I open the app.
330
+
331
+ **What the agent must do:**
332
+
333
+ 1. Read the PRD and the `command-center-builder` skill for conventions
334
+ 2. Create `src/pages/EngineDashboard.tsx` with the full dashboard
335
+ 3. Update `src/components/workspace/CommandCenter.tsx` to import EngineDashboard
336
+ 4. **Rewrite `src/pages/Home.tsx`** to render CommandCenter (it ships as Account Search — must be replaced)
337
+ 5. **Update `src/routes.tsx`** to set Home as the index route with label "Dashboard"
338
+ 6. Add Engine brand tokens to `global.css` if not already present
339
+
340
+ **What the agent must NOT do in this prompt:**
341
+ - Do NOT add the ChatBar or any Eva/Agentforce integration — that's Prompt 3
342
+ - Do NOT wire up live data or `useEngineLiveData` — that's Prompt 2
343
+ - Do NOT create Salesforce metadata (custom fields, platform events, Apex) — that's Prompts 2 and 3
344
+
345
+ **Common failure:** The agent creates the dashboard file but forgets to update `Home.tsx` and `routes.tsx`, so the user still sees the Account Search page. The wiring section at the top of `.a4drules/skills/command-center-builder/SKILL.md` explains all required file changes.
330
346
 
331
347
  ---
332
348
 
333
- ### Connect to Salesforce Data
334
-
335
- > Connect the dashboard to live Salesforce data. A second dataset already exists in `src/data/engine-live-data.js` with 12 travelers across global routes and different KPIs (distinct from the 8-traveler sample data). A hook already exists at `src/hooks/useEngineLiveData.ts` it imports the live data, simulates a 2-second loading delay, then calls `setMode("live")` to flip the global data mode.
336
- >
337
- > Import `useEngineLiveData` in the dashboard and populate the `live` prop on each `useDataSource` call:
338
- >
339
- > ```tsx
340
- > const live = useEngineLiveData();
341
- > const markers = useDataSource({ sample: MAP_MARKERS, live: live.mapMarkers });
342
- > const arcs = useDataSource({ sample: MAP_ARCS, live: live.mapArcs });
343
- > ```
344
- >
345
- > Also update the KPI overlays to re-derive from whichever metrics are active:
346
- >
347
- > ```tsx
348
- > const activeMetrics = live.loading ? METRICS : live.metrics;
349
- > ```
350
- >
351
- > After wiring the data, check if `Flight__c` has a `Weather_Impact__c` field for tracking weather disruptions — if it doesn't exist, ask me before creating it. Use the SFDX XML template from section 14a below and deploy with `sf project deploy start`.
352
-
353
- **Reference — what the agent should say and do:**
354
-
355
- 1. After wiring the live data, tell the user: *"I notice `Flight__c` doesn't have a field to track weather impact on individual flights. A `Weather_Impact__c` picklist would help the dashboard filter storm-affected flights. Want me to create it?"* — When confirmed, create the custom field XML from section 14a and deploy it.
349
+ ### Prompt 2 — Connect to Salesforce Data
350
+
351
+ > Now let's connect this to real data. There's a second dataset with different travelers and metrics hook that up as the "live" data source so when someone toggles from sample to live mode, everything refreshes with the new data. After that, see if there are any data model improvements we should make for tracking weather disruptions.
352
+
353
+ **What the agent must do:**
354
+
355
+ 1. Find and use `src/data/engine-live-data.js` and `src/hooks/useEngineLiveData.ts`
356
+ 2. Import `useEngineLiveData` and wire each `useDataSource({ sample, live })` call
357
+ 3. Update KPI overlays to derive from whichever metrics are active
358
+ 4. After wiring, proactively offer to create the `Weather_Impact__c` custom field (section 14a)
359
+
360
+ **Reference — what the agent should say:**
361
+
362
+ After wiring the live data: *"I notice `Flight__c` doesn't have a field to track weather impact on individual flights. A `Weather_Impact__c` picklist would help the dashboard filter storm-affected flights. Want me to create it?"* — When confirmed, create the custom field XML from section 14a and deploy it.
356
363
 
357
364
  ---
358
365
 
359
- ### Add Agentforce
366
+ ### Prompt 3 — Add Agentforce
367
+
368
+ > Last piece — let's add Eva, the AI travel assistant. I want a chat bar right below the map where people can ask her questions about travelers and disruptions. Also hook up the real Agentforce agent so she can actually do things. Then let's set up the backend so disruption alerts can flow through the platform in real time.
369
+
370
+ **What the agent must do:**
360
371
 
361
- > Add Eva to the dashboard. Place the ChatBar between the map and data panels using the suggestions from section 9. Wire up the `handleChat` mock response. Then add the `AgentforceConversationClient` component with `agentId="0Xxa5000000relhCAA"` and `agentLabel="Eva"` — this connects the real Salesforce agent. After adding Eva, create a `Travel_Disruption_Alert__e` platform event so disruptions can be published to the event bus in real time — ask me before creating it. Then write an Apex class `TravelDisruptionEventService` that publishes disruption records to that event — ask me before creating it. Use the SFDX templates from section 14b and 14c and deploy each with `sf project deploy start`.
372
+ 1. Add `ChatBar` with suggestions from section 9, placed between map and data panels
373
+ 2. Add `AgentforceConversationClient` with `agentId="0Xxa5000000relhCAA"` and `agentLabel="Eva"`
374
+ 3. Proactively offer to create `Travel_Disruption_Alert__e` platform event (section 14b)
375
+ 4. After the event, proactively offer to create `TravelDisruptionEventService` Apex class (section 14c)
362
376
 
363
- **Reference — what the agent should say and do:**
377
+ **Reference — what the agent should say:**
364
378
 
365
- 1. After adding Eva, tell the user: *"The dashboard tracks disruptions in real time. I can create a `Travel_Disruption_Alert__e` platform event so disruption data can be published to the Salesforce event bus — other systems and automation can subscribe to it. Want me to set it up?"* — When confirmed, create the platform event and its fields from section 14b and deploy.
379
+ 1. After adding Eva: *"The dashboard tracks disruptions in real time. I can create a `Travel_Disruption_Alert__e` platform event so disruption data can be published to the Salesforce event bus — other systems and automation can subscribe to it. Want me to set it up?"* — When confirmed, create the platform event and its fields from section 14b and deploy.
366
380
 
367
- 2. After the platform event, tell the user: *"Now I'll write an Apex service class to publish disruption records to that event bus. `TravelDisruptionEventService` will take a list of disruptions and fire platform events with the flight number, severity, and description. Want me to create it?"* — When confirmed, create the Apex class from section 14c and deploy.
381
+ 2. After the platform event: *"Now I'll write an Apex service class to publish disruption records to that event bus. `TravelDisruptionEventService` will take a list of disruptions and fire platform events with the flight number, severity, and description. Want me to create it?"* — When confirmed, create the Apex class from section 14c and deploy.
368
382
 
369
383
  ---
370
384
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schandlergarcia/sf-web-components",
3
- "version": "1.9.75",
3
+ "version": "1.9.77",
4
4
  "description": "Reusable Salesforce web components library with Tailwind CSS v4 and shadcn/ui",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",