@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,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
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
// {{appName}} - Catalog Page
|
|
3
|
+
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
LayoutGrid,
|
|
8
|
+
Search,
|
|
9
|
+
ShoppingCart,
|
|
10
|
+
} from 'lucide-react';
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
Button,
|
|
14
|
+
BUTTON_VARIANT,
|
|
15
|
+
Card,
|
|
16
|
+
CARD_VARIANT,
|
|
17
|
+
Grid,
|
|
18
|
+
Input,
|
|
19
|
+
Section,
|
|
20
|
+
Select,
|
|
21
|
+
Stack,
|
|
22
|
+
Text,
|
|
23
|
+
} from '@donotdev/components';
|
|
24
|
+
import { useTranslation } from '@donotdev/core';
|
|
25
|
+
import { Link, PageContainer } from '@donotdev/ui';
|
|
26
|
+
|
|
27
|
+
import type { PageMeta } from '@donotdev/core';
|
|
28
|
+
|
|
29
|
+
export const NAMESPACE = 'catalog';
|
|
30
|
+
|
|
31
|
+
export const meta: PageMeta = {
|
|
32
|
+
namespace: NAMESPACE,
|
|
33
|
+
icon: <LayoutGrid />,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const products = [
|
|
37
|
+
{
|
|
38
|
+
id: 1,
|
|
39
|
+
name: 'Wireless Noise-Cancelling Headphones',
|
|
40
|
+
price: '149.99',
|
|
41
|
+
category: 'electronics',
|
|
42
|
+
description: 'Premium sound with active noise cancellation and 30-hour battery life.',
|
|
43
|
+
available: true,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: 2,
|
|
47
|
+
name: 'Merino Wool Overcoat',
|
|
48
|
+
price: '289.00',
|
|
49
|
+
category: 'clothing',
|
|
50
|
+
description: 'Timeless silhouette in soft Italian merino wool. Warm, breathable, elegant.',
|
|
51
|
+
available: true,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: 3,
|
|
55
|
+
name: 'Leather Crossbody Bag',
|
|
56
|
+
price: '119.00',
|
|
57
|
+
category: 'accessories',
|
|
58
|
+
description: 'Full-grain leather with adjustable strap. Fits essentials and a tablet.',
|
|
59
|
+
available: true,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: 4,
|
|
63
|
+
name: 'Ceramic Table Lamp',
|
|
64
|
+
price: '79.50',
|
|
65
|
+
category: 'home',
|
|
66
|
+
description: 'Handcrafted ceramic base with linen shade. Warm ambient lighting.',
|
|
67
|
+
available: true,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: 5,
|
|
71
|
+
name: 'Ultralight Running Shoes',
|
|
72
|
+
price: '134.00',
|
|
73
|
+
category: 'clothing',
|
|
74
|
+
description: 'Engineered mesh upper with responsive cushioning. Only 210g per shoe.',
|
|
75
|
+
available: false,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: 6,
|
|
79
|
+
name: 'Smart Fitness Watch',
|
|
80
|
+
price: '199.00',
|
|
81
|
+
category: 'electronics',
|
|
82
|
+
description: 'Heart rate, GPS, sleep tracking, and 7-day battery in a sleek design.',
|
|
83
|
+
available: true,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: 7,
|
|
87
|
+
name: 'Minimalist Titanium Wallet',
|
|
88
|
+
price: '59.00',
|
|
89
|
+
category: 'accessories',
|
|
90
|
+
description: 'RFID-blocking titanium card holder. Holds up to 12 cards, weighs 45g.',
|
|
91
|
+
available: true,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
id: 8,
|
|
95
|
+
name: 'Oak Standing Desk',
|
|
96
|
+
price: '549.00',
|
|
97
|
+
category: 'home',
|
|
98
|
+
description: 'Solid oak top with motorized height adjustment. Whisper-quiet motor.',
|
|
99
|
+
available: true,
|
|
100
|
+
},
|
|
101
|
+
];
|
|
102
|
+
|
|
103
|
+
const categoryOptions = [
|
|
104
|
+
{ value: 'all', label: 'All Categories' },
|
|
105
|
+
{ value: 'electronics', label: 'Electronics' },
|
|
106
|
+
{ value: 'clothing', label: 'Clothing' },
|
|
107
|
+
{ value: 'accessories', label: 'Accessories' },
|
|
108
|
+
{ value: 'home', label: 'Home & Living' },
|
|
109
|
+
];
|
|
110
|
+
|
|
111
|
+
const sortOptions = [
|
|
112
|
+
{ value: 'popular', label: 'Most Popular' },
|
|
113
|
+
{ value: 'newest', label: 'Newest First' },
|
|
114
|
+
{ value: 'price-asc', label: 'Price: Low to High' },
|
|
115
|
+
{ value: 'price-desc', label: 'Price: High to Low' },
|
|
116
|
+
];
|
|
117
|
+
|
|
118
|
+
export default function CatalogPage() {
|
|
119
|
+
const { t } = useTranslation(NAMESPACE);
|
|
120
|
+
const [category, setCategory] = useState('all');
|
|
121
|
+
const [sort, setSort] = useState('popular');
|
|
122
|
+
const [search, setSearch] = useState('');
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
<PageContainer>
|
|
126
|
+
<Section title={t('catalog.title', 'Product Catalog')}>
|
|
127
|
+
<Stack gap="large">
|
|
128
|
+
<Stack direction="row" gap="medium" wrap align="end">
|
|
129
|
+
<Select
|
|
130
|
+
label={t('catalog.filters.category', 'Category')}
|
|
131
|
+
options={categoryOptions}
|
|
132
|
+
value={category}
|
|
133
|
+
onValueChange={setCategory}
|
|
134
|
+
placeholder={t('catalog.filters.categoryPlaceholder', 'Select category')}
|
|
135
|
+
/>
|
|
136
|
+
<Select
|
|
137
|
+
label={t('catalog.filters.sort', 'Sort By')}
|
|
138
|
+
options={sortOptions}
|
|
139
|
+
value={sort}
|
|
140
|
+
onValueChange={setSort}
|
|
141
|
+
placeholder={t('catalog.filters.sortPlaceholder', 'Sort by')}
|
|
142
|
+
/>
|
|
143
|
+
<Input
|
|
144
|
+
icon={<Search />}
|
|
145
|
+
label={t('catalog.filters.search', 'Search')}
|
|
146
|
+
placeholder={t('catalog.filters.searchPlaceholder', 'Search products...')}
|
|
147
|
+
/>
|
|
148
|
+
</Stack>
|
|
149
|
+
|
|
150
|
+
<Grid cols={[1, 2, 3, 4]} gap="medium">
|
|
151
|
+
{products.map((product) => (
|
|
152
|
+
<Card
|
|
153
|
+
key={product.id}
|
|
154
|
+
variant={product.available ? CARD_VARIANT.DEFAULT : CARD_VARIANT.GLASS}
|
|
155
|
+
title={product.name}
|
|
156
|
+
subtitle={`${product.price} EUR`}
|
|
157
|
+
content={product.description}
|
|
158
|
+
footer={
|
|
159
|
+
<Stack gap="tight">
|
|
160
|
+
<Button
|
|
161
|
+
variant={BUTTON_VARIANT.PRIMARY}
|
|
162
|
+
icon={<ShoppingCart />}
|
|
163
|
+
fullWidth
|
|
164
|
+
loading={!product.available}
|
|
165
|
+
display={product.available
|
|
166
|
+
? t('catalog.addToCart', 'Add to Cart')
|
|
167
|
+
: t('catalog.outOfStock', 'Out of Stock')}
|
|
168
|
+
>
|
|
169
|
+
{product.available
|
|
170
|
+
? t('catalog.addToCart', 'Add to Cart')
|
|
171
|
+
: t('catalog.outOfStock', 'Out of Stock')}
|
|
172
|
+
</Button>
|
|
173
|
+
<Link path={`/products/${product.id}`}>
|
|
174
|
+
<Button variant={BUTTON_VARIANT.GHOST} fullWidth>
|
|
175
|
+
{t('catalog.viewDetails', 'View Details')}
|
|
176
|
+
</Button>
|
|
177
|
+
</Link>
|
|
178
|
+
</Stack>
|
|
179
|
+
}
|
|
180
|
+
/>
|
|
181
|
+
))}
|
|
182
|
+
</Grid>
|
|
183
|
+
</Stack>
|
|
184
|
+
</Section>
|
|
185
|
+
</PageContainer>
|
|
186
|
+
);
|
|
187
|
+
}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
// {{appName}} - Checkout Page
|
|
3
|
+
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
CreditCard,
|
|
8
|
+
} from 'lucide-react';
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
Alert,
|
|
12
|
+
Button,
|
|
13
|
+
BUTTON_VARIANT,
|
|
14
|
+
Card,
|
|
15
|
+
CARD_VARIANT,
|
|
16
|
+
Grid,
|
|
17
|
+
Input,
|
|
18
|
+
Section,
|
|
19
|
+
Select,
|
|
20
|
+
Separator,
|
|
21
|
+
Stack,
|
|
22
|
+
Tabs,
|
|
23
|
+
Text,
|
|
24
|
+
} from '@donotdev/components';
|
|
25
|
+
import { useTranslation } from '@donotdev/core';
|
|
26
|
+
import { Link, PageContainer } from '@donotdev/ui';
|
|
27
|
+
|
|
28
|
+
import type { PageMeta } from '@donotdev/core';
|
|
29
|
+
|
|
30
|
+
export const NAMESPACE = 'checkout';
|
|
31
|
+
|
|
32
|
+
export const meta: PageMeta = {
|
|
33
|
+
namespace: NAMESPACE,
|
|
34
|
+
icon: <CreditCard />,
|
|
35
|
+
auth: true,
|
|
36
|
+
hideFromMenu: true,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const countryOptions = [
|
|
40
|
+
{ value: 'fr', label: 'France' },
|
|
41
|
+
{ value: 'de', label: 'Germany' },
|
|
42
|
+
{ value: 'es', label: 'Spain' },
|
|
43
|
+
{ value: 'it', label: 'Italy' },
|
|
44
|
+
{ value: 'nl', label: 'Netherlands' },
|
|
45
|
+
{ value: 'be', label: 'Belgium' },
|
|
46
|
+
{ value: 'at', label: 'Austria' },
|
|
47
|
+
{ value: 'pt', label: 'Portugal' },
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
const orderItems = [
|
|
51
|
+
{ name: 'Wireless Noise-Cancelling Headphones', quantity: 1, price: 149.99 },
|
|
52
|
+
{ name: 'Leather Crossbody Bag', quantity: 1, price: 119.0 },
|
|
53
|
+
{ name: 'Smart Fitness Watch', quantity: 2, price: 199.0 },
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
export default function CheckoutPage() {
|
|
57
|
+
const { t } = useTranslation(NAMESPACE);
|
|
58
|
+
const [country, setCountry] = useState('');
|
|
59
|
+
|
|
60
|
+
const subtotal = orderItems.reduce((sum, item) => sum + item.price * item.quantity, 0);
|
|
61
|
+
const shipping = 0;
|
|
62
|
+
const tax = subtotal * 0.2;
|
|
63
|
+
const total = subtotal + shipping + tax;
|
|
64
|
+
|
|
65
|
+
const tabItems = [
|
|
66
|
+
{
|
|
67
|
+
value: 'shipping',
|
|
68
|
+
label: t('checkout.tabs.shipping', 'Shipping'),
|
|
69
|
+
content: (
|
|
70
|
+
<Stack gap="medium">
|
|
71
|
+
<Stack direction="row" gap="medium" wrap>
|
|
72
|
+
<Input
|
|
73
|
+
label={t('checkout.shipping.firstName', 'First Name')}
|
|
74
|
+
placeholder={t('checkout.shipping.firstNamePlaceholder', 'Jean')}
|
|
75
|
+
/>
|
|
76
|
+
<Input
|
|
77
|
+
label={t('checkout.shipping.lastName', 'Last Name')}
|
|
78
|
+
placeholder={t('checkout.shipping.lastNamePlaceholder', 'Dupont')}
|
|
79
|
+
/>
|
|
80
|
+
</Stack>
|
|
81
|
+
<Input
|
|
82
|
+
label={t('checkout.shipping.address', 'Address')}
|
|
83
|
+
placeholder={t('checkout.shipping.addressPlaceholder', '12 Rue de la Paix')}
|
|
84
|
+
/>
|
|
85
|
+
<Stack direction="row" gap="medium" wrap>
|
|
86
|
+
<Input
|
|
87
|
+
label={t('checkout.shipping.city', 'City')}
|
|
88
|
+
placeholder={t('checkout.shipping.cityPlaceholder', 'Paris')}
|
|
89
|
+
/>
|
|
90
|
+
<Input
|
|
91
|
+
label={t('checkout.shipping.zip', 'Postal Code')}
|
|
92
|
+
placeholder={t('checkout.shipping.zipPlaceholder', '75002')}
|
|
93
|
+
/>
|
|
94
|
+
</Stack>
|
|
95
|
+
<Select
|
|
96
|
+
label={t('checkout.shipping.country', 'Country')}
|
|
97
|
+
options={countryOptions}
|
|
98
|
+
value={country}
|
|
99
|
+
onValueChange={setCountry}
|
|
100
|
+
placeholder={t('checkout.shipping.countryPlaceholder', 'Select country')}
|
|
101
|
+
/>
|
|
102
|
+
<Input
|
|
103
|
+
label={t('checkout.shipping.phone', 'Phone')}
|
|
104
|
+
placeholder={t('checkout.shipping.phonePlaceholder', '+33 1 23 45 67 89')}
|
|
105
|
+
/>
|
|
106
|
+
</Stack>
|
|
107
|
+
),
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
value: 'payment',
|
|
111
|
+
label: t('checkout.tabs.payment', 'Payment'),
|
|
112
|
+
content: (
|
|
113
|
+
<Stack gap="medium">
|
|
114
|
+
<Alert
|
|
115
|
+
variant="default"
|
|
116
|
+
title={t('checkout.payment.integrationTitle', 'Payment Integration Point')}
|
|
117
|
+
description={t(
|
|
118
|
+
'checkout.payment.integrationDescription',
|
|
119
|
+
'This is where your payment provider (Stripe, PayPal, etc.) would be integrated. The payment form would be rendered by the provider SDK for PCI compliance.'
|
|
120
|
+
)}
|
|
121
|
+
/>
|
|
122
|
+
<Card variant={CARD_VARIANT.GLASS}>
|
|
123
|
+
<Stack gap="medium" style={{ padding: 'var(--gap-md)' }}>
|
|
124
|
+
<Text level="body" weight="semibold">
|
|
125
|
+
{t('checkout.payment.methods', 'Accepted Payment Methods')}
|
|
126
|
+
</Text>
|
|
127
|
+
<Stack direction="row" gap="medium" wrap>
|
|
128
|
+
<Text level="small">Visa</Text>
|
|
129
|
+
<Text level="small">Mastercard</Text>
|
|
130
|
+
<Text level="small">PayPal</Text>
|
|
131
|
+
<Text level="small">Apple Pay</Text>
|
|
132
|
+
<Text level="small">Google Pay</Text>
|
|
133
|
+
</Stack>
|
|
134
|
+
</Stack>
|
|
135
|
+
</Card>
|
|
136
|
+
</Stack>
|
|
137
|
+
),
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
value: 'review',
|
|
141
|
+
label: t('checkout.tabs.review', 'Review'),
|
|
142
|
+
content: (
|
|
143
|
+
<Stack gap="medium">
|
|
144
|
+
<Text level="body" weight="semibold">
|
|
145
|
+
{t('checkout.review.title', 'Order Review')}
|
|
146
|
+
</Text>
|
|
147
|
+
<Stack gap="tight">
|
|
148
|
+
{orderItems.map((item, index) => (
|
|
149
|
+
<Stack key={index} direction="row" justify="space-between">
|
|
150
|
+
<Text level="small">
|
|
151
|
+
{item.name} x{item.quantity}
|
|
152
|
+
</Text>
|
|
153
|
+
<Text level="small">
|
|
154
|
+
{(item.price * item.quantity).toFixed(2)} EUR
|
|
155
|
+
</Text>
|
|
156
|
+
</Stack>
|
|
157
|
+
))}
|
|
158
|
+
</Stack>
|
|
159
|
+
<Separator />
|
|
160
|
+
<Stack direction="row" justify="space-between">
|
|
161
|
+
<Text level="body" weight="semibold">
|
|
162
|
+
{t('checkout.review.total', 'Total')}
|
|
163
|
+
</Text>
|
|
164
|
+
<Text level="body" weight="semibold">
|
|
165
|
+
{total.toFixed(2)} EUR
|
|
166
|
+
</Text>
|
|
167
|
+
</Stack>
|
|
168
|
+
<Alert
|
|
169
|
+
variant="default"
|
|
170
|
+
title={t('checkout.review.note', 'Secure Checkout')}
|
|
171
|
+
description={t('checkout.review.noteDescription', 'Your personal data will be used to process your order and support your experience on this site.')}
|
|
172
|
+
/>
|
|
173
|
+
<Button variant={BUTTON_VARIANT.PRIMARY} fullWidth>
|
|
174
|
+
{t('checkout.review.confirm', 'Confirm & Pay')}
|
|
175
|
+
</Button>
|
|
176
|
+
</Stack>
|
|
177
|
+
),
|
|
178
|
+
},
|
|
179
|
+
];
|
|
180
|
+
|
|
181
|
+
return (
|
|
182
|
+
<PageContainer>
|
|
183
|
+
<Section title={t('checkout.title', 'Checkout')}>
|
|
184
|
+
<Grid cols={[1, 1, 3, 3]} gap="large">
|
|
185
|
+
<Stack style={{ gridColumn: 'span 2' }}>
|
|
186
|
+
<Tabs items={tabItems} defaultValue="shipping" />
|
|
187
|
+
</Stack>
|
|
188
|
+
|
|
189
|
+
<Card
|
|
190
|
+
variant={CARD_VARIANT.ACCENT}
|
|
191
|
+
title={t('checkout.summary.title', 'Order Summary')}
|
|
192
|
+
>
|
|
193
|
+
<Stack gap="medium" style={{ padding: 'var(--gap-md)' }}>
|
|
194
|
+
<Stack gap="tight">
|
|
195
|
+
{orderItems.map((item, index) => (
|
|
196
|
+
<Stack key={index} direction="row" justify="space-between">
|
|
197
|
+
<Text level="caption">
|
|
198
|
+
{item.name} x{item.quantity}
|
|
199
|
+
</Text>
|
|
200
|
+
<Text level="caption">
|
|
201
|
+
{(item.price * item.quantity).toFixed(2)} EUR
|
|
202
|
+
</Text>
|
|
203
|
+
</Stack>
|
|
204
|
+
))}
|
|
205
|
+
</Stack>
|
|
206
|
+
|
|
207
|
+
<Separator />
|
|
208
|
+
|
|
209
|
+
<Stack gap="tight">
|
|
210
|
+
<Stack direction="row" justify="space-between">
|
|
211
|
+
<Text level="small">{t('checkout.summary.subtotal', 'Subtotal')}</Text>
|
|
212
|
+
<Text level="small">{subtotal.toFixed(2)} EUR</Text>
|
|
213
|
+
</Stack>
|
|
214
|
+
<Stack direction="row" justify="space-between">
|
|
215
|
+
<Text level="small">{t('checkout.summary.shipping', 'Shipping')}</Text>
|
|
216
|
+
<Text level="small" variant="success">
|
|
217
|
+
{t('checkout.summary.freeShipping', 'Free')}
|
|
218
|
+
</Text>
|
|
219
|
+
</Stack>
|
|
220
|
+
<Stack direction="row" justify="space-between">
|
|
221
|
+
<Text level="small">{t('checkout.summary.tax', 'Tax (20%)')}</Text>
|
|
222
|
+
<Text level="small">{tax.toFixed(2)} EUR</Text>
|
|
223
|
+
</Stack>
|
|
224
|
+
</Stack>
|
|
225
|
+
|
|
226
|
+
<Separator />
|
|
227
|
+
|
|
228
|
+
<Stack direction="row" justify="space-between">
|
|
229
|
+
<Text level="body" weight="semibold">{t('checkout.summary.total', 'Total')}</Text>
|
|
230
|
+
<Text level="body" weight="semibold">{total.toFixed(2)} EUR</Text>
|
|
231
|
+
</Stack>
|
|
232
|
+
|
|
233
|
+
<Link path="/cart">
|
|
234
|
+
<Button variant={BUTTON_VARIANT.GHOST} fullWidth>
|
|
235
|
+
{t('checkout.summary.backToCart', 'Back to Cart')}
|
|
236
|
+
</Button>
|
|
237
|
+
</Link>
|
|
238
|
+
</Stack>
|
|
239
|
+
</Card>
|
|
240
|
+
</Grid>
|
|
241
|
+
</Section>
|
|
242
|
+
</PageContainer>
|
|
243
|
+
);
|
|
244
|
+
}
|