@donotdev/cli 0.3.1 → 0.3.2
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/dependencies-matrix.json +51 -27
- package/dist/bin/commands/agent-setup.js +28 -18
- package/dist/bin/commands/build.js +1086 -58
- package/dist/bin/commands/bump.js +337 -53
- package/dist/bin/commands/cacheout.js +28 -18
- package/dist/bin/commands/coach.js +33 -25
- package/dist/bin/commands/create-app.js +597 -244
- package/dist/bin/commands/create-project.js +607 -254
- package/dist/bin/commands/db-check.js +37 -28
- package/dist/bin/commands/db.js +37 -28
- package/dist/bin/commands/deploy.js +13758 -11807
- package/dist/bin/commands/dev.js +50 -34
- package/dist/bin/commands/doctor.js +33 -25
- package/dist/bin/commands/emu.js +65 -43
- package/dist/bin/commands/format.js +28 -18
- package/dist/bin/commands/get-demo.js +81 -46
- package/dist/bin/commands/make-admin.js +966 -905
- package/dist/bin/commands/preview.js +50 -34
- package/dist/bin/commands/seed.js +37 -28
- package/dist/bin/commands/setup-cicd.js +1286 -87
- package/dist/bin/commands/setup.js +152 -138
- package/dist/bin/commands/staging.js +13758 -11807
- package/dist/bin/commands/sync-secrets.js +152 -132
- package/dist/bin/commands/type-check.js +1086 -39
- package/dist/bin/commands/wai.js +28 -18
- package/dist/bin/dndev.js +501 -27
- package/dist/index.js +14568 -12497
- package/package.json +1 -1
- package/templates/app-demo/index.html.example +0 -1
- package/templates/app-demo/src/pages/ConditionalFormPage.tsx.example +2 -2
- package/templates/app-demo/src/pages/ShowcaseDetailPage.tsx.example +1 -0
- package/templates/app-demo/tsconfig.json.example +1 -1
- package/templates/app-dndev/index.html.example +1 -3
- package/templates/app-expo/app/_layout.tsx.example +1 -1
- package/templates/app-expo/app/form.tsx.example +10 -3
- package/templates/app-expo/app/index.tsx.example +3 -3
- package/templates/app-expo/app/list.tsx.example +2 -2
- package/templates/app-expo/app/profile.tsx.example +4 -3
- package/templates/app-expo/app/signin.tsx.example +2 -2
- package/templates/app-expo/babel.config.js.example +23 -6
- package/templates/app-expo/metro.config.js.example +7 -17
- package/templates/app-expo/tsconfig.json.example +2 -1
- package/templates/app-next/src/app/AppDocument.tsx.example +2 -3
- package/templates/app-vite/index.html.example +1 -3
- package/templates/app-vite/src/locales/home_en.json.example +6 -6
- package/templates/app-vite/src/pages/FormPageExample.tsx.example +1 -1
- package/templates/app-vite/src/pages/HomePage.tsx.example +3 -3
- package/templates/deploy-config/firebase.json.example +6 -5
- package/templates/deploy-config/tsconfig.functions.json.example +2 -7
- package/templates/deploy-config/vercel.json.example +5 -56
- package/templates/functions-firebase/README.md.example +8 -8
- package/templates/functions-firebase/functions.config.js.example +2 -1
- package/templates/functions-firebase/src/index.ts.example +4 -3
- package/templates/functions-firebase/src/oauth/exchangeToken.ts.example +8 -6
- package/templates/functions-firebase/src/oauth/refreshToken.ts.example +8 -6
- package/templates/functions-firebase/tsconfig.json.example +3 -5
- package/templates/functions-supabase/supabase/config.toml.example +2 -1
- package/templates/functions-supabase/supabase/functions/change-plan/index.ts.example +2 -3
- package/templates/functions-supabase/supabase/functions/create-checkout-session/index.ts.example +2 -3
- package/templates/functions-supabase/supabase/functions/stripe-webhook/index.ts.example +2 -3
- package/templates/functions-vercel/README.md.example +15 -25
- package/templates/functions-vercel/build.mjs.example +4 -46
- package/templates/functions-vercel/src/api/auth/setCustomClaims.ts.example +6 -11
- package/templates/functions-vercel/src/api/billing/handleStripeWebhook.ts.example +2 -3
- package/templates/functions-vercel/src/api/oauth/checkGitHubAccess.ts.example +5 -11
- package/templates/functions-vercel/src/api/oauth/exchangeToken.ts.example +5 -11
- package/templates/functions-vercel/src/api/oauth/grantGitHubAccess.ts.example +5 -11
- package/templates/functions-vercel/tsconfig.json.example +5 -6
- package/templates/github/workflows/firebase-deploy.yml.example +1 -1
- package/templates/preset-admin/src/pages/DashboardPage.tsx.example +3 -2
- package/templates/preset-admin/src/pages/ReportsPage.tsx.example +13 -12
- package/templates/preset-admin/src/pages/SettingsPage.tsx.example +5 -5
- package/templates/preset-admin/src/pages/UsersPage.tsx.example +13 -12
- package/templates/preset-ecommerce/src/pages/CartPage.tsx.example +5 -5
- package/templates/preset-ecommerce/src/pages/CatalogPage.tsx.example +1 -4
- package/templates/preset-ecommerce/src/pages/CheckoutPage.tsx.example +10 -12
- package/templates/preset-ecommerce/src/pages/ProductPage.tsx.example +7 -4
- package/templates/preset-landing/src/pages/AboutPage.tsx.example +11 -9
- package/templates/preset-landing/src/pages/ContactPage.tsx.example +13 -7
- package/templates/preset-landing/src/pages/HomePage.tsx.example +50 -32
- package/templates/preset-saas/src/pages/DashboardPage.tsx.example +1 -1
- package/templates/preset-saas/src/pages/HomePage.tsx.example +3 -2
- package/templates/preset-saas/src/pages/PricingPage.tsx.example +4 -3
- package/templates/preset-saas/src/pages/ProfilePage.tsx.example +7 -7
- package/templates/preset-saas/src/pages/SettingsPage.tsx.example +3 -3
- package/templates/root-consumer/.claude/hooks/guard-bash.sh.example +101 -10
- package/templates/root-consumer/.claude/rules/definition-of-done.md.example +2 -2
- package/templates/root-consumer/.claude/rules/framework.md.example +1 -1
- package/templates/root-consumer/.claude/settings.json.example +0 -11
- package/templates/root-consumer/.claude/skills/build/SKILL.md.example +1 -1
- package/templates/root-consumer/.dndev/args.json.example +2 -2
- package/templates/root-consumer/.env.example +1 -1
- package/templates/root-consumer/AGENTS.md.example +3 -3
- package/templates/root-consumer/README.md.example +1 -1
- package/templates/functions-vercel/src/api/oauth/disconnect.ts.example +0 -20
- package/templates/functions-vercel/src/api/oauth/getConnections.ts.example +0 -20
- package/templates/functions-vercel/src/api/oauth/refreshToken.ts.example +0 -20
- package/templates/functions-vercel/vercel.json.example +0 -14
- package/templates/root-consumer/.claude/hooks/typecheck-stop.sh.example +0 -18
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { createChangePlan } from '@donotdev/functions/supabase';
|
|
6
6
|
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
const billingConfig = {}; // TODO: Replace with your StripeBackConfig
|
|
7
|
+
// TODO: replace with your StripeBackConfig (define it inline or in a shared module you create)
|
|
8
|
+
const billingConfig = {};
|
|
10
9
|
|
|
11
10
|
Deno.serve(createChangePlan(billingConfig));
|
package/templates/functions-supabase/supabase/functions/create-checkout-session/index.ts.example
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { createCheckoutSession } from '@donotdev/functions/supabase';
|
|
6
6
|
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
const billingConfig = {}; // TODO: Replace with your StripeBackConfig
|
|
7
|
+
// TODO: replace with your StripeBackConfig (define it inline or in a shared module you create)
|
|
8
|
+
const billingConfig = {};
|
|
10
9
|
|
|
11
10
|
Deno.serve(createCheckoutSession(billingConfig));
|
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { createStripeWebhook } from '@donotdev/functions/supabase';
|
|
7
7
|
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
const billingConfig = {}; // TODO: Replace with your StripeBackConfig
|
|
8
|
+
// TODO: replace with your StripeBackConfig (define it inline or in a shared module you create)
|
|
9
|
+
const billingConfig = {};
|
|
11
10
|
|
|
12
11
|
Deno.serve(createStripeWebhook(billingConfig));
|
|
@@ -7,23 +7,26 @@ This directory contains the Vercel Functions for the {{APP_NAME}} app, generated
|
|
|
7
7
|
```
|
|
8
8
|
functions/
|
|
9
9
|
├── src/
|
|
10
|
-
│ └── api/
|
|
10
|
+
│ └── api/ # One file = one function, served at /api/<path>
|
|
11
11
|
│ ├── auth/ # Authentication functions
|
|
12
|
-
│ ├──
|
|
13
|
-
│
|
|
12
|
+
│ ├── crud/ # CRUD functions
|
|
13
|
+
{{#needsOAuth}}│ ├── oauth/ # OAuth functions
|
|
14
|
+
{{/needsOAuth}}{{#needsBilling}}│ └── billing/ # Billing functions
|
|
15
|
+
{{/needsBilling}}├── build.mjs # Bundles src/api/** into .vercel/output/functions
|
|
14
16
|
├── package.json # Dependencies and scripts
|
|
15
17
|
├── tsconfig.json # TypeScript configuration
|
|
16
|
-
├── vercel.json # Vercel configuration
|
|
17
18
|
├── .env.example # Environment variables template
|
|
18
19
|
└── README.md # This file
|
|
19
20
|
```
|
|
20
21
|
|
|
22
|
+
`src/api/auth/getCustomClaims.ts` answers `/api/auth/getCustomClaims`. Files named `_*` are shared code, not functions.
|
|
23
|
+
|
|
21
24
|
## Features
|
|
22
25
|
|
|
23
26
|
- **Authentication Management**: User custom claims and auth status
|
|
24
|
-
- **OAuth Integration**: GitHub access management
|
|
25
|
-
- **Billing Processing**: Stripe checkout and webhook handling
|
|
26
|
-
- **Secure API Layer**: Professional frontend-backend communication
|
|
27
|
+
{{#needsOAuth}}- **OAuth Integration**: GitHub access management
|
|
28
|
+
{{/needsOAuth}}{{#needsBilling}}- **Billing Processing**: Stripe checkout and webhook handling
|
|
29
|
+
{{/needsBilling}}- **Secure API Layer**: Professional frontend-backend communication
|
|
27
30
|
- **Error Handling**: Comprehensive error handling and logging
|
|
28
31
|
|
|
29
32
|
## Environment Variables
|
|
@@ -67,26 +70,13 @@ GITHUB_REPO_NAME=your-repo
|
|
|
67
70
|
- Set environment variables in Vercel dashboard
|
|
68
71
|
- Update webhook URL in Stripe dashboard
|
|
69
72
|
|
|
70
|
-
## Deployment
|
|
71
|
-
|
|
72
|
-
Use the unified deployment command from workspace root:
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
# Deploy everything (interactive)
|
|
76
|
-
dndev deploy
|
|
77
|
-
|
|
78
|
-
# Deploy specific app
|
|
79
|
-
dndev deploy <app-name>
|
|
80
|
-
```
|
|
73
|
+
## Build and Deployment
|
|
81
74
|
|
|
82
|
-
|
|
75
|
+
`bun run build` (or `dndev build <app>:func` from the workspace root) bundles each `src/api/<path>.ts`, its dependencies included, into the Vercel [Build Output API](https://vercel.com/docs/build-output-api) function `.vercel/output/functions/api/<path>.func` (`index.mjs` + `.vc-config.json`, Node.js 22).
|
|
83
76
|
|
|
84
|
-
|
|
85
|
-
# Start Vercel development server
|
|
86
|
-
bun run dev
|
|
87
|
-
```
|
|
77
|
+
`dndev deploy <app-name>` uploads those functions with the frontend as one Vercel deployment (Vercel-hosted app), or alone to the app's Vercel project (`VERCEL_PROJECT_ID` in the app `.env`) when the frontend is hosted elsewhere. Vercel builds nothing: what `bun run build` produced is what runs.
|
|
88
78
|
|
|
89
|
-
## API Endpoints
|
|
79
|
+
{{#needsBilling}}## API Endpoints
|
|
90
80
|
|
|
91
81
|
### Stripe Webhook
|
|
92
82
|
|
|
@@ -99,7 +89,7 @@ bun run dev
|
|
|
99
89
|
- **Integration**: Direct Stripe calls (no API needed)
|
|
100
90
|
- **Purpose**: Creates Stripe checkout sessions for purchases
|
|
101
91
|
|
|
102
|
-
## Security
|
|
92
|
+
{{/needsBilling}}## Security
|
|
103
93
|
|
|
104
94
|
- All functions require authentication
|
|
105
95
|
- Webhook signature verification
|
|
@@ -1,52 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* @fileoverview Build script for {{APP_NAME}} Vercel functions
|
|
4
|
-
* @description Bundles
|
|
4
|
+
* @description Bundles each src/api/<path>.ts into the Vercel Build Output function
|
|
5
|
+
* .vercel/output/functions/api/<path>.func (URL /api/<path>). `dndev deploy` uploads them.
|
|
5
6
|
*/
|
|
6
7
|
|
|
7
|
-
import {
|
|
8
|
-
import { createAppFunctionsConfig } from '@donotdev/core/functions';
|
|
8
|
+
import { buildVercelFunctions } from '@donotdev/core/functions';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
console.log('🔨 Building {{APP_NAME}} Vercel functions...');
|
|
12
|
-
|
|
13
|
-
try {
|
|
14
|
-
const config = createAppFunctionsConfig({
|
|
15
|
-
entry: 'src/index.ts',
|
|
16
|
-
outDir: 'lib',
|
|
17
|
-
minify: process.env.NODE_ENV === 'production',
|
|
18
|
-
sourcemap: true,
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
console.log('📦 Bundling @donotdev/types and importing framework functions...');
|
|
22
|
-
|
|
23
|
-
const result = await build(config);
|
|
24
|
-
|
|
25
|
-
if (result.errors.length > 0) {
|
|
26
|
-
console.error('❌ Build errors:', result.errors);
|
|
27
|
-
process.exit(1);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (result.warnings.length > 0) {
|
|
31
|
-
console.warn('⚠️ Build warnings:', result.warnings);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
console.log('✅ {{APP_NAME}} Vercel functions built successfully!');
|
|
35
|
-
console.log('📁 Output directory: lib/');
|
|
36
|
-
|
|
37
|
-
// Log bundle info if metafile is available
|
|
38
|
-
if (result.metafile) {
|
|
39
|
-
const { analyzeMetafile } = await import('esbuild');
|
|
40
|
-
const analysis = await analyzeMetafile(result.metafile);
|
|
41
|
-
console.log('\n📊 Bundle analysis:');
|
|
42
|
-
console.log(analysis);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
} catch (error) {
|
|
46
|
-
console.error('❌ Build failed:', error);
|
|
47
|
-
process.exit(1);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Run the build
|
|
52
|
-
buildFunctions();
|
|
10
|
+
buildVercelFunctions();
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
// functions/src/api/auth/setCustomClaims.ts
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @fileoverview {{APP_NAME}} Set Custom Claims
|
|
5
|
-
* @description
|
|
4
|
+
* @fileoverview {{APP_NAME}} Set Custom Claims
|
|
5
|
+
* @description Framework handler letting a signed-in user set their own custom claims
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import
|
|
9
|
-
import { setCustomClaims as frameworkSetCustomClaims } from '@donotdev/functions/vercel';
|
|
8
|
+
import { createSetCustomClaimsHandler } from '@donotdev/functions/vercel';
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* {{APP_NAME}} custom claims setting
|
|
13
|
-
*
|
|
12
|
+
* Only the claim keys listed here are self-assignable (privilege keys such as
|
|
13
|
+
* `role` or `admin` are always refused). Empty: every key is refused.
|
|
14
14
|
*/
|
|
15
|
-
export default
|
|
16
|
-
req: NextApiRequest,
|
|
17
|
-
res: NextApiResponse
|
|
18
|
-
) {
|
|
19
|
-
return frameworkSetCustomClaims(req, res);
|
|
20
|
-
}
|
|
15
|
+
export default createSetCustomClaimsHandler({ allowedClaimKeys: [] });
|
|
@@ -11,8 +11,7 @@ import { createStripeWebhook } from '@donotdev/functions/vercel';
|
|
|
11
11
|
// import { billingConfig } from '../../config/billingConfig';
|
|
12
12
|
const billingConfig = {}; // TODO: Replace with your StripeBackConfig
|
|
13
13
|
|
|
14
|
-
// Stripe signs the raw body:
|
|
15
|
-
export const config = { api: { bodyParser: false } };
|
|
14
|
+
// Stripe signs the raw body: the handler reads the request stream, never the parsed `req.body`
|
|
16
15
|
|
|
17
16
|
// backend: 'firebase' | 'supabase' (token verification, claims, idempotency storage)
|
|
18
|
-
export default createStripeWebhook(billingConfig, { backend: 'firebase' });
|
|
17
|
+
export default createStripeWebhook(billingConfig, { backend: '{{#isSupabase}}supabase{{/isSupabase}}{{^isSupabase}}firebase{{/isSupabase}}' });
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
// functions/src/api/oauth/checkGitHubAccess.ts
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @fileoverview {{APP_NAME}} GitHub Access Check
|
|
5
|
-
* @description
|
|
4
|
+
* @fileoverview {{APP_NAME}} GitHub Access Check
|
|
5
|
+
* @description Framework route checking the user's access to the GitHub repository
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import
|
|
9
|
-
import { checkGitHubAccess as frameworkCheckGitHubAccess } from '@donotdev/functions/vercel';
|
|
8
|
+
import { checkGitHubAccess } from '@donotdev/functions/vercel';
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* {{APP_NAME}} GitHub access checking
|
|
13
|
-
*
|
|
12
|
+
* Pass a Valibot schema to replace the default request schema.
|
|
14
13
|
*/
|
|
15
|
-
export default
|
|
16
|
-
req: NextApiRequest,
|
|
17
|
-
res: NextApiResponse
|
|
18
|
-
) {
|
|
19
|
-
return frameworkCheckGitHubAccess(req, res);
|
|
20
|
-
}
|
|
14
|
+
export default checkGitHubAccess();
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
// functions/src/api/oauth/exchangeToken.ts
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @fileoverview {{APP_NAME}} Exchange Token
|
|
5
|
-
* @description
|
|
4
|
+
* @fileoverview {{APP_NAME}} Exchange Token
|
|
5
|
+
* @description Framework route exchanging an OAuth authorization code for tokens
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import
|
|
9
|
-
import { exchangeToken as frameworkExchangeToken } from '@donotdev/functions/vercel';
|
|
8
|
+
import { exchangeToken } from '@donotdev/functions/vercel';
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* {{APP_NAME}} OAuth token exchange
|
|
13
|
-
*
|
|
12
|
+
* Pass a Valibot schema to replace the default request schema.
|
|
14
13
|
*/
|
|
15
|
-
export default
|
|
16
|
-
req: NextApiRequest,
|
|
17
|
-
res: NextApiResponse
|
|
18
|
-
) {
|
|
19
|
-
return frameworkExchangeToken(req, res);
|
|
20
|
-
}
|
|
14
|
+
export default exchangeToken();
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
// functions/src/api/oauth/grantGitHubAccess.ts
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @fileoverview {{APP_NAME}} GitHub Access
|
|
5
|
-
* @description
|
|
4
|
+
* @fileoverview {{APP_NAME}} GitHub Access
|
|
5
|
+
* @description Framework route granting the user access to the GitHub repository
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import
|
|
9
|
-
import { grantGitHubAccess as frameworkGrantGitHubAccess } from '@donotdev/functions/vercel';
|
|
8
|
+
import { grantGitHubAccess } from '@donotdev/functions/vercel';
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* {{APP_NAME}} GitHub access granting
|
|
13
|
-
*
|
|
12
|
+
* Pass a Valibot schema to replace the default request schema.
|
|
14
13
|
*/
|
|
15
|
-
export default
|
|
16
|
-
req: NextApiRequest,
|
|
17
|
-
res: NextApiResponse
|
|
18
|
-
) {
|
|
19
|
-
return frameworkGrantGitHubAccess(req, res);
|
|
20
|
-
}
|
|
14
|
+
export default grantGitHubAccess();
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "../../../tsconfig.functions.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"sourceMap": true
|
|
4
|
+
"module": "preserve",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
7
|
+
"jsx": "react-jsx"
|
|
9
8
|
},
|
|
10
9
|
"include": ["src/**/*"],
|
|
11
|
-
"exclude": ["node_modules", "lib", "**/*.test.ts"]
|
|
10
|
+
"exclude": ["node_modules", "lib", ".vercel", "**/*.test.ts"]
|
|
12
11
|
}
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
} from 'lucide-react';
|
|
25
25
|
|
|
26
26
|
import { Section, Card, Grid, Stack, Text, Badge, List } from '@donotdev/components';
|
|
27
|
+
import type { BadgeVariant } from '@donotdev/components';
|
|
27
28
|
import { useTranslation } from '@donotdev/core';
|
|
28
29
|
import type { PageMeta } from '@donotdev/core';
|
|
29
30
|
import { useAuth } from '@donotdev/auth';
|
|
@@ -95,7 +96,7 @@ const quickActions = [
|
|
|
95
96
|
// ============================================================================
|
|
96
97
|
|
|
97
98
|
function statusBadge(status: string) {
|
|
98
|
-
const variants: Record<string,
|
|
99
|
+
const variants: Record<string, BadgeVariant> = {
|
|
99
100
|
success: 'success',
|
|
100
101
|
error: 'destructive',
|
|
101
102
|
warning: 'warning',
|
|
@@ -143,7 +144,7 @@ export default function DashboardPage() {
|
|
|
143
144
|
<Card
|
|
144
145
|
key={index}
|
|
145
146
|
content={
|
|
146
|
-
<Stack direction="row" align="center" justify="
|
|
147
|
+
<Stack direction="row" align="center" justify="between">
|
|
147
148
|
<Stack direction="row" align="center" gap="medium">
|
|
148
149
|
{statusBadge(activity.status)}
|
|
149
150
|
<Text level="body">{activity.text}</Text>
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
DataTable,
|
|
28
28
|
Badge,
|
|
29
29
|
} from '@donotdev/components';
|
|
30
|
+
import type { BadgeVariant, TableColumn } from '@donotdev/components';
|
|
30
31
|
import { useTranslation } from '@donotdev/core';
|
|
31
32
|
import type { PageMeta } from '@donotdev/core';
|
|
32
33
|
import { PageContainer } from '@donotdev/ui';
|
|
@@ -100,24 +101,24 @@ const recentExports = [
|
|
|
100
101
|
{ id: '6', name: 'Customer Segments', format: 'XLSX', status: 'failed', date: '2026-03-09', size: '-' },
|
|
101
102
|
];
|
|
102
103
|
|
|
103
|
-
const exportColumns = [
|
|
104
|
-
{ key: 'name',
|
|
105
|
-
{ key: 'format',
|
|
104
|
+
const exportColumns: TableColumn<(typeof recentExports)[number]>[] = [
|
|
105
|
+
{ key: 'name', title: 'Report Name', sortable: true },
|
|
106
|
+
{ key: 'format', title: 'Format', sortable: true },
|
|
106
107
|
{
|
|
107
108
|
key: 'status',
|
|
108
|
-
|
|
109
|
+
title: 'Status',
|
|
109
110
|
sortable: true,
|
|
110
|
-
render: (
|
|
111
|
-
const variants: Record<string,
|
|
111
|
+
render: (_value, report) => {
|
|
112
|
+
const variants: Record<string, BadgeVariant> = {
|
|
112
113
|
completed: 'success',
|
|
113
114
|
processing: 'warning',
|
|
114
115
|
failed: 'destructive',
|
|
115
116
|
};
|
|
116
|
-
return <Badge variant={variants[
|
|
117
|
+
return <Badge variant={variants[report.status] || 'default'}>{report.status}</Badge>;
|
|
117
118
|
},
|
|
118
119
|
},
|
|
119
|
-
{ key: 'date',
|
|
120
|
-
{ key: 'size',
|
|
120
|
+
{ key: 'date', title: 'Date', sortable: true },
|
|
121
|
+
{ key: 'size', title: 'Size', sortable: true },
|
|
121
122
|
];
|
|
122
123
|
|
|
123
124
|
// ============================================================================
|
|
@@ -132,7 +133,7 @@ export default function ReportsPage() {
|
|
|
132
133
|
<PageContainer>
|
|
133
134
|
{/* Date Range Selector */}
|
|
134
135
|
<Section title={t('reportsAnalytics')}>
|
|
135
|
-
<Stack direction="row" align="center" justify="
|
|
136
|
+
<Stack direction="row" align="center" justify="between">
|
|
136
137
|
<Text level="body" variant="muted">
|
|
137
138
|
{t('selectPeriod')}
|
|
138
139
|
</Text>
|
|
@@ -156,12 +157,12 @@ export default function ReportsPage() {
|
|
|
156
157
|
elevated
|
|
157
158
|
content={
|
|
158
159
|
<Stack gap="tight">
|
|
159
|
-
<Text level="
|
|
160
|
+
<Text level="h3" weight="bold">{stat.value}</Text>
|
|
160
161
|
<Stack direction="row" align="center" gap="tight">
|
|
161
162
|
{stat.positive ? <TrendingUp /> : <TrendingDown />}
|
|
162
163
|
<Text
|
|
163
164
|
level="small"
|
|
164
|
-
variant={stat.positive ? 'success' : '
|
|
165
|
+
variant={stat.positive ? 'success' : 'destructive'}
|
|
165
166
|
>
|
|
166
167
|
{stat.trend}
|
|
167
168
|
</Text>
|
|
@@ -130,7 +130,7 @@ function SecurityTab() {
|
|
|
130
130
|
<Stack gap="large">
|
|
131
131
|
<Section title={t('authentication')}>
|
|
132
132
|
<Stack gap="medium">
|
|
133
|
-
<Stack direction="row" align="center" justify="
|
|
133
|
+
<Stack direction="row" align="center" justify="between">
|
|
134
134
|
<Stack gap="none">
|
|
135
135
|
<Text level="body" weight="bold">{t('twoFactorAuth')}</Text>
|
|
136
136
|
<Text level="small" variant="muted">{t('twoFactorDescription')}</Text>
|
|
@@ -152,17 +152,17 @@ function SecurityTab() {
|
|
|
152
152
|
|
|
153
153
|
<Section title={t('passwordPolicy')}>
|
|
154
154
|
<Stack gap="medium">
|
|
155
|
-
<Stack direction="row" align="center" justify="
|
|
155
|
+
<Stack direction="row" align="center" justify="between">
|
|
156
156
|
<Text level="body">{t('requireUppercase')}</Text>
|
|
157
157
|
<Switch checked={enforceUppercase} onCheckedChange={setEnforceUppercase} />
|
|
158
158
|
</Stack>
|
|
159
159
|
|
|
160
|
-
<Stack direction="row" align="center" justify="
|
|
160
|
+
<Stack direction="row" align="center" justify="between">
|
|
161
161
|
<Text level="body">{t('requireNumbers')}</Text>
|
|
162
162
|
<Switch checked={enforceNumbers} onCheckedChange={setEnforceNumbers} />
|
|
163
163
|
</Stack>
|
|
164
164
|
|
|
165
|
-
<Stack direction="row" align="center" justify="
|
|
165
|
+
<Stack direction="row" align="center" justify="between">
|
|
166
166
|
<Text level="body">{t('requireSpecialChars')}</Text>
|
|
167
167
|
<Switch checked={enforceSpecial} onCheckedChange={setEnforceSpecial} />
|
|
168
168
|
</Stack>
|
|
@@ -212,7 +212,7 @@ function IntegrationsTab() {
|
|
|
212
212
|
subtitle={integration.description}
|
|
213
213
|
elevated
|
|
214
214
|
content={
|
|
215
|
-
<Stack direction="row" align="center" justify="
|
|
215
|
+
<Stack direction="row" align="center" justify="between">
|
|
216
216
|
<Badge
|
|
217
217
|
variant={integration.status === 'connected' ? 'success' : 'secondary'}
|
|
218
218
|
>
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { Users } from 'lucide-react';
|
|
9
9
|
|
|
10
10
|
import { Section, DataTable, Badge } from '@donotdev/components';
|
|
11
|
+
import type { BadgeVariant, TableColumn } from '@donotdev/components';
|
|
11
12
|
import { useTranslation } from '@donotdev/core';
|
|
12
13
|
import type { PageMeta } from '@donotdev/core';
|
|
13
14
|
import { PageContainer } from '@donotdev/ui';
|
|
@@ -46,48 +47,48 @@ const users = [
|
|
|
46
47
|
// COLUMN DEFINITIONS
|
|
47
48
|
// ============================================================================
|
|
48
49
|
|
|
49
|
-
const roleBadgeVariant: Record<string,
|
|
50
|
+
const roleBadgeVariant: Record<string, BadgeVariant> = {
|
|
50
51
|
admin: 'destructive',
|
|
51
52
|
editor: 'default',
|
|
52
53
|
viewer: 'secondary',
|
|
53
54
|
};
|
|
54
55
|
|
|
55
|
-
const statusBadgeVariant: Record<string,
|
|
56
|
+
const statusBadgeVariant: Record<string, BadgeVariant> = {
|
|
56
57
|
active: 'success',
|
|
57
58
|
inactive: 'secondary',
|
|
58
59
|
pending: 'warning',
|
|
59
60
|
};
|
|
60
61
|
|
|
61
|
-
const columns = [
|
|
62
|
+
const columns: TableColumn<(typeof users)[number]>[] = [
|
|
62
63
|
{
|
|
63
64
|
key: 'name',
|
|
64
|
-
|
|
65
|
+
title: 'Name',
|
|
65
66
|
sortable: true,
|
|
66
67
|
},
|
|
67
68
|
{
|
|
68
69
|
key: 'email',
|
|
69
|
-
|
|
70
|
+
title: 'Email',
|
|
70
71
|
sortable: true,
|
|
71
72
|
},
|
|
72
73
|
{
|
|
73
74
|
key: 'role',
|
|
74
|
-
|
|
75
|
+
title: 'Role',
|
|
75
76
|
sortable: true,
|
|
76
|
-
render: (
|
|
77
|
-
<Badge variant={roleBadgeVariant[
|
|
77
|
+
render: (_value, user) => (
|
|
78
|
+
<Badge variant={roleBadgeVariant[user.role] || 'default'}>{user.role}</Badge>
|
|
78
79
|
),
|
|
79
80
|
},
|
|
80
81
|
{
|
|
81
82
|
key: 'status',
|
|
82
|
-
|
|
83
|
+
title: 'Status',
|
|
83
84
|
sortable: true,
|
|
84
|
-
render: (
|
|
85
|
-
<Badge variant={statusBadgeVariant[
|
|
85
|
+
render: (_value, user) => (
|
|
86
|
+
<Badge variant={statusBadgeVariant[user.status] || 'default'}>{user.status}</Badge>
|
|
86
87
|
),
|
|
87
88
|
},
|
|
88
89
|
{
|
|
89
90
|
key: 'joined',
|
|
90
|
-
|
|
91
|
+
title: 'Joined',
|
|
91
92
|
sortable: true,
|
|
92
93
|
},
|
|
93
94
|
];
|
|
@@ -71,7 +71,7 @@ export default function CartPage() {
|
|
|
71
71
|
<Card key={item.id}>
|
|
72
72
|
<Stack
|
|
73
73
|
direction="row"
|
|
74
|
-
justify="
|
|
74
|
+
justify="between"
|
|
75
75
|
align="center"
|
|
76
76
|
gap="medium"
|
|
77
77
|
style={{ padding: 'var(--gap-md)' }}
|
|
@@ -121,11 +121,11 @@ export default function CartPage() {
|
|
|
121
121
|
>
|
|
122
122
|
<Stack gap="medium" style={{ padding: 'var(--gap-md)' }}>
|
|
123
123
|
<Stack gap="tight">
|
|
124
|
-
<Stack direction="row" justify="
|
|
124
|
+
<Stack direction="row" justify="between">
|
|
125
125
|
<Text level="small">{t('cart.summary.subtotal', 'Subtotal')}</Text>
|
|
126
126
|
<Text level="small">{subtotal.toFixed(2)} EUR</Text>
|
|
127
127
|
</Stack>
|
|
128
|
-
<Stack direction="row" justify="
|
|
128
|
+
<Stack direction="row" justify="between">
|
|
129
129
|
<Text level="small">{t('cart.summary.shipping', 'Shipping')}</Text>
|
|
130
130
|
<Text level="small" variant={shipping === 0 ? 'success' : 'default'}>
|
|
131
131
|
{shipping === 0
|
|
@@ -133,7 +133,7 @@ export default function CartPage() {
|
|
|
133
133
|
: `${shipping.toFixed(2)} EUR`}
|
|
134
134
|
</Text>
|
|
135
135
|
</Stack>
|
|
136
|
-
<Stack direction="row" justify="
|
|
136
|
+
<Stack direction="row" justify="between">
|
|
137
137
|
<Text level="small">{t('cart.summary.tax', 'Tax (20%)')}</Text>
|
|
138
138
|
<Text level="small">{tax.toFixed(2)} EUR</Text>
|
|
139
139
|
</Stack>
|
|
@@ -141,7 +141,7 @@ export default function CartPage() {
|
|
|
141
141
|
|
|
142
142
|
<Separator />
|
|
143
143
|
|
|
144
|
-
<Stack direction="row" justify="
|
|
144
|
+
<Stack direction="row" justify="between">
|
|
145
145
|
<Text level="body" weight="semibold">{t('cart.summary.total', 'Total')}</Text>
|
|
146
146
|
<Text level="body" weight="semibold">{total.toFixed(2)} EUR</Text>
|
|
147
147
|
</Stack>
|
|
@@ -125,7 +125,7 @@ export default function CatalogPage() {
|
|
|
125
125
|
<PageContainer>
|
|
126
126
|
<Section title={t('catalog.title', 'Product Catalog')}>
|
|
127
127
|
<Stack gap="large">
|
|
128
|
-
<Stack direction="row" gap="medium" wrap align="end">
|
|
128
|
+
<Stack direction="row" gap="medium" wrap="wrap" align="end">
|
|
129
129
|
<Select
|
|
130
130
|
label={t('catalog.filters.category', 'Category')}
|
|
131
131
|
options={categoryOptions}
|
|
@@ -162,9 +162,6 @@ export default function CatalogPage() {
|
|
|
162
162
|
icon={<ShoppingCart />}
|
|
163
163
|
fullWidth
|
|
164
164
|
loading={!product.available}
|
|
165
|
-
display={product.available
|
|
166
|
-
? t('catalog.addToCart', 'Add to Cart')
|
|
167
|
-
: t('catalog.outOfStock', 'Out of Stock')}
|
|
168
165
|
>
|
|
169
166
|
{product.available
|
|
170
167
|
? t('catalog.addToCart', 'Add to Cart')
|