@donotdev/cli 0.0.37 → 0.1.1
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/LICENSE.md +21 -48
- package/dependencies-matrix.json +108 -58
- package/dist/bin/commands/agent-setup.js +7196 -123
- package/dist/bin/commands/build.js +3341 -207
- package/dist/bin/commands/bump.js +268 -24
- package/dist/bin/commands/cacheout.js +262 -13
- package/dist/bin/commands/coach.js +365 -61
- package/dist/bin/commands/create-app.js +261 -14
- package/dist/bin/commands/create-project.js +270 -15
- package/dist/bin/commands/db.js +10743 -2346
- package/dist/bin/commands/deploy.js +4202 -776
- package/dist/bin/commands/dev.js +353 -38
- package/dist/bin/commands/doctor.js +412 -108
- package/dist/bin/commands/emu.js +392 -57
- package/dist/bin/commands/format.js +250 -15
- package/dist/bin/commands/get-demo.js +261 -14
- package/dist/bin/commands/make-admin.js +10022 -1552
- package/dist/bin/commands/preview.js +353 -38
- package/dist/bin/commands/seed.js +10743 -2346
- package/dist/bin/commands/setup-cicd.js +456 -133
- package/dist/bin/commands/setup.js +428 -125
- package/dist/bin/commands/staging.js +4202 -776
- package/dist/bin/commands/sync-secrets.js +250 -14
- package/dist/bin/commands/type-check.js +249 -13
- package/dist/bin/commands/wai.js +249 -13
- package/dist/bin/dndev.js +33 -4
- package/dist/bin/donotdev.js +33 -4
- package/dist/index.js +4278 -856
- package/{templates/root-consumer/guides/dndev/advanced/VERSION_CONTROL.md.example → guidelines/VERSION_CONTROL.md} +7 -11
- package/package.json +3 -2
- package/templates/app-demo/src/themes.css.example +21 -0
- package/templates/app-dndev/index.html.example +0 -3
- package/templates/app-dndev/src/themes.css.example +21 -0
- package/templates/app-next/src/app/layout.tsx.example +13 -4
- package/templates/app-next/src/themes.css.example +21 -0
- package/templates/app-vite/csp.example.json +44 -0
- package/templates/app-vite/index.html.example +0 -3
- package/templates/app-vite/src/themes.css.example +21 -0
- package/templates/functions-supabase/supabase/functions/.env.example +12 -0
- package/templates/functions-supabase/supabase/functions/disconnect-oauth/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/functions/exchange-token/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/functions/get-connections/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/functions/refresh-token/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/migrations/20250101000000_idempotency.sql +3 -0
- package/templates/functions-supabase/supabase/migrations/20250101000001_rate_limits.sql +3 -0
- package/templates/functions-supabase/supabase/migrations/20250101000003_operation_metrics.sql +3 -0
- package/templates/preset-admin/src/pages/DashboardPage.tsx.example +189 -0
- package/templates/preset-admin/src/pages/EntityPage.tsx.example +84 -0
- package/templates/preset-admin/src/pages/ReportsPage.tsx.example +243 -0
- package/templates/preset-admin/src/pages/SettingsPage.tsx.example +283 -0
- package/templates/preset-admin/src/pages/UsersPage.tsx.example +128 -0
- package/templates/preset-ecommerce/src/pages/CartPage.tsx.example +167 -0
- package/templates/preset-ecommerce/src/pages/CatalogPage.tsx.example +187 -0
- package/templates/preset-ecommerce/src/pages/CheckoutPage.tsx.example +244 -0
- package/templates/preset-ecommerce/src/pages/HomePage.tsx.example +268 -0
- package/templates/preset-ecommerce/src/pages/ProductPage.tsx.example +228 -0
- package/templates/preset-landing/src/pages/AboutPage.tsx.example +237 -0
- package/templates/preset-landing/src/pages/ContactPage.tsx.example +192 -0
- package/templates/preset-landing/src/pages/HomePage.tsx.example +399 -0
- package/templates/preset-saas/src/pages/DashboardPage.tsx.example +195 -0
- package/templates/preset-saas/src/pages/HomePage.tsx.example +270 -0
- package/templates/preset-saas/src/pages/PricingPage.tsx.example +204 -0
- package/templates/preset-saas/src/pages/ProfilePage.tsx.example +191 -0
- package/templates/preset-saas/src/pages/SettingsPage.tsx.example +292 -0
- package/templates/root-consumer/.claude/hooks/framework-compliance.sh.example +56 -0
- package/templates/root-consumer/.claude/hooks/guard-bash.sh.example +61 -0
- package/templates/root-consumer/.claude/hooks/guard-files.sh.example +46 -0
- package/templates/root-consumer/.claude/hooks/guard-mcp.sh.example +91 -0
- package/templates/root-consumer/.claude/hooks/guard-secrets.sh.example +67 -0
- package/templates/root-consumer/.claude/hooks/guard-write.sh.example +89 -0
- package/templates/root-consumer/.claude/hooks/session-start.sh.example +50 -0
- package/templates/root-consumer/.claude/hooks/track-mcp-lookup.sh.example +20 -0
- package/templates/root-consumer/.claude/hooks/typecheck-stop.sh.example +18 -0
- package/templates/root-consumer/.claude/rules/consumer-ux.md.example +32 -0
- package/templates/root-consumer/.claude/rules/definition-of-done.md.example +32 -0
- package/templates/root-consumer/.claude/rules/framework.md.example +39 -0
- package/templates/root-consumer/.claude/rules/git.md.example +14 -0
- package/templates/root-consumer/.claude/rules/security.md.example +13 -0
- package/templates/root-consumer/.claude/settings.json.example +123 -1
- package/templates/root-consumer/.claude/skills/brainstorm/SKILL.md.example +16 -0
- package/templates/root-consumer/.claude/skills/build/SKILL.md.example +103 -25
- package/templates/root-consumer/.claude/skills/design/SKILL.md.example +17 -0
- package/templates/root-consumer/.claude/skills/grill/SKILL.md.example +33 -16
- package/templates/root-consumer/.claude/skills/polish/SKILL.md.example +50 -37
- package/templates/root-consumer/AI.md.example +2 -2
- package/templates/root-consumer/CLAUDE.md.example +33 -1
- package/templates/root-consumer/guides/dndev/INDEX.md.example +23 -27
- package/templates/root-consumer/guides/dndev/SETUP_AUTH.md.example +3 -2
- package/templates/root-consumer/guides/dndev/SETUP_OAUTH.md.example +12 -6
- package/templates/root-consumer/guides/dndev/SETUP_SUPABASE.md.example +50 -3
- package/templates/root-consumer/guides/wai-way/blueprints/3_compose.md.example +13 -15
- package/templates/app-demo/public/manifest.json.example +0 -10
- package/templates/app-dndev/public/manifest.json.example +0 -10
- package/templates/root-consumer/.claude/commands/brainstorm.md.example +0 -147
- package/templates/root-consumer/.claude/commands/build.md.example +0 -131
- package/templates/root-consumer/.claude/commands/design.md.example +0 -153
- package/templates/root-consumer/.claude/commands/grill.md.example +0 -108
- package/templates/root-consumer/.claude/commands/polish.md.example +0 -146
- package/templates/root-consumer/.claude/commands/techdebt.md.example +0 -28
- package/templates/root-consumer/guides/dndev/COMPONENTS_ATOMIC.md.example +0 -180
- package/templates/root-consumer/guides/dndev/COMPONENTS_CRUD.md.example +0 -234
- package/templates/root-consumer/guides/dndev/COMPONENTS_UI.md.example +0 -136
- package/templates/root-consumer/guides/dndev/COMPONENT_API.md.example +0 -195
- package/templates/root-consumer/guides/dndev/ENV_SETUP.md.example +0 -219
- package/templates/root-consumer/guides/dndev/GOTCHAS.md.example +0 -197
- package/templates/root-consumer/guides/dndev/SETUP_APP_CONFIG.md.example +0 -132
- package/templates/root-consumer/guides/dndev/SETUP_BLOG.md.example +0 -280
- package/templates/root-consumer/guides/dndev/SETUP_CICD.md.example +0 -115
- package/templates/root-consumer/guides/dndev/SETUP_CRUD.md.example +0 -334
- package/templates/root-consumer/guides/dndev/SETUP_FUNCTIONS.md.example +0 -9
- package/templates/root-consumer/guides/dndev/SETUP_I18N.md.example +0 -233
- package/templates/root-consumer/guides/dndev/SETUP_LAYOUTS.md.example +0 -158
- package/templates/root-consumer/guides/dndev/SETUP_PAGES.md.example +0 -205
- package/templates/root-consumer/guides/dndev/SETUP_PWA.md.example +0 -213
- package/templates/root-consumer/guides/dndev/SETUP_TESTING.md.example +0 -184
- package/templates/root-consumer/guides/dndev/SETUP_THEMES.md.example +0 -111
- package/templates/root-consumer/guides/dndev/SETUP_VERCEL.md.example +0 -260
- package/templates/root-consumer/guides/dndev/USE_ROUTING.md.example +0 -499
- package/templates/root-consumer/guides/dndev/essences_reference.css.example +0 -288
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Reports & Analytics - Stats, chart placeholders, and export history.
|
|
3
|
+
*
|
|
4
|
+
* Replace chart placeholders with your charting library (Recharts, Chart.js, etc.).
|
|
5
|
+
* Connect stats and export data to your backend.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { useState } from 'react';
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
BarChart3,
|
|
12
|
+
TrendingUp,
|
|
13
|
+
TrendingDown,
|
|
14
|
+
Users,
|
|
15
|
+
ShoppingCart,
|
|
16
|
+
Eye,
|
|
17
|
+
Download,
|
|
18
|
+
} from 'lucide-react';
|
|
19
|
+
|
|
20
|
+
import {
|
|
21
|
+
Section,
|
|
22
|
+
Card,
|
|
23
|
+
Grid,
|
|
24
|
+
Stack,
|
|
25
|
+
Text,
|
|
26
|
+
Select,
|
|
27
|
+
DataTable,
|
|
28
|
+
Badge,
|
|
29
|
+
} from '@donotdev/components';
|
|
30
|
+
import { useTranslation } from '@donotdev/core';
|
|
31
|
+
import type { PageMeta } from '@donotdev/core';
|
|
32
|
+
import { PageContainer } from '@donotdev/ui';
|
|
33
|
+
|
|
34
|
+
// ============================================================================
|
|
35
|
+
// PAGE METADATA
|
|
36
|
+
// ============================================================================
|
|
37
|
+
|
|
38
|
+
export const NAMESPACE = 'reports';
|
|
39
|
+
|
|
40
|
+
export const meta: PageMeta = {
|
|
41
|
+
namespace: NAMESPACE,
|
|
42
|
+
icon: <BarChart3 />,
|
|
43
|
+
auth: { required: true, role: 'admin' },
|
|
44
|
+
preset: 'admin',
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// ============================================================================
|
|
48
|
+
// DATE RANGE OPTIONS
|
|
49
|
+
// ============================================================================
|
|
50
|
+
|
|
51
|
+
const dateRangeOptions = [
|
|
52
|
+
{ value: '7d', label: 'Last 7 days' },
|
|
53
|
+
{ value: '30d', label: 'Last 30 days' },
|
|
54
|
+
{ value: '90d', label: 'Last 90 days' },
|
|
55
|
+
{ value: '12m', label: 'Last 12 months' },
|
|
56
|
+
{ value: 'ytd', label: 'Year to date' },
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
// ============================================================================
|
|
60
|
+
// MOCK DATA - Replace with real analytics hooks
|
|
61
|
+
// ============================================================================
|
|
62
|
+
|
|
63
|
+
const stats = [
|
|
64
|
+
{
|
|
65
|
+
title: 'Page Views',
|
|
66
|
+
value: '124,892',
|
|
67
|
+
trend: '+18.2%',
|
|
68
|
+
positive: true,
|
|
69
|
+
icon: <Eye />,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
title: 'Unique Visitors',
|
|
73
|
+
value: '32,451',
|
|
74
|
+
trend: '+5.7%',
|
|
75
|
+
positive: true,
|
|
76
|
+
icon: <Users />,
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
title: 'Orders',
|
|
80
|
+
value: '1,284',
|
|
81
|
+
trend: '-2.1%',
|
|
82
|
+
positive: false,
|
|
83
|
+
icon: <ShoppingCart />,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
title: 'Revenue',
|
|
87
|
+
value: '$89,420',
|
|
88
|
+
trend: '+12.8%',
|
|
89
|
+
positive: true,
|
|
90
|
+
icon: <TrendingUp />,
|
|
91
|
+
},
|
|
92
|
+
];
|
|
93
|
+
|
|
94
|
+
const recentExports = [
|
|
95
|
+
{ id: '1', name: 'Q4 Revenue Report', format: 'PDF', status: 'completed', date: '2026-03-14', size: '2.4 MB' },
|
|
96
|
+
{ id: '2', name: 'User Growth Analysis', format: 'CSV', status: 'completed', date: '2026-03-13', size: '890 KB' },
|
|
97
|
+
{ id: '3', name: 'Monthly Active Users', format: 'XLSX', status: 'completed', date: '2026-03-12', size: '1.1 MB' },
|
|
98
|
+
{ id: '4', name: 'Conversion Funnel', format: 'PDF', status: 'processing', date: '2026-03-14', size: '-' },
|
|
99
|
+
{ id: '5', name: 'Product Performance', format: 'CSV', status: 'completed', date: '2026-03-10', size: '3.2 MB' },
|
|
100
|
+
{ id: '6', name: 'Customer Segments', format: 'XLSX', status: 'failed', date: '2026-03-09', size: '-' },
|
|
101
|
+
];
|
|
102
|
+
|
|
103
|
+
const exportColumns = [
|
|
104
|
+
{ key: 'name', header: 'Report Name', sortable: true },
|
|
105
|
+
{ key: 'format', header: 'Format', sortable: true },
|
|
106
|
+
{
|
|
107
|
+
key: 'status',
|
|
108
|
+
header: 'Status',
|
|
109
|
+
sortable: true,
|
|
110
|
+
render: (value: string) => {
|
|
111
|
+
const variants: Record<string, string> = {
|
|
112
|
+
completed: 'success',
|
|
113
|
+
processing: 'warning',
|
|
114
|
+
failed: 'destructive',
|
|
115
|
+
};
|
|
116
|
+
return <Badge variant={variants[value] || 'default'}>{value}</Badge>;
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
{ key: 'date', header: 'Date', sortable: true },
|
|
120
|
+
{ key: 'size', header: 'Size', sortable: true },
|
|
121
|
+
];
|
|
122
|
+
|
|
123
|
+
// ============================================================================
|
|
124
|
+
// PAGE COMPONENT
|
|
125
|
+
// ============================================================================
|
|
126
|
+
|
|
127
|
+
export default function ReportsPage() {
|
|
128
|
+
const { t } = useTranslation(NAMESPACE);
|
|
129
|
+
const [dateRange, setDateRange] = useState('30d');
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<PageContainer>
|
|
133
|
+
{/* Date Range Selector */}
|
|
134
|
+
<Section title={t('reportsAnalytics')}>
|
|
135
|
+
<Stack direction="row" align="center" justify="space-between">
|
|
136
|
+
<Text level="body" variant="muted">
|
|
137
|
+
{t('selectPeriod')}
|
|
138
|
+
</Text>
|
|
139
|
+
<Select
|
|
140
|
+
options={dateRangeOptions}
|
|
141
|
+
value={dateRange}
|
|
142
|
+
onValueChange={setDateRange}
|
|
143
|
+
placeholder={t('selectDateRange')}
|
|
144
|
+
/>
|
|
145
|
+
</Stack>
|
|
146
|
+
</Section>
|
|
147
|
+
|
|
148
|
+
{/* Stats Row */}
|
|
149
|
+
<Section title={t('keyMetrics')}>
|
|
150
|
+
<Grid cols={[1, 2, 4, 4]} gap="medium">
|
|
151
|
+
{stats.map((stat) => (
|
|
152
|
+
<Card
|
|
153
|
+
key={stat.title}
|
|
154
|
+
icon={stat.icon}
|
|
155
|
+
title={stat.title}
|
|
156
|
+
elevated
|
|
157
|
+
content={
|
|
158
|
+
<Stack gap="tight">
|
|
159
|
+
<Text level="heading" weight="bold">{stat.value}</Text>
|
|
160
|
+
<Stack direction="row" align="center" gap="tight">
|
|
161
|
+
{stat.positive ? <TrendingUp /> : <TrendingDown />}
|
|
162
|
+
<Text
|
|
163
|
+
level="small"
|
|
164
|
+
variant={stat.positive ? 'success' : 'error'}
|
|
165
|
+
>
|
|
166
|
+
{stat.trend}
|
|
167
|
+
</Text>
|
|
168
|
+
</Stack>
|
|
169
|
+
</Stack>
|
|
170
|
+
}
|
|
171
|
+
/>
|
|
172
|
+
))}
|
|
173
|
+
</Grid>
|
|
174
|
+
</Section>
|
|
175
|
+
|
|
176
|
+
{/* Chart Placeholders */}
|
|
177
|
+
<Section title={t('charts')}>
|
|
178
|
+
<Grid cols={[1, 1, 2, 2]} gap="medium">
|
|
179
|
+
<Card
|
|
180
|
+
title={t('revenueOverTime')}
|
|
181
|
+
elevated
|
|
182
|
+
content={
|
|
183
|
+
<Stack align="center" justify="center" gap="medium">
|
|
184
|
+
<BarChart3 />
|
|
185
|
+
<Text level="body" variant="muted">
|
|
186
|
+
{t('chartPlaceholder')}
|
|
187
|
+
</Text>
|
|
188
|
+
<Text level="small" variant="muted">
|
|
189
|
+
{t('revenueChartLabel')}
|
|
190
|
+
</Text>
|
|
191
|
+
</Stack>
|
|
192
|
+
}
|
|
193
|
+
/>
|
|
194
|
+
|
|
195
|
+
<Card
|
|
196
|
+
title={t('userGrowth')}
|
|
197
|
+
elevated
|
|
198
|
+
content={
|
|
199
|
+
<Stack align="center" justify="center" gap="medium">
|
|
200
|
+
<TrendingUp />
|
|
201
|
+
<Text level="body" variant="muted">
|
|
202
|
+
{t('chartPlaceholder')}
|
|
203
|
+
</Text>
|
|
204
|
+
<Text level="small" variant="muted">
|
|
205
|
+
{t('userGrowthLabel')}
|
|
206
|
+
</Text>
|
|
207
|
+
</Stack>
|
|
208
|
+
}
|
|
209
|
+
/>
|
|
210
|
+
</Grid>
|
|
211
|
+
</Section>
|
|
212
|
+
|
|
213
|
+
{/* Recent Exports */}
|
|
214
|
+
<Section title={t('recentExports')}>
|
|
215
|
+
<DataTable
|
|
216
|
+
data={recentExports}
|
|
217
|
+
columns={exportColumns}
|
|
218
|
+
sortable
|
|
219
|
+
searchable
|
|
220
|
+
pagination
|
|
221
|
+
/>
|
|
222
|
+
</Section>
|
|
223
|
+
</PageContainer>
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// ============================================================================
|
|
228
|
+
// i18n KEYS NEEDED (add to locales/reports_en.json)
|
|
229
|
+
// ============================================================================
|
|
230
|
+
//
|
|
231
|
+
// {
|
|
232
|
+
// "reportsAnalytics": "Reports & Analytics",
|
|
233
|
+
// "selectPeriod": "Select a time period to view metrics",
|
|
234
|
+
// "selectDateRange": "Select date range",
|
|
235
|
+
// "keyMetrics": "Key Metrics",
|
|
236
|
+
// "charts": "Charts",
|
|
237
|
+
// "revenueOverTime": "Revenue Over Time",
|
|
238
|
+
// "userGrowth": "User Growth",
|
|
239
|
+
// "chartPlaceholder": "Chart will render here",
|
|
240
|
+
// "revenueChartLabel": "Monthly revenue breakdown - Jan to Dec",
|
|
241
|
+
// "userGrowthLabel": "New vs returning users - weekly trend",
|
|
242
|
+
// "recentExports": "Recent Exports"
|
|
243
|
+
// }
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview System Settings - General, Security, and Integrations tabs.
|
|
3
|
+
*
|
|
4
|
+
* Wire up form state to your settings store or API.
|
|
5
|
+
* Switch/Select onChange handlers should persist settings.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { useState } from 'react';
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
Settings,
|
|
12
|
+
Shield,
|
|
13
|
+
Plug,
|
|
14
|
+
CreditCard,
|
|
15
|
+
Mail,
|
|
16
|
+
BarChart3,
|
|
17
|
+
} from 'lucide-react';
|
|
18
|
+
|
|
19
|
+
import {
|
|
20
|
+
Section,
|
|
21
|
+
Card,
|
|
22
|
+
Grid,
|
|
23
|
+
Stack,
|
|
24
|
+
Text,
|
|
25
|
+
Tabs,
|
|
26
|
+
Input,
|
|
27
|
+
Select,
|
|
28
|
+
Switch,
|
|
29
|
+
Button,
|
|
30
|
+
Badge,
|
|
31
|
+
Separator,
|
|
32
|
+
} from '@donotdev/components';
|
|
33
|
+
import { useTranslation } from '@donotdev/core';
|
|
34
|
+
import type { PageMeta } from '@donotdev/core';
|
|
35
|
+
import { PageContainer } from '@donotdev/ui';
|
|
36
|
+
|
|
37
|
+
// ============================================================================
|
|
38
|
+
// PAGE METADATA
|
|
39
|
+
// ============================================================================
|
|
40
|
+
|
|
41
|
+
export const NAMESPACE = 'settings';
|
|
42
|
+
|
|
43
|
+
export const meta: PageMeta = {
|
|
44
|
+
namespace: NAMESPACE,
|
|
45
|
+
icon: <Settings />,
|
|
46
|
+
auth: { required: true, role: 'admin' },
|
|
47
|
+
preset: 'admin',
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// ============================================================================
|
|
51
|
+
// SELECT OPTIONS
|
|
52
|
+
// ============================================================================
|
|
53
|
+
|
|
54
|
+
const timezoneOptions = [
|
|
55
|
+
{ value: 'utc', label: 'UTC' },
|
|
56
|
+
{ value: 'est', label: 'Eastern (EST)' },
|
|
57
|
+
{ value: 'cst', label: 'Central (CST)' },
|
|
58
|
+
{ value: 'pst', label: 'Pacific (PST)' },
|
|
59
|
+
{ value: 'cet', label: 'Central European (CET)' },
|
|
60
|
+
{ value: 'jst', label: 'Japan (JST)' },
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
const languageOptions = [
|
|
64
|
+
{ value: 'en', label: 'English' },
|
|
65
|
+
{ value: 'fr', label: 'French' },
|
|
66
|
+
{ value: 'es', label: 'Spanish' },
|
|
67
|
+
{ value: 'de', label: 'German' },
|
|
68
|
+
{ value: 'ja', label: 'Japanese' },
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
const sessionTimeoutOptions = [
|
|
72
|
+
{ value: '15', label: '15 minutes' },
|
|
73
|
+
{ value: '30', label: '30 minutes' },
|
|
74
|
+
{ value: '60', label: '1 hour' },
|
|
75
|
+
{ value: '120', label: '2 hours' },
|
|
76
|
+
{ value: '480', label: '8 hours' },
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
// ============================================================================
|
|
80
|
+
// TAB CONTENT COMPONENTS
|
|
81
|
+
// ============================================================================
|
|
82
|
+
|
|
83
|
+
function GeneralTab() {
|
|
84
|
+
const { t } = useTranslation(NAMESPACE);
|
|
85
|
+
const [timezone, setTimezone] = useState('utc');
|
|
86
|
+
const [language, setLanguage] = useState('en');
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<Stack gap="large">
|
|
90
|
+
<Input
|
|
91
|
+
label={t('appName')}
|
|
92
|
+
placeholder="{{appName}}"
|
|
93
|
+
icon={<Settings />}
|
|
94
|
+
/>
|
|
95
|
+
|
|
96
|
+
<Select
|
|
97
|
+
label={t('timezone')}
|
|
98
|
+
options={timezoneOptions}
|
|
99
|
+
value={timezone}
|
|
100
|
+
onValueChange={setTimezone}
|
|
101
|
+
placeholder={t('selectTimezone')}
|
|
102
|
+
/>
|
|
103
|
+
|
|
104
|
+
<Select
|
|
105
|
+
label={t('language')}
|
|
106
|
+
options={languageOptions}
|
|
107
|
+
value={language}
|
|
108
|
+
onValueChange={setLanguage}
|
|
109
|
+
placeholder={t('selectLanguage')}
|
|
110
|
+
/>
|
|
111
|
+
|
|
112
|
+
<Separator />
|
|
113
|
+
|
|
114
|
+
<Stack direction="row" justify="end">
|
|
115
|
+
<Button variant="primary">{t('saveChanges')}</Button>
|
|
116
|
+
</Stack>
|
|
117
|
+
</Stack>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function SecurityTab() {
|
|
122
|
+
const { t } = useTranslation(NAMESPACE);
|
|
123
|
+
const [twoFactor, setTwoFactor] = useState(false);
|
|
124
|
+
const [sessionTimeout, setSessionTimeout] = useState('60');
|
|
125
|
+
const [enforceUppercase, setEnforceUppercase] = useState(true);
|
|
126
|
+
const [enforceNumbers, setEnforceNumbers] = useState(true);
|
|
127
|
+
const [enforceSpecial, setEnforceSpecial] = useState(false);
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<Stack gap="large">
|
|
131
|
+
<Section title={t('authentication')}>
|
|
132
|
+
<Stack gap="medium">
|
|
133
|
+
<Stack direction="row" align="center" justify="space-between">
|
|
134
|
+
<Stack gap="none">
|
|
135
|
+
<Text level="body" weight="bold">{t('twoFactorAuth')}</Text>
|
|
136
|
+
<Text level="small" variant="muted">{t('twoFactorDescription')}</Text>
|
|
137
|
+
</Stack>
|
|
138
|
+
<Switch checked={twoFactor} onCheckedChange={setTwoFactor} />
|
|
139
|
+
</Stack>
|
|
140
|
+
|
|
141
|
+
<Select
|
|
142
|
+
label={t('sessionTimeout')}
|
|
143
|
+
options={sessionTimeoutOptions}
|
|
144
|
+
value={sessionTimeout}
|
|
145
|
+
onValueChange={setSessionTimeout}
|
|
146
|
+
placeholder={t('selectTimeout')}
|
|
147
|
+
/>
|
|
148
|
+
</Stack>
|
|
149
|
+
</Section>
|
|
150
|
+
|
|
151
|
+
<Separator />
|
|
152
|
+
|
|
153
|
+
<Section title={t('passwordPolicy')}>
|
|
154
|
+
<Stack gap="medium">
|
|
155
|
+
<Stack direction="row" align="center" justify="space-between">
|
|
156
|
+
<Text level="body">{t('requireUppercase')}</Text>
|
|
157
|
+
<Switch checked={enforceUppercase} onCheckedChange={setEnforceUppercase} />
|
|
158
|
+
</Stack>
|
|
159
|
+
|
|
160
|
+
<Stack direction="row" align="center" justify="space-between">
|
|
161
|
+
<Text level="body">{t('requireNumbers')}</Text>
|
|
162
|
+
<Switch checked={enforceNumbers} onCheckedChange={setEnforceNumbers} />
|
|
163
|
+
</Stack>
|
|
164
|
+
|
|
165
|
+
<Stack direction="row" align="center" justify="space-between">
|
|
166
|
+
<Text level="body">{t('requireSpecialChars')}</Text>
|
|
167
|
+
<Switch checked={enforceSpecial} onCheckedChange={setEnforceSpecial} />
|
|
168
|
+
</Stack>
|
|
169
|
+
</Stack>
|
|
170
|
+
</Section>
|
|
171
|
+
|
|
172
|
+
<Separator />
|
|
173
|
+
|
|
174
|
+
<Stack direction="row" justify="end">
|
|
175
|
+
<Button variant="primary">{t('saveChanges')}</Button>
|
|
176
|
+
</Stack>
|
|
177
|
+
</Stack>
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function IntegrationsTab() {
|
|
182
|
+
const { t } = useTranslation(NAMESPACE);
|
|
183
|
+
|
|
184
|
+
const integrations = [
|
|
185
|
+
{
|
|
186
|
+
name: 'Stripe',
|
|
187
|
+
description: t('stripeDescription'),
|
|
188
|
+
icon: <CreditCard />,
|
|
189
|
+
status: 'connected',
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
name: 'SendGrid',
|
|
193
|
+
description: t('sendgridDescription'),
|
|
194
|
+
icon: <Mail />,
|
|
195
|
+
status: 'disconnected',
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
name: 'Analytics',
|
|
199
|
+
description: t('analyticsDescription'),
|
|
200
|
+
icon: <BarChart3 />,
|
|
201
|
+
status: 'connected',
|
|
202
|
+
},
|
|
203
|
+
];
|
|
204
|
+
|
|
205
|
+
return (
|
|
206
|
+
<Grid cols={[1, 1, 2, 3]} gap="medium">
|
|
207
|
+
{integrations.map((integration) => (
|
|
208
|
+
<Card
|
|
209
|
+
key={integration.name}
|
|
210
|
+
icon={integration.icon}
|
|
211
|
+
title={integration.name}
|
|
212
|
+
subtitle={integration.description}
|
|
213
|
+
elevated
|
|
214
|
+
content={
|
|
215
|
+
<Stack direction="row" align="center" justify="space-between">
|
|
216
|
+
<Badge
|
|
217
|
+
variant={integration.status === 'connected' ? 'success' : 'secondary'}
|
|
218
|
+
>
|
|
219
|
+
{integration.status}
|
|
220
|
+
</Badge>
|
|
221
|
+
<Button variant="outline">
|
|
222
|
+
{integration.status === 'connected' ? t('configure') : t('connect')}
|
|
223
|
+
</Button>
|
|
224
|
+
</Stack>
|
|
225
|
+
}
|
|
226
|
+
/>
|
|
227
|
+
))}
|
|
228
|
+
</Grid>
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// ============================================================================
|
|
233
|
+
// PAGE COMPONENT
|
|
234
|
+
// ============================================================================
|
|
235
|
+
|
|
236
|
+
export default function SettingsPage() {
|
|
237
|
+
const { t } = useTranslation(NAMESPACE);
|
|
238
|
+
|
|
239
|
+
const tabItems = [
|
|
240
|
+
{ value: 'general', label: t('general'), content: <GeneralTab /> },
|
|
241
|
+
{ value: 'security', label: t('security'), content: <SecurityTab /> },
|
|
242
|
+
{ value: 'integrations', label: t('integrations'), content: <IntegrationsTab /> },
|
|
243
|
+
];
|
|
244
|
+
|
|
245
|
+
return (
|
|
246
|
+
<PageContainer>
|
|
247
|
+
<Section title={t('systemSettings')}>
|
|
248
|
+
<Tabs items={tabItems} defaultValue="general" />
|
|
249
|
+
</Section>
|
|
250
|
+
</PageContainer>
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// ============================================================================
|
|
255
|
+
// i18n KEYS NEEDED (add to locales/settings_en.json)
|
|
256
|
+
// ============================================================================
|
|
257
|
+
//
|
|
258
|
+
// {
|
|
259
|
+
// "systemSettings": "System Settings",
|
|
260
|
+
// "general": "General",
|
|
261
|
+
// "security": "Security",
|
|
262
|
+
// "integrations": "Integrations",
|
|
263
|
+
// "appName": "Application Name",
|
|
264
|
+
// "timezone": "Timezone",
|
|
265
|
+
// "selectTimezone": "Select timezone",
|
|
266
|
+
// "language": "Default Language",
|
|
267
|
+
// "selectLanguage": "Select language",
|
|
268
|
+
// "saveChanges": "Save Changes",
|
|
269
|
+
// "authentication": "Authentication",
|
|
270
|
+
// "twoFactorAuth": "Two-Factor Authentication",
|
|
271
|
+
// "twoFactorDescription": "Require 2FA for all admin accounts",
|
|
272
|
+
// "sessionTimeout": "Session Timeout",
|
|
273
|
+
// "selectTimeout": "Select timeout duration",
|
|
274
|
+
// "passwordPolicy": "Password Policy",
|
|
275
|
+
// "requireUppercase": "Require uppercase letters",
|
|
276
|
+
// "requireNumbers": "Require numbers",
|
|
277
|
+
// "requireSpecialChars": "Require special characters",
|
|
278
|
+
// "stripeDescription": "Payment processing and subscriptions",
|
|
279
|
+
// "sendgridDescription": "Transactional and marketing emails",
|
|
280
|
+
// "analyticsDescription": "Usage tracking and insights",
|
|
281
|
+
// "configure": "Configure",
|
|
282
|
+
// "connect": "Connect"
|
|
283
|
+
// }
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview User Management - DataTable with search, sort, pagination, export.
|
|
3
|
+
*
|
|
4
|
+
* Replace mock data with useCrudList for live user data.
|
|
5
|
+
* Column definitions should match your user entity fields.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { Users } from 'lucide-react';
|
|
9
|
+
|
|
10
|
+
import { Section, DataTable, Badge } from '@donotdev/components';
|
|
11
|
+
import { useTranslation } from '@donotdev/core';
|
|
12
|
+
import type { PageMeta } from '@donotdev/core';
|
|
13
|
+
import { PageContainer } from '@donotdev/ui';
|
|
14
|
+
|
|
15
|
+
// ============================================================================
|
|
16
|
+
// PAGE METADATA
|
|
17
|
+
// ============================================================================
|
|
18
|
+
|
|
19
|
+
export const NAMESPACE = 'users';
|
|
20
|
+
|
|
21
|
+
export const meta: PageMeta = {
|
|
22
|
+
namespace: NAMESPACE,
|
|
23
|
+
icon: <Users />,
|
|
24
|
+
auth: { required: true, role: 'admin' },
|
|
25
|
+
preset: 'admin',
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// ============================================================================
|
|
29
|
+
// MOCK DATA - Replace with useCrudList(userEntity)
|
|
30
|
+
// ============================================================================
|
|
31
|
+
|
|
32
|
+
const users = [
|
|
33
|
+
{ id: '1', name: 'Alice Martin', email: 'alice@example.com', role: 'admin', status: 'active', joined: '2025-01-15' },
|
|
34
|
+
{ id: '2', name: 'Bob Chen', email: 'bob@example.com', role: 'editor', status: 'active', joined: '2025-02-03' },
|
|
35
|
+
{ id: '3', name: 'Clara Dupont', email: 'clara@example.com', role: 'viewer', status: 'active', joined: '2025-02-18' },
|
|
36
|
+
{ id: '4', name: 'David Kim', email: 'david@example.com', role: 'editor', status: 'inactive', joined: '2025-03-01' },
|
|
37
|
+
{ id: '5', name: 'Eva Schmidt', email: 'eva@example.com', role: 'admin', status: 'active', joined: '2025-03-12' },
|
|
38
|
+
{ id: '6', name: 'Frank Rossi', email: 'frank@example.com', role: 'viewer', status: 'pending', joined: '2025-04-05' },
|
|
39
|
+
{ id: '7', name: 'Grace Tanaka', email: 'grace@example.com', role: 'editor', status: 'active', joined: '2025-04-20' },
|
|
40
|
+
{ id: '8', name: 'Hugo Larsen', email: 'hugo@example.com', role: 'viewer', status: 'inactive', joined: '2025-05-08' },
|
|
41
|
+
{ id: '9', name: 'Iris Moreau', email: 'iris@example.com', role: 'admin', status: 'active', joined: '2025-06-14' },
|
|
42
|
+
{ id: '10', name: 'Jamal Osei', email: 'jamal@example.com', role: 'editor', status: 'pending', joined: '2025-07-01' },
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
// ============================================================================
|
|
46
|
+
// COLUMN DEFINITIONS
|
|
47
|
+
// ============================================================================
|
|
48
|
+
|
|
49
|
+
const roleBadgeVariant: Record<string, string> = {
|
|
50
|
+
admin: 'destructive',
|
|
51
|
+
editor: 'default',
|
|
52
|
+
viewer: 'secondary',
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const statusBadgeVariant: Record<string, string> = {
|
|
56
|
+
active: 'success',
|
|
57
|
+
inactive: 'secondary',
|
|
58
|
+
pending: 'warning',
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const columns = [
|
|
62
|
+
{
|
|
63
|
+
key: 'name',
|
|
64
|
+
header: 'Name',
|
|
65
|
+
sortable: true,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
key: 'email',
|
|
69
|
+
header: 'Email',
|
|
70
|
+
sortable: true,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
key: 'role',
|
|
74
|
+
header: 'Role',
|
|
75
|
+
sortable: true,
|
|
76
|
+
render: (value: string) => (
|
|
77
|
+
<Badge variant={roleBadgeVariant[value] || 'default'}>{value}</Badge>
|
|
78
|
+
),
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
key: 'status',
|
|
82
|
+
header: 'Status',
|
|
83
|
+
sortable: true,
|
|
84
|
+
render: (value: string) => (
|
|
85
|
+
<Badge variant={statusBadgeVariant[value] || 'default'}>{value}</Badge>
|
|
86
|
+
),
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
key: 'joined',
|
|
90
|
+
header: 'Joined',
|
|
91
|
+
sortable: true,
|
|
92
|
+
},
|
|
93
|
+
];
|
|
94
|
+
|
|
95
|
+
// ============================================================================
|
|
96
|
+
// PAGE COMPONENT
|
|
97
|
+
// ============================================================================
|
|
98
|
+
|
|
99
|
+
export default function UsersPage() {
|
|
100
|
+
const { t } = useTranslation(NAMESPACE);
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<PageContainer>
|
|
104
|
+
<Section title={t('userManagement')}>
|
|
105
|
+
<DataTable
|
|
106
|
+
data={users}
|
|
107
|
+
columns={columns}
|
|
108
|
+
sortable
|
|
109
|
+
searchable
|
|
110
|
+
pagination
|
|
111
|
+
exportable
|
|
112
|
+
onRowClick={(row) => {
|
|
113
|
+
// Navigate to user detail/edit page
|
|
114
|
+
// e.g., navigate(`/users/${row.id}`)
|
|
115
|
+
}}
|
|
116
|
+
/>
|
|
117
|
+
</Section>
|
|
118
|
+
</PageContainer>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// ============================================================================
|
|
123
|
+
// i18n KEYS NEEDED (add to locales/users_en.json)
|
|
124
|
+
// ============================================================================
|
|
125
|
+
//
|
|
126
|
+
// {
|
|
127
|
+
// "userManagement": "User Management"
|
|
128
|
+
// }
|