@donotdev/cli 0.0.36 → 0.1.0
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 +24 -24
- package/dist/bin/commands/agent-setup.js +6965 -125
- package/dist/bin/commands/build.js +6 -3
- package/dist/bin/commands/bump.js +35 -15
- package/dist/bin/commands/cacheout.js +19 -3
- package/dist/bin/commands/coach.js +6 -3
- package/dist/bin/commands/create-app.js +18 -4
- package/dist/bin/commands/create-project.js +19 -5
- package/dist/bin/commands/db.js +1700 -3786
- package/dist/bin/commands/deploy.js +144 -98
- package/dist/bin/commands/dev.js +8 -7
- package/dist/bin/commands/doctor.js +6 -3
- package/dist/bin/commands/emu.js +8 -7
- package/dist/bin/commands/format.js +7 -5
- package/dist/bin/commands/get-demo.js +18 -4
- package/dist/bin/commands/make-admin.js +1809 -179
- package/dist/bin/commands/preview.js +8 -7
- package/dist/bin/commands/seed.js +1700 -3786
- package/dist/bin/commands/setup-cicd.js +6 -3
- package/dist/bin/commands/setup.js +23 -20
- package/dist/bin/commands/staging.js +144 -98
- package/dist/bin/commands/sync-secrets.js +6 -3
- package/dist/bin/commands/type-check.js +6 -3
- package/dist/bin/commands/wai.js +6 -3
- package/dist/bin/dndev.js +21 -1
- package/dist/bin/donotdev.js +21 -1
- package/dist/index.js +172 -107
- package/package.json +2 -2
- package/templates/app-next/src/locales/home_en.json.example +6 -6
- package/templates/app-vite/src/locales/home_en.json.example +6 -6
- 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/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/commands/brainstorm.md.example +28 -0
- package/templates/root-consumer/.claude/commands/design.md.example +31 -0
- package/templates/root-consumer/.claude/commands/grill.md.example +33 -6
- package/templates/root-consumer/.claude/skills/brainstorm/SKILL.md.example +16 -0
- package/templates/root-consumer/.claude/skills/build/SKILL.md.example +50 -0
- package/templates/root-consumer/.claude/skills/design/SKILL.md.example +17 -0
- package/templates/root-consumer/.claude/skills/grill/SKILL.md.example +11 -5
- package/templates/root-consumer/guides/dndev/SETUP_OAUTH.md.example +2 -1
- package/templates/root-consumer/guides/dndev/advanced/COOKIE_REFERENCE.md.example +252 -252
- package/templates/root-consumer/guides/dndev/advanced/VERSION_CONTROL.md.example +174 -174
|
@@ -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
|
+
// }
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
// {{appName}} - Cart Page
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
ShoppingCart,
|
|
6
|
+
Trash2,
|
|
7
|
+
} from 'lucide-react';
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
Button,
|
|
11
|
+
BUTTON_VARIANT,
|
|
12
|
+
Card,
|
|
13
|
+
CARD_VARIANT,
|
|
14
|
+
Grid,
|
|
15
|
+
Section,
|
|
16
|
+
Separator,
|
|
17
|
+
Stack,
|
|
18
|
+
Text,
|
|
19
|
+
} from '@donotdev/components';
|
|
20
|
+
import { useTranslation } from '@donotdev/core';
|
|
21
|
+
import { Link, PageContainer } from '@donotdev/ui';
|
|
22
|
+
|
|
23
|
+
import type { PageMeta } from '@donotdev/core';
|
|
24
|
+
|
|
25
|
+
export const NAMESPACE = 'cart';
|
|
26
|
+
|
|
27
|
+
export const meta: PageMeta = {
|
|
28
|
+
namespace: NAMESPACE,
|
|
29
|
+
icon: <ShoppingCart />,
|
|
30
|
+
auth: true,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const cartItems = [
|
|
34
|
+
{
|
|
35
|
+
id: 1,
|
|
36
|
+
name: 'Wireless Noise-Cancelling Headphones',
|
|
37
|
+
variant: 'Midnight Black',
|
|
38
|
+
quantity: 1,
|
|
39
|
+
price: 149.99,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: 3,
|
|
43
|
+
name: 'Leather Crossbody Bag',
|
|
44
|
+
variant: 'Tan',
|
|
45
|
+
quantity: 1,
|
|
46
|
+
price: 119.0,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: 6,
|
|
50
|
+
name: 'Smart Fitness Watch',
|
|
51
|
+
variant: 'Space Grey',
|
|
52
|
+
quantity: 2,
|
|
53
|
+
price: 199.0,
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
export default function CartPage() {
|
|
58
|
+
const { t } = useTranslation(NAMESPACE);
|
|
59
|
+
|
|
60
|
+
const subtotal = cartItems.reduce((sum, item) => sum + item.price * item.quantity, 0);
|
|
61
|
+
const shipping = subtotal > 50 ? 0 : 5.99;
|
|
62
|
+
const tax = subtotal * 0.2;
|
|
63
|
+
const total = subtotal + shipping + tax;
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<PageContainer>
|
|
67
|
+
<Section title={t('cart.title', 'Your Cart')}>
|
|
68
|
+
<Grid cols={[1, 1, 3, 3]} gap="large">
|
|
69
|
+
<Stack gap="medium" width="full" style={{ gridColumn: 'span 2' }}>
|
|
70
|
+
{cartItems.map((item) => (
|
|
71
|
+
<Card key={item.id}>
|
|
72
|
+
<Stack
|
|
73
|
+
direction="row"
|
|
74
|
+
justify="space-between"
|
|
75
|
+
align="center"
|
|
76
|
+
gap="medium"
|
|
77
|
+
style={{ padding: 'var(--gap-md)' }}
|
|
78
|
+
>
|
|
79
|
+
<Stack gap="tight">
|
|
80
|
+
<Text level="body" weight="semibold">
|
|
81
|
+
{item.name}
|
|
82
|
+
</Text>
|
|
83
|
+
<Text level="caption" variant="muted">
|
|
84
|
+
{item.variant}
|
|
85
|
+
</Text>
|
|
86
|
+
<Text level="small">
|
|
87
|
+
{t('cart.quantity', 'Qty')}: {item.quantity}
|
|
88
|
+
</Text>
|
|
89
|
+
</Stack>
|
|
90
|
+
<Stack align="end" gap="tight">
|
|
91
|
+
<Text level="body" weight="semibold">
|
|
92
|
+
{(item.price * item.quantity).toFixed(2)} EUR
|
|
93
|
+
</Text>
|
|
94
|
+
<Button variant={BUTTON_VARIANT.GHOST} icon={<Trash2 />}>
|
|
95
|
+
{t('cart.remove', 'Remove')}
|
|
96
|
+
</Button>
|
|
97
|
+
</Stack>
|
|
98
|
+
</Stack>
|
|
99
|
+
</Card>
|
|
100
|
+
))}
|
|
101
|
+
|
|
102
|
+
{cartItems.length === 0 && (
|
|
103
|
+
<Card
|
|
104
|
+
variant={CARD_VARIANT.GLASS}
|
|
105
|
+
title={t('cart.empty.title', 'Your cart is empty')}
|
|
106
|
+
content={t('cart.empty.description', 'Browse our catalog to find products you will love.')}
|
|
107
|
+
footer={
|
|
108
|
+
<Link path="/catalog">
|
|
109
|
+
<Button variant={BUTTON_VARIANT.PRIMARY}>
|
|
110
|
+
{t('cart.empty.browse', 'Browse Catalog')}
|
|
111
|
+
</Button>
|
|
112
|
+
</Link>
|
|
113
|
+
}
|
|
114
|
+
/>
|
|
115
|
+
)}
|
|
116
|
+
</Stack>
|
|
117
|
+
|
|
118
|
+
<Card
|
|
119
|
+
variant={CARD_VARIANT.ACCENT}
|
|
120
|
+
title={t('cart.summary.title', 'Order Summary')}
|
|
121
|
+
>
|
|
122
|
+
<Stack gap="medium" style={{ padding: 'var(--gap-md)' }}>
|
|
123
|
+
<Stack gap="tight">
|
|
124
|
+
<Stack direction="row" justify="space-between">
|
|
125
|
+
<Text level="small">{t('cart.summary.subtotal', 'Subtotal')}</Text>
|
|
126
|
+
<Text level="small">{subtotal.toFixed(2)} EUR</Text>
|
|
127
|
+
</Stack>
|
|
128
|
+
<Stack direction="row" justify="space-between">
|
|
129
|
+
<Text level="small">{t('cart.summary.shipping', 'Shipping')}</Text>
|
|
130
|
+
<Text level="small" variant={shipping === 0 ? 'success' : 'default'}>
|
|
131
|
+
{shipping === 0
|
|
132
|
+
? t('cart.summary.freeShipping', 'Free')
|
|
133
|
+
: `${shipping.toFixed(2)} EUR`}
|
|
134
|
+
</Text>
|
|
135
|
+
</Stack>
|
|
136
|
+
<Stack direction="row" justify="space-between">
|
|
137
|
+
<Text level="small">{t('cart.summary.tax', 'Tax (20%)')}</Text>
|
|
138
|
+
<Text level="small">{tax.toFixed(2)} EUR</Text>
|
|
139
|
+
</Stack>
|
|
140
|
+
</Stack>
|
|
141
|
+
|
|
142
|
+
<Separator />
|
|
143
|
+
|
|
144
|
+
<Stack direction="row" justify="space-between">
|
|
145
|
+
<Text level="body" weight="semibold">{t('cart.summary.total', 'Total')}</Text>
|
|
146
|
+
<Text level="body" weight="semibold">{total.toFixed(2)} EUR</Text>
|
|
147
|
+
</Stack>
|
|
148
|
+
|
|
149
|
+
<Stack gap="tight">
|
|
150
|
+
<Link path="/checkout">
|
|
151
|
+
<Button variant={BUTTON_VARIANT.PRIMARY} fullWidth>
|
|
152
|
+
{t('cart.summary.checkout', 'Proceed to Checkout')}
|
|
153
|
+
</Button>
|
|
154
|
+
</Link>
|
|
155
|
+
<Link path="/catalog">
|
|
156
|
+
<Button variant={BUTTON_VARIANT.GHOST} fullWidth>
|
|
157
|
+
{t('cart.summary.continue', 'Continue Shopping')}
|
|
158
|
+
</Button>
|
|
159
|
+
</Link>
|
|
160
|
+
</Stack>
|
|
161
|
+
</Stack>
|
|
162
|
+
</Card>
|
|
163
|
+
</Grid>
|
|
164
|
+
</Section>
|
|
165
|
+
</PageContainer>
|
|
166
|
+
);
|
|
167
|
+
}
|