@schandlergarcia/sf-web-components 1.9.19 → 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.
|
@@ -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