@schandlergarcia/sf-web-components 1.9.18 → 1.9.20
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.
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
paths:
|
|
3
|
-
- "**/
|
|
4
|
-
- "**/
|
|
5
|
-
- "**/components/
|
|
3
|
+
- "**/pages/*.jsx"
|
|
4
|
+
- "**/pages/*.tsx"
|
|
5
|
+
- "**/components/workspace/CommandCenter.tsx"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Command Center Dashboard Rules (MANDATORY)
|
|
9
9
|
|
|
10
|
-
These rules are non-negotiable for all files in `src/components/
|
|
10
|
+
These rules are non-negotiable for all dashboard files in `src/pages/` and workspace files in `src/components/workspace/`.
|
|
11
11
|
|
|
12
12
|
## Before writing ANY code, load these skills
|
|
13
13
|
|
|
@@ -15,7 +15,7 @@ You MUST load the **command-center-builder** and **component-library** skills be
|
|
|
15
15
|
|
|
16
16
|
## Critical constraints
|
|
17
17
|
|
|
18
|
-
1. **File extension
|
|
18
|
+
1. **File extension MUST be `.tsx`** — This is a TypeScript project. All React components MUST use `.tsx` extension, never `.jsx`. All type definitions are available from the component library.
|
|
19
19
|
|
|
20
20
|
2. **Use ONLY library components** from `@/components/library` for cards, charts, tables, lists. Never hand-roll HTML cards (`<div className="bg-white border rounded...">`).
|
|
21
21
|
|
|
@@ -15,7 +15,7 @@ These rules apply when building dashboards rendered by `CommandCenter.tsx`. For
|
|
|
15
15
|
|
|
16
16
|
**Every time you build a dashboard, you MUST follow these non-negotiable rules. Violations are the #1 cause of rejected dashboards.**
|
|
17
17
|
|
|
18
|
-
1. **Actually write files to disk.** Use the file-writing tools to create `.
|
|
18
|
+
1. **Actually write files to disk.** Use the file-writing tools to create `.tsx` files (NOT `.jsx`) in `src/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.
|
|
19
19
|
|
|
20
20
|
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.
|
|
21
21
|
|
|
@@ -140,17 +140,17 @@ Splitting a dashboard into 5 tab "pages" (Overview, Travelers, Spend, Policy, Ev
|
|
|
140
140
|
|
|
141
141
|
## Where Dashboards Live & How to Wire Them
|
|
142
142
|
|
|
143
|
-
- Dashboard page files: `src/
|
|
144
|
-
- File format: `.
|
|
145
|
-
- `CommandCenter.tsx` wraps with `
|
|
143
|
+
- Dashboard page files: `src/pages/` (e.g. `EngineDashboard.tsx`, `FleetDashboard.tsx`)
|
|
144
|
+
- File format: `.tsx` (MUST be TypeScript) — this is a TypeScript project, all React components use `.tsx`.
|
|
145
|
+
- `CommandCenter.tsx` wraps with `AppThemeProvider` + `DataModeProvider` + `Toaster`. **Never recreate these providers in dashboard pages.**
|
|
146
146
|
|
|
147
147
|
### Wiring a new dashboard (REQUIRED STEPS)
|
|
148
148
|
|
|
149
149
|
You must do ALL of these or the dashboard will not render correctly:
|
|
150
150
|
|
|
151
|
-
**Step 1:** Create the dashboard file in `src/
|
|
152
|
-
```
|
|
153
|
-
// src/
|
|
151
|
+
**Step 1:** Create the dashboard file in `src/pages/`:
|
|
152
|
+
```tsx
|
|
153
|
+
// src/pages/MyDashboard.tsx
|
|
154
154
|
import React from "react";
|
|
155
155
|
import { MetricCard, ListCard, ChartCard, D3Chart } from "@/components/library";
|
|
156
156
|
|
|
@@ -165,22 +165,20 @@ export default function MyDashboard() {
|
|
|
165
165
|
|
|
166
166
|
**Step 2:** Update `CommandCenter.tsx` to import and render it:
|
|
167
167
|
```tsx
|
|
168
|
-
// src/components/
|
|
168
|
+
// src/components/workspace/CommandCenter.tsx
|
|
169
169
|
import AppThemeProvider from "@/components/library/theme/AppThemeProvider";
|
|
170
170
|
import DataModeProvider from "@/components/library/data/DataModeProvider";
|
|
171
|
-
import {
|
|
172
|
-
import MyDashboard from "
|
|
171
|
+
import { Toaster } from "sonner";
|
|
172
|
+
import MyDashboard from "../../pages/MyDashboard"; // ← change this import
|
|
173
173
|
|
|
174
174
|
export default function CommandCenter() {
|
|
175
175
|
return (
|
|
176
|
-
<
|
|
177
|
-
<
|
|
178
|
-
<
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
</AppThemeProvider>
|
|
183
|
-
</div>
|
|
176
|
+
<AppThemeProvider initialMode="light">
|
|
177
|
+
<DataModeProvider initialMode="sample">
|
|
178
|
+
<MyDashboard /> {/* ← change this */}
|
|
179
|
+
<Toaster position="bottom-right" />
|
|
180
|
+
</DataModeProvider>
|
|
181
|
+
</AppThemeProvider>
|
|
184
182
|
);
|
|
185
183
|
}
|
|
186
184
|
```
|
|
@@ -203,8 +201,8 @@ export default function CommandCenter() {
|
|
|
203
201
|
The `Home` page renders `CommandCenter`, which renders your dashboard. The Search page moves to `/search`.
|
|
204
202
|
|
|
205
203
|
**Verify:** After writing all files, confirm:
|
|
206
|
-
1. Your dashboard `.
|
|
207
|
-
2. `CommandCenter.tsx` imports your dashboard (not `BlankDashboard`)
|
|
204
|
+
1. Your dashboard `.tsx` file exists in `src/pages/`
|
|
205
|
+
2. `CommandCenter.tsx` (in `src/components/workspace/`) imports your dashboard (not `BlankDashboard`)
|
|
208
206
|
3. `src/routes.tsx` has `Home` as the index route and `Search` at `/search`
|
|
209
207
|
|
|
210
208
|
## Page Structure
|
|
@@ -589,7 +587,7 @@ The validator (`scripts/validate-dashboard.sh`) automatically checks for:
|
|
|
589
587
|
- `position: fixed` without `createPortal`
|
|
590
588
|
- shadcn/Lucide imports in command center code
|
|
591
589
|
- Missing `space-y-6` wrappers
|
|
592
|
-
- `.
|
|
590
|
+
- `.jsx` files where `.tsx` is required (this is a TypeScript project)
|
|
593
591
|
- Dashboard navigation (`<nav>` elements)
|
|
594
592
|
|
|
595
593
|
**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.
|
package/package.json
CHANGED