@schandlergarcia/sf-web-components 1.9.10 → 1.9.12
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/README.md
CHANGED
|
@@ -74,6 +74,9 @@ The postinstall script automatically:
|
|
|
74
74
|
✅ **Copies utility files** to `src/lib/`
|
|
75
75
|
- `utils.ts` - Helper functions (cn, etc.)
|
|
76
76
|
|
|
77
|
+
✅ **Installs workspace components** to `src/components/workspace/`
|
|
78
|
+
- `CommandCenter.tsx` - Dashboard wrapper with theme and data providers
|
|
79
|
+
|
|
77
80
|
---
|
|
78
81
|
|
|
79
82
|
## Using the Dashboard Framework
|
|
@@ -286,9 +289,9 @@ npm install
|
|
|
286
289
|
npm run build
|
|
287
290
|
```
|
|
288
291
|
|
|
289
|
-
### Reset Command Center (
|
|
292
|
+
### Reset Command Center (All Apps)
|
|
290
293
|
|
|
291
|
-
|
|
294
|
+
This script resets any app back to the blank dashboard baseline state:
|
|
292
295
|
|
|
293
296
|
```bash
|
|
294
297
|
# This script resets the command center to the blank dashboard template
|
|
@@ -298,6 +301,14 @@ npm run reset:command-center
|
|
|
298
301
|
bash node_modules/@schandlergarcia/sf-web-components/scripts/reset-command-center.sh
|
|
299
302
|
```
|
|
300
303
|
|
|
304
|
+
**What it does:**
|
|
305
|
+
- Removes custom dashboard pages
|
|
306
|
+
- Restalls BlankDashboard.tsx with EmptyState
|
|
307
|
+
- Resets CommandCenter.tsx (preserves theme mode)
|
|
308
|
+
- Updates Home.tsx to search interface
|
|
309
|
+
- Resets routes to baseline configuration
|
|
310
|
+
- Preserves: component library, authentication, all dependencies
|
|
311
|
+
|
|
301
312
|
---
|
|
302
313
|
|
|
303
314
|
## Troubleshooting
|
package/package.json
CHANGED
package/scripts/postinstall.mjs
CHANGED
|
@@ -105,6 +105,35 @@ if (fs.existsSync(sourceWorkspaceDir)) {
|
|
|
105
105
|
console.log(` ✓ Copied ${workspaceFilesCopied} workspace files\n`);
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
// Copy workspace templates (CommandCenter, etc.)
|
|
109
|
+
const workspaceTemplatesDir = path.join(packageRoot, 'src/templates/workspace');
|
|
110
|
+
if (fs.existsSync(workspaceTemplatesDir)) {
|
|
111
|
+
if (!fs.existsSync(targetWorkspaceDir)) {
|
|
112
|
+
fs.mkdirSync(targetWorkspaceDir, { recursive: true });
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const workspaceTemplates = fs.readdirSync(workspaceTemplatesDir).filter(f => f.endsWith('.template'));
|
|
116
|
+
let workspaceTemplatesCopied = 0;
|
|
117
|
+
|
|
118
|
+
for (const template of workspaceTemplates) {
|
|
119
|
+
const sourcePath = path.join(workspaceTemplatesDir, template);
|
|
120
|
+
const targetFileName = template.replace('.template', '');
|
|
121
|
+
const targetPath = path.join(targetWorkspaceDir, targetFileName);
|
|
122
|
+
|
|
123
|
+
try {
|
|
124
|
+
const content = fs.readFileSync(sourcePath, 'utf-8');
|
|
125
|
+
fs.writeFileSync(targetPath, content, 'utf-8');
|
|
126
|
+
workspaceTemplatesCopied++;
|
|
127
|
+
} catch (error) {
|
|
128
|
+
console.error(` ✗ Failed to copy ${targetFileName}: ${error.message}`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (workspaceTemplatesCopied > 0) {
|
|
133
|
+
console.log(` ✓ Copied ${workspaceTemplatesCopied} workspace template files\n`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
108
137
|
// Copy pages directory (sample pages, etc.)
|
|
109
138
|
const sourcePagesDir = path.join(packageRoot, 'src/components/pages');
|
|
110
139
|
const targetComponentPagesDir = path.join(cwd, 'src/components/pages');
|
|
@@ -214,8 +243,35 @@ if (fs.existsSync(routesTemplatePath) && fs.existsSync(path.join(cwd, 'src'))) {
|
|
|
214
243
|
}
|
|
215
244
|
}
|
|
216
245
|
|
|
246
|
+
// Add reset:command-center script to package.json
|
|
247
|
+
const packageJsonPath = path.join(cwd, 'package.json');
|
|
248
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
249
|
+
console.log('\n🔧 Adding reset script to package.json...\n');
|
|
250
|
+
|
|
251
|
+
try {
|
|
252
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
253
|
+
|
|
254
|
+
if (!packageJson.scripts) {
|
|
255
|
+
packageJson.scripts = {};
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// Add the reset:command-center script if it doesn't exist
|
|
259
|
+
if (!packageJson.scripts['reset:command-center']) {
|
|
260
|
+
packageJson.scripts['reset:command-center'] = 'bash node_modules/@schandlergarcia/sf-web-components/scripts/reset-command-center.sh';
|
|
261
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n', 'utf-8');
|
|
262
|
+
console.log(' ✓ Added "reset:command-center" script to package.json');
|
|
263
|
+
} else {
|
|
264
|
+
console.log(' ℹ Script "reset:command-center" already exists');
|
|
265
|
+
}
|
|
266
|
+
} catch (error) {
|
|
267
|
+
console.error(` ✗ Failed to update package.json: ${error.message}`);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
217
271
|
console.log('\n📊 Summary:');
|
|
218
272
|
console.log(` - Copied ${componentsCopied} UI components`);
|
|
219
273
|
console.log(` - Updated ${filesUpdated} files`);
|
|
220
274
|
console.log(` - Installed ${templatesInstalled} page templates`);
|
|
275
|
+
console.log(` - Installed CommandCenter.tsx for dashboard management`);
|
|
276
|
+
console.log(` - Added "npm run reset:command-center" script`);
|
|
221
277
|
console.log('\n✅ Setup complete! UI components are now local for optimal Tailwind scanning\n');
|
|
@@ -37,8 +37,9 @@ echo ""
|
|
|
37
37
|
echo "→ Removing custom dashboards…"
|
|
38
38
|
|
|
39
39
|
removed=0
|
|
40
|
-
for f in src/
|
|
41
|
-
|
|
40
|
+
for f in src/pages/*Dashboard*.tsx src/pages/*Dashboard*.jsx; do
|
|
41
|
+
# Don't remove BlankDashboard
|
|
42
|
+
if [ -f "$f" ] && [[ "$(basename "$f")" != "BlankDashboard"* ]]; then
|
|
42
43
|
rm "$f"
|
|
43
44
|
echo " ✓ Removed $(basename "$f")"
|
|
44
45
|
removed=$((removed + 1))
|
|
@@ -52,11 +53,10 @@ echo ""
|
|
|
52
53
|
|
|
53
54
|
# ── 2. Write the blank starter dashboard ────────────────────────────────────
|
|
54
55
|
|
|
55
|
-
BLANK="src/
|
|
56
|
+
BLANK="src/pages/BlankDashboard.tsx"
|
|
56
57
|
echo "→ Creating ${BLANK}..."
|
|
57
58
|
|
|
58
59
|
cat > "$BLANK" << 'DASHBOARD_EOF'
|
|
59
|
-
import React from "react";
|
|
60
60
|
import { RocketLaunchIcon } from "@heroicons/react/24/outline";
|
|
61
61
|
import { EmptyState } from "@/components/library";
|
|
62
62
|
|
|
@@ -80,9 +80,12 @@ echo ""
|
|
|
80
80
|
# ── 3. Update CommandCenter.tsx to use BlankDashboard ────────────────────────
|
|
81
81
|
# Preserves theme initialMode if previously customized.
|
|
82
82
|
|
|
83
|
-
WRAPPER="src/components/
|
|
83
|
+
WRAPPER="src/components/workspace/CommandCenter.tsx"
|
|
84
84
|
echo "→ Updating ${WRAPPER}..."
|
|
85
85
|
|
|
86
|
+
# Create workspace directory if it doesn't exist
|
|
87
|
+
mkdir -p "src/components/workspace"
|
|
88
|
+
|
|
86
89
|
# Extract existing initialMode from AppThemeProvider (default: "light")
|
|
87
90
|
THEME_MODE="light"
|
|
88
91
|
if [ -f "$WRAPPER" ]; then
|
|
@@ -96,19 +99,17 @@ fi
|
|
|
96
99
|
cat > "$WRAPPER" << WRAPPER_EOF
|
|
97
100
|
import AppThemeProvider from "@/components/library/theme/AppThemeProvider";
|
|
98
101
|
import DataModeProvider from "@/components/library/data/DataModeProvider";
|
|
99
|
-
import {
|
|
100
|
-
import BlankDashboard from "
|
|
102
|
+
import { Toaster } from "sonner";
|
|
103
|
+
import BlankDashboard from "../../pages/BlankDashboard";
|
|
101
104
|
|
|
102
105
|
export default function CommandCenter() {
|
|
103
106
|
return (
|
|
104
|
-
<
|
|
105
|
-
<
|
|
106
|
-
<
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
</AppThemeProvider>
|
|
111
|
-
</div>
|
|
107
|
+
<AppThemeProvider initialMode="${THEME_MODE}">
|
|
108
|
+
<DataModeProvider initialMode="sample">
|
|
109
|
+
<BlankDashboard />
|
|
110
|
+
<Toaster position="bottom-right" />
|
|
111
|
+
</DataModeProvider>
|
|
112
|
+
</AppThemeProvider>
|
|
112
113
|
);
|
|
113
114
|
}
|
|
114
115
|
WRAPPER_EOF
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import AppThemeProvider from "@/components/library/theme/AppThemeProvider";
|
|
2
|
+
import DataModeProvider from "@/components/library/data/DataModeProvider";
|
|
3
|
+
import { Toaster } from "sonner";
|
|
4
|
+
import BlankDashboard from "../pages/BlankDashboard";
|
|
5
|
+
|
|
6
|
+
export default function CommandCenter() {
|
|
7
|
+
return (
|
|
8
|
+
<AppThemeProvider initialMode="light">
|
|
9
|
+
<DataModeProvider initialMode="sample">
|
|
10
|
+
<BlankDashboard />
|
|
11
|
+
<Toaster position="bottom-right" />
|
|
12
|
+
</DataModeProvider>
|
|
13
|
+
</AppThemeProvider>
|
|
14
|
+
);
|
|
15
|
+
}
|