create-reactivite 1.4.0 → 1.7.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/README.md +326 -290
- package/index.js +77 -2
- package/package.json +4 -2
- package/template/.storybook/main.ts +20 -0
- package/template/.storybook/preview.tsx +55 -0
- package/template/_gitignore +3 -0
- package/template/index.html +1 -1
- package/template/package.json +29 -23
- package/template/src/components/author-credit.tsx +25 -25
- package/template/src/components/ui-lib/auth-form.stories.tsx +26 -0
- package/template/src/components/ui-lib/auth-form.tsx +116 -0
- package/template/src/components/ui-lib/empty-state.stories.tsx +32 -0
- package/template/src/components/ui-lib/empty-state.tsx +54 -0
- package/template/src/components/ui-lib/feature-card.stories.tsx +45 -0
- package/template/src/components/ui-lib/feature-card.tsx +52 -0
- package/template/src/components/ui-lib/index.ts +13 -0
- package/template/src/components/ui-lib/page-header.stories.tsx +49 -0
- package/template/src/components/ui-lib/page-header.tsx +46 -0
- package/template/src/components/ui-lib/pricing-card.stories.tsx +58 -0
- package/template/src/components/ui-lib/pricing-card.tsx +86 -0
- package/template/src/components/ui-lib/stat-card.stories.tsx +55 -0
- package/template/src/components/ui-lib/stat-card.tsx +73 -0
- package/template/src/components/ui-lib/themes.stories.tsx +68 -0
- package/template/src/global.css +122 -0
- package/template2/.env.example +8 -8
- package/template2/.husky/pre-commit +4 -4
- package/template2/.prettierrc +5 -5
- package/template2/README.md +73 -73
- package/template2/__tests__/example.test.ts +20 -20
- package/template2/_gitignore +37 -37
- package/template2/app/[locale]/(private)/dashboard/page.tsx +52 -52
- package/template2/app/[locale]/(public)/login/page.tsx +83 -83
- package/template2/app/[locale]/layout.tsx +58 -58
- package/template2/app/[locale]/locales.ts +10 -10
- package/template2/app/[locale]/page.tsx +38 -38
- package/template2/app/api/clear-session/route.ts +10 -10
- package/template2/app/globals.css +127 -127
- package/template2/app/layout.tsx +7 -7
- package/template2/app/page.tsx +6 -6
- package/template2/components/AuthEventListener.tsx +22 -22
- package/template2/components/author-credit.tsx +25 -25
- package/template2/components/theme-provider.tsx +78 -78
- package/template2/components/ui/button.tsx +60 -60
- package/template2/components/ui/card.tsx +92 -92
- package/template2/components/ui/input.tsx +21 -21
- package/template2/components/ui/label.tsx +24 -24
- package/template2/components/ui/sonner.tsx +40 -40
- package/template2/components.json +22 -22
- package/template2/config/constants.ts +7 -7
- package/template2/config/env.ts +5 -5
- package/template2/contexts/translation-context.tsx +70 -70
- package/template2/eslint.config.mjs +18 -18
- package/template2/hoc/provider.tsx +27 -27
- package/template2/lib/paramsSerializer.ts +40 -40
- package/template2/lib/utils.ts +6 -6
- package/template2/locales/az.json +20 -20
- package/template2/locales/en.json +20 -20
- package/template2/next-env.d.ts +1 -1
- package/template2/next.config.ts +17 -17
- package/template2/orval.config.ts +66 -66
- package/template2/package.json +62 -62
- package/template2/postcss.config.mjs +7 -7
- package/template2/scripts/fix-generated-types.mjs +13 -13
- package/template2/services/generated/.gitkeep +2 -2
- package/template2/services/httpClient/httpClient.ts +70 -70
- package/template2/services/httpClient/orvalMutator.ts +10 -10
- package/template2/store/example-store.tsx +16 -16
- package/template2/store/user-store.tsx +29 -29
- package/template2/testing/msw/handlers/index.ts +6 -6
- package/template2/testing/msw/server.ts +4 -4
- package/template2/tsconfig.json +34 -34
- package/template2/vitest.config.ts +17 -17
- package/template2/vitest.setup.ts +7 -7
- package/template3/README.md +34 -34
- package/template3/_gitignore +16 -16
- package/template3/components.json +21 -0
- package/template3/index.html +8 -2
- package/template3/package.json +48 -22
- package/template3/postcss.config.mjs +5 -0
- package/template3/rspack.config.mjs +59 -51
- package/template3/src/App.tsx +16 -11
- package/template3/src/components/author-credit.tsx +42 -42
- package/template3/src/components/layout.tsx +59 -0
- package/template3/src/components/matrix-rain.tsx +71 -0
- package/template3/src/components/ui/accordion.tsx +64 -0
- package/template3/src/components/ui/alert-dialog.tsx +196 -0
- package/template3/src/components/ui/alert.tsx +66 -0
- package/template3/src/components/ui/aspect-ratio.tsx +11 -0
- package/template3/src/components/ui/avatar.tsx +107 -0
- package/template3/src/components/ui/badge.tsx +48 -0
- package/template3/src/components/ui/breadcrumb.tsx +109 -0
- package/template3/src/components/ui/button-group.tsx +83 -0
- package/template3/src/components/ui/button.tsx +64 -0
- package/template3/src/components/ui/calendar.tsx +218 -0
- package/template3/src/components/ui/card.tsx +92 -0
- package/template3/src/components/ui/carousel.tsx +241 -0
- package/template3/src/components/ui/chart.tsx +372 -0
- package/template3/src/components/ui/checkbox.tsx +32 -0
- package/template3/src/components/ui/collapsible.tsx +31 -0
- package/template3/src/components/ui/combobox.tsx +310 -0
- package/template3/src/components/ui/command.tsx +184 -0
- package/template3/src/components/ui/context-menu.tsx +252 -0
- package/template3/src/components/ui/dialog.tsx +156 -0
- package/template3/src/components/ui/direction.tsx +22 -0
- package/template3/src/components/ui/drawer.tsx +133 -0
- package/template3/src/components/ui/dropdown-menu.tsx +257 -0
- package/template3/src/components/ui/empty.tsx +104 -0
- package/template3/src/components/ui/field.tsx +248 -0
- package/template3/src/components/ui/form.tsx +165 -0
- package/template3/src/components/ui/hover-card.tsx +42 -0
- package/template3/src/components/ui/input-group.tsx +168 -0
- package/template3/src/components/ui/input-otp.tsx +77 -0
- package/template3/src/components/ui/input.tsx +21 -0
- package/template3/src/components/ui/item.tsx +193 -0
- package/template3/src/components/ui/kbd.tsx +28 -0
- package/template3/src/components/ui/label.tsx +22 -0
- package/template3/src/components/ui/menubar.tsx +276 -0
- package/template3/src/components/ui/native-select.tsx +62 -0
- package/template3/src/components/ui/navigation-menu.tsx +168 -0
- package/template3/src/components/ui/pagination.tsx +127 -0
- package/template3/src/components/ui/popover.tsx +87 -0
- package/template3/src/components/ui/progress.tsx +31 -0
- package/template3/src/components/ui/radio-group.tsx +43 -0
- package/template3/src/components/ui/resizable.tsx +53 -0
- package/template3/src/components/ui/scroll-area.tsx +56 -0
- package/template3/src/components/ui/select.tsx +190 -0
- package/template3/src/components/ui/separator.tsx +26 -0
- package/template3/src/components/ui/sheet.tsx +143 -0
- package/template3/src/components/ui/sidebar.tsx +724 -0
- package/template3/src/components/ui/skeleton.tsx +13 -0
- package/template3/src/components/ui/slider.tsx +61 -0
- package/template3/src/components/ui/sonner.tsx +40 -0
- package/template3/src/components/ui/spinner.tsx +16 -0
- package/template3/src/components/ui/switch.tsx +33 -0
- package/template3/src/components/ui/table.tsx +116 -0
- package/template3/src/components/ui/tabs.tsx +89 -0
- package/template3/src/components/ui/textarea.tsx +18 -0
- package/template3/src/components/ui/toggle-group.tsx +83 -0
- package/template3/src/components/ui/toggle.tsx +47 -0
- package/template3/src/components/ui/tooltip.tsx +55 -0
- package/template3/src/hooks/use-mobile.ts +19 -0
- package/template3/src/index.css +175 -32
- package/template3/src/lib/utils.ts +6 -0
- package/template3/src/main.tsx +10 -10
- package/template3/src/pages/about.tsx +113 -0
- package/template3/src/pages/contact.tsx +111 -0
- package/template3/src/pages/home.tsx +81 -0
- package/template3/tsconfig.json +24 -20
- package/template/pnpm-lock.yaml +0 -3274
- package/template2/tsconfig.tsbuildinfo +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import 'server-only';
|
|
2
|
-
import type { Locale } from '@/config/constants';
|
|
3
|
-
|
|
4
|
-
const locales = {
|
|
5
|
-
az: () => import('../../locales/az.json').then((m) => m.default),
|
|
6
|
-
en: () => import('../../locales/en.json').then((m) => m.default),
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export const getDictionary = async (locale: Locale) =>
|
|
10
|
-
locales[locale]?.() ?? locales.az();
|
|
1
|
+
import 'server-only';
|
|
2
|
+
import type { Locale } from '@/config/constants';
|
|
3
|
+
|
|
4
|
+
const locales = {
|
|
5
|
+
az: () => import('../../locales/az.json').then((m) => m.default),
|
|
6
|
+
en: () => import('../../locales/en.json').then((m) => m.default),
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const getDictionary = async (locale: Locale) =>
|
|
10
|
+
locales[locale]?.() ?? locales.az();
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import Link from 'next/link';
|
|
2
|
-
import { Button } from '@/components/ui/button';
|
|
3
|
-
import {
|
|
4
|
-
Card,
|
|
5
|
-
CardContent,
|
|
6
|
-
CardDescription,
|
|
7
|
-
CardHeader,
|
|
8
|
-
CardTitle,
|
|
9
|
-
} from '@/components/ui/card';
|
|
10
|
-
import { getDictionary } from './locales';
|
|
11
|
-
import type { Locale } from '@/config/constants';
|
|
12
|
-
|
|
13
|
-
export default async function HomePage({
|
|
14
|
-
params,
|
|
15
|
-
}: Readonly<{ params: Promise<{ locale: Locale }> }>) {
|
|
16
|
-
const { locale } = await params;
|
|
17
|
-
const dict = await getDictionary(locale);
|
|
18
|
-
const t = dict.home;
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<main className="flex min-h-screen items-center justify-center p-6">
|
|
22
|
-
<Card className="w-full max-w-xl">
|
|
23
|
-
<CardHeader>
|
|
24
|
-
<CardTitle className="text-2xl">{t.title}</CardTitle>
|
|
25
|
-
<CardDescription>{t.subtitle}</CardDescription>
|
|
26
|
-
</CardHeader>
|
|
27
|
-
<CardContent className="flex flex-wrap gap-3">
|
|
28
|
-
<Button asChild>
|
|
29
|
-
<Link href={`/${locale}/login`}>{t.login}</Link>
|
|
30
|
-
</Button>
|
|
31
|
-
<Button asChild variant="outline">
|
|
32
|
-
<Link href={`/${locale}/dashboard`}>{t.dashboard}</Link>
|
|
33
|
-
</Button>
|
|
34
|
-
</CardContent>
|
|
35
|
-
</Card>
|
|
36
|
-
</main>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
1
|
+
import Link from 'next/link';
|
|
2
|
+
import { Button } from '@/components/ui/button';
|
|
3
|
+
import {
|
|
4
|
+
Card,
|
|
5
|
+
CardContent,
|
|
6
|
+
CardDescription,
|
|
7
|
+
CardHeader,
|
|
8
|
+
CardTitle,
|
|
9
|
+
} from '@/components/ui/card';
|
|
10
|
+
import { getDictionary } from './locales';
|
|
11
|
+
import type { Locale } from '@/config/constants';
|
|
12
|
+
|
|
13
|
+
export default async function HomePage({
|
|
14
|
+
params,
|
|
15
|
+
}: Readonly<{ params: Promise<{ locale: Locale }> }>) {
|
|
16
|
+
const { locale } = await params;
|
|
17
|
+
const dict = await getDictionary(locale);
|
|
18
|
+
const t = dict.home;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<main className="flex min-h-screen items-center justify-center p-6">
|
|
22
|
+
<Card className="w-full max-w-xl">
|
|
23
|
+
<CardHeader>
|
|
24
|
+
<CardTitle className="text-2xl">{t.title}</CardTitle>
|
|
25
|
+
<CardDescription>{t.subtitle}</CardDescription>
|
|
26
|
+
</CardHeader>
|
|
27
|
+
<CardContent className="flex flex-wrap gap-3">
|
|
28
|
+
<Button asChild>
|
|
29
|
+
<Link href={`/${locale}/login`}>{t.login}</Link>
|
|
30
|
+
</Button>
|
|
31
|
+
<Button asChild variant="outline">
|
|
32
|
+
<Link href={`/${locale}/dashboard`}>{t.dashboard}</Link>
|
|
33
|
+
</Button>
|
|
34
|
+
</CardContent>
|
|
35
|
+
</Card>
|
|
36
|
+
</main>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
|
|
3
|
-
// Clears the auth cookie(s) when the backend logout call fails or is skipped.
|
|
4
|
-
// Add the cookie names your backend sets.
|
|
5
|
-
export async function POST() {
|
|
6
|
-
const res = NextResponse.json({ ok: true });
|
|
7
|
-
res.cookies.delete('access_token');
|
|
8
|
-
res.cookies.delete('refresh_token');
|
|
9
|
-
return res;
|
|
10
|
-
}
|
|
1
|
+
import { NextResponse } from 'next/server';
|
|
2
|
+
|
|
3
|
+
// Clears the auth cookie(s) when the backend logout call fails or is skipped.
|
|
4
|
+
// Add the cookie names your backend sets.
|
|
5
|
+
export async function POST() {
|
|
6
|
+
const res = NextResponse.json({ ok: true });
|
|
7
|
+
res.cookies.delete('access_token');
|
|
8
|
+
res.cookies.delete('refresh_token');
|
|
9
|
+
return res;
|
|
10
|
+
}
|
|
@@ -1,127 +1,127 @@
|
|
|
1
|
-
@import "tailwindcss";
|
|
2
|
-
@import "tw-animate-css";
|
|
3
|
-
|
|
4
|
-
@custom-variant dark (&:is(.dark *));
|
|
5
|
-
|
|
6
|
-
:root,
|
|
7
|
-
.default {
|
|
8
|
-
--background: oklch(0.99 0 0);
|
|
9
|
-
--foreground: oklch(0.15 0 0);
|
|
10
|
-
--card: oklch(1 0 0);
|
|
11
|
-
--card-foreground: oklch(0.15 0 0);
|
|
12
|
-
--popover: oklch(1 0 0);
|
|
13
|
-
--popover-foreground: oklch(0.15 0 0);
|
|
14
|
-
--primary: oklch(0.55 0.18 250);
|
|
15
|
-
--primary-foreground: oklch(0.99 0 0);
|
|
16
|
-
--secondary: oklch(0.96 0 0);
|
|
17
|
-
--secondary-foreground: oklch(0.15 0 0);
|
|
18
|
-
--muted: oklch(0.96 0.01 250);
|
|
19
|
-
--muted-foreground: oklch(0.5 0 0);
|
|
20
|
-
--accent: oklch(0.65 0.2 30);
|
|
21
|
-
--accent-foreground: oklch(0.99 0 0);
|
|
22
|
-
--destructive: oklch(0.577 0.245 27.325);
|
|
23
|
-
--destructive-foreground: oklch(0.99 0 0);
|
|
24
|
-
--border: oklch(0.9 0 0);
|
|
25
|
-
--input: oklch(0.9 0 0);
|
|
26
|
-
--ring: oklch(0.55 0.18 250);
|
|
27
|
-
--chart-1: oklch(0.55 0.18 250);
|
|
28
|
-
--chart-2: oklch(0.65 0.2 30);
|
|
29
|
-
--chart-3: oklch(0.6 0.15 180);
|
|
30
|
-
--chart-4: oklch(0.7 0.18 320);
|
|
31
|
-
--chart-5: oklch(0.65 0.16 140);
|
|
32
|
-
--radius: 0.75rem;
|
|
33
|
-
--sidebar: oklch(0.99 0 0);
|
|
34
|
-
--sidebar-foreground: oklch(0.15 0 0);
|
|
35
|
-
--sidebar-primary: oklch(0.55 0.18 250);
|
|
36
|
-
--sidebar-primary-foreground: oklch(0.99 0 0);
|
|
37
|
-
--sidebar-accent: oklch(0.96 0 0);
|
|
38
|
-
--sidebar-accent-foreground: oklch(0.15 0 0);
|
|
39
|
-
--sidebar-border: oklch(0.9 0 0);
|
|
40
|
-
--sidebar-ring: oklch(0.55 0.18 250);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.dark {
|
|
44
|
-
--background: oklch(0.12 0 0);
|
|
45
|
-
--foreground: oklch(0.98 0 0);
|
|
46
|
-
--card: oklch(0.15 0 0);
|
|
47
|
-
--card-foreground: oklch(0.98 0 0);
|
|
48
|
-
--popover: oklch(0.15 0 0);
|
|
49
|
-
--popover-foreground: oklch(0.98 0 0);
|
|
50
|
-
--primary: oklch(0.65 0.2 250);
|
|
51
|
-
--primary-foreground: oklch(0.12 0 0);
|
|
52
|
-
--secondary: oklch(0.2 0 0);
|
|
53
|
-
--secondary-foreground: oklch(0.98 0 0);
|
|
54
|
-
--muted: oklch(0.2 0.01 250);
|
|
55
|
-
--muted-foreground: oklch(0.6 0 0);
|
|
56
|
-
--accent: oklch(0.7 0.22 30);
|
|
57
|
-
--accent-foreground: oklch(0.12 0 0);
|
|
58
|
-
--destructive: oklch(0.5 0.2 27);
|
|
59
|
-
--destructive-foreground: oklch(0.98 0 0);
|
|
60
|
-
--border: oklch(0.25 0 0);
|
|
61
|
-
--input: oklch(0.25 0 0);
|
|
62
|
-
--ring: oklch(0.65 0.2 250);
|
|
63
|
-
--chart-1: oklch(0.65 0.2 250);
|
|
64
|
-
--chart-2: oklch(0.7 0.22 30);
|
|
65
|
-
--chart-3: oklch(0.6 0.15 180);
|
|
66
|
-
--chart-4: oklch(0.7 0.18 320);
|
|
67
|
-
--chart-5: oklch(0.65 0.16 140);
|
|
68
|
-
--sidebar: oklch(0.15 0 0);
|
|
69
|
-
--sidebar-foreground: oklch(0.98 0 0);
|
|
70
|
-
--sidebar-primary: oklch(0.65 0.2 250);
|
|
71
|
-
--sidebar-primary-foreground: oklch(0.12 0 0);
|
|
72
|
-
--sidebar-accent: oklch(0.2 0 0);
|
|
73
|
-
--sidebar-accent-foreground: oklch(0.98 0 0);
|
|
74
|
-
--sidebar-border: oklch(0.25 0 0);
|
|
75
|
-
--sidebar-ring: oklch(0.65 0.2 250);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
@theme inline {
|
|
79
|
-
--font-sans: "Geist", "Geist Fallback";
|
|
80
|
-
--font-mono: "Geist Mono", "Geist Mono Fallback";
|
|
81
|
-
--color-background: var(--background);
|
|
82
|
-
--color-foreground: var(--foreground);
|
|
83
|
-
--color-card: var(--card);
|
|
84
|
-
--color-card-foreground: var(--card-foreground);
|
|
85
|
-
--color-popover: var(--popover);
|
|
86
|
-
--color-popover-foreground: var(--popover-foreground);
|
|
87
|
-
--color-primary: var(--primary);
|
|
88
|
-
--color-primary-foreground: var(--primary-foreground);
|
|
89
|
-
--color-secondary: var(--secondary);
|
|
90
|
-
--color-secondary-foreground: var(--secondary-foreground);
|
|
91
|
-
--color-muted: var(--muted);
|
|
92
|
-
--color-muted-foreground: var(--muted-foreground);
|
|
93
|
-
--color-accent: var(--accent);
|
|
94
|
-
--color-accent-foreground: var(--accent-foreground);
|
|
95
|
-
--color-destructive: var(--destructive);
|
|
96
|
-
--color-destructive-foreground: var(--destructive-foreground);
|
|
97
|
-
--color-border: var(--border);
|
|
98
|
-
--color-input: var(--input);
|
|
99
|
-
--color-ring: var(--ring);
|
|
100
|
-
--color-chart-1: var(--chart-1);
|
|
101
|
-
--color-chart-2: var(--chart-2);
|
|
102
|
-
--color-chart-3: var(--chart-3);
|
|
103
|
-
--color-chart-4: var(--chart-4);
|
|
104
|
-
--color-chart-5: var(--chart-5);
|
|
105
|
-
--radius-sm: calc(var(--radius) - 4px);
|
|
106
|
-
--radius-md: calc(var(--radius) - 2px);
|
|
107
|
-
--radius-lg: var(--radius);
|
|
108
|
-
--radius-xl: calc(var(--radius) + 4px);
|
|
109
|
-
--color-sidebar: var(--sidebar);
|
|
110
|
-
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
111
|
-
--color-sidebar-primary: var(--sidebar-primary);
|
|
112
|
-
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
113
|
-
--color-sidebar-accent: var(--sidebar-accent);
|
|
114
|
-
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
115
|
-
--color-sidebar-border: var(--sidebar-border);
|
|
116
|
-
--color-sidebar-ring: var(--sidebar-ring);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
@layer base {
|
|
120
|
-
* {
|
|
121
|
-
@apply border-border outline-ring/50;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
body {
|
|
125
|
-
@apply bg-background text-foreground;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
@import "tw-animate-css";
|
|
3
|
+
|
|
4
|
+
@custom-variant dark (&:is(.dark *));
|
|
5
|
+
|
|
6
|
+
:root,
|
|
7
|
+
.default {
|
|
8
|
+
--background: oklch(0.99 0 0);
|
|
9
|
+
--foreground: oklch(0.15 0 0);
|
|
10
|
+
--card: oklch(1 0 0);
|
|
11
|
+
--card-foreground: oklch(0.15 0 0);
|
|
12
|
+
--popover: oklch(1 0 0);
|
|
13
|
+
--popover-foreground: oklch(0.15 0 0);
|
|
14
|
+
--primary: oklch(0.55 0.18 250);
|
|
15
|
+
--primary-foreground: oklch(0.99 0 0);
|
|
16
|
+
--secondary: oklch(0.96 0 0);
|
|
17
|
+
--secondary-foreground: oklch(0.15 0 0);
|
|
18
|
+
--muted: oklch(0.96 0.01 250);
|
|
19
|
+
--muted-foreground: oklch(0.5 0 0);
|
|
20
|
+
--accent: oklch(0.65 0.2 30);
|
|
21
|
+
--accent-foreground: oklch(0.99 0 0);
|
|
22
|
+
--destructive: oklch(0.577 0.245 27.325);
|
|
23
|
+
--destructive-foreground: oklch(0.99 0 0);
|
|
24
|
+
--border: oklch(0.9 0 0);
|
|
25
|
+
--input: oklch(0.9 0 0);
|
|
26
|
+
--ring: oklch(0.55 0.18 250);
|
|
27
|
+
--chart-1: oklch(0.55 0.18 250);
|
|
28
|
+
--chart-2: oklch(0.65 0.2 30);
|
|
29
|
+
--chart-3: oklch(0.6 0.15 180);
|
|
30
|
+
--chart-4: oklch(0.7 0.18 320);
|
|
31
|
+
--chart-5: oklch(0.65 0.16 140);
|
|
32
|
+
--radius: 0.75rem;
|
|
33
|
+
--sidebar: oklch(0.99 0 0);
|
|
34
|
+
--sidebar-foreground: oklch(0.15 0 0);
|
|
35
|
+
--sidebar-primary: oklch(0.55 0.18 250);
|
|
36
|
+
--sidebar-primary-foreground: oklch(0.99 0 0);
|
|
37
|
+
--sidebar-accent: oklch(0.96 0 0);
|
|
38
|
+
--sidebar-accent-foreground: oklch(0.15 0 0);
|
|
39
|
+
--sidebar-border: oklch(0.9 0 0);
|
|
40
|
+
--sidebar-ring: oklch(0.55 0.18 250);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.dark {
|
|
44
|
+
--background: oklch(0.12 0 0);
|
|
45
|
+
--foreground: oklch(0.98 0 0);
|
|
46
|
+
--card: oklch(0.15 0 0);
|
|
47
|
+
--card-foreground: oklch(0.98 0 0);
|
|
48
|
+
--popover: oklch(0.15 0 0);
|
|
49
|
+
--popover-foreground: oklch(0.98 0 0);
|
|
50
|
+
--primary: oklch(0.65 0.2 250);
|
|
51
|
+
--primary-foreground: oklch(0.12 0 0);
|
|
52
|
+
--secondary: oklch(0.2 0 0);
|
|
53
|
+
--secondary-foreground: oklch(0.98 0 0);
|
|
54
|
+
--muted: oklch(0.2 0.01 250);
|
|
55
|
+
--muted-foreground: oklch(0.6 0 0);
|
|
56
|
+
--accent: oklch(0.7 0.22 30);
|
|
57
|
+
--accent-foreground: oklch(0.12 0 0);
|
|
58
|
+
--destructive: oklch(0.5 0.2 27);
|
|
59
|
+
--destructive-foreground: oklch(0.98 0 0);
|
|
60
|
+
--border: oklch(0.25 0 0);
|
|
61
|
+
--input: oklch(0.25 0 0);
|
|
62
|
+
--ring: oklch(0.65 0.2 250);
|
|
63
|
+
--chart-1: oklch(0.65 0.2 250);
|
|
64
|
+
--chart-2: oklch(0.7 0.22 30);
|
|
65
|
+
--chart-3: oklch(0.6 0.15 180);
|
|
66
|
+
--chart-4: oklch(0.7 0.18 320);
|
|
67
|
+
--chart-5: oklch(0.65 0.16 140);
|
|
68
|
+
--sidebar: oklch(0.15 0 0);
|
|
69
|
+
--sidebar-foreground: oklch(0.98 0 0);
|
|
70
|
+
--sidebar-primary: oklch(0.65 0.2 250);
|
|
71
|
+
--sidebar-primary-foreground: oklch(0.12 0 0);
|
|
72
|
+
--sidebar-accent: oklch(0.2 0 0);
|
|
73
|
+
--sidebar-accent-foreground: oklch(0.98 0 0);
|
|
74
|
+
--sidebar-border: oklch(0.25 0 0);
|
|
75
|
+
--sidebar-ring: oklch(0.65 0.2 250);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@theme inline {
|
|
79
|
+
--font-sans: "Geist", "Geist Fallback";
|
|
80
|
+
--font-mono: "Geist Mono", "Geist Mono Fallback";
|
|
81
|
+
--color-background: var(--background);
|
|
82
|
+
--color-foreground: var(--foreground);
|
|
83
|
+
--color-card: var(--card);
|
|
84
|
+
--color-card-foreground: var(--card-foreground);
|
|
85
|
+
--color-popover: var(--popover);
|
|
86
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
87
|
+
--color-primary: var(--primary);
|
|
88
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
89
|
+
--color-secondary: var(--secondary);
|
|
90
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
91
|
+
--color-muted: var(--muted);
|
|
92
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
93
|
+
--color-accent: var(--accent);
|
|
94
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
95
|
+
--color-destructive: var(--destructive);
|
|
96
|
+
--color-destructive-foreground: var(--destructive-foreground);
|
|
97
|
+
--color-border: var(--border);
|
|
98
|
+
--color-input: var(--input);
|
|
99
|
+
--color-ring: var(--ring);
|
|
100
|
+
--color-chart-1: var(--chart-1);
|
|
101
|
+
--color-chart-2: var(--chart-2);
|
|
102
|
+
--color-chart-3: var(--chart-3);
|
|
103
|
+
--color-chart-4: var(--chart-4);
|
|
104
|
+
--color-chart-5: var(--chart-5);
|
|
105
|
+
--radius-sm: calc(var(--radius) - 4px);
|
|
106
|
+
--radius-md: calc(var(--radius) - 2px);
|
|
107
|
+
--radius-lg: var(--radius);
|
|
108
|
+
--radius-xl: calc(var(--radius) + 4px);
|
|
109
|
+
--color-sidebar: var(--sidebar);
|
|
110
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
111
|
+
--color-sidebar-primary: var(--sidebar-primary);
|
|
112
|
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
113
|
+
--color-sidebar-accent: var(--sidebar-accent);
|
|
114
|
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
115
|
+
--color-sidebar-border: var(--sidebar-border);
|
|
116
|
+
--color-sidebar-ring: var(--sidebar-ring);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@layer base {
|
|
120
|
+
* {
|
|
121
|
+
@apply border-border outline-ring/50;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
body {
|
|
125
|
+
@apply bg-background text-foreground;
|
|
126
|
+
}
|
|
127
|
+
}
|
package/template2/app/layout.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
// Root layout is a passthrough — the real <html>/<body> shell lives in
|
|
4
|
-
// app/[locale]/layout.tsx so every page is locale-scoped.
|
|
5
|
-
export default function RootLayout({ children }: { children: ReactNode }) {
|
|
6
|
-
return children;
|
|
7
|
-
}
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
// Root layout is a passthrough — the real <html>/<body> shell lives in
|
|
4
|
+
// app/[locale]/layout.tsx so every page is locale-scoped.
|
|
5
|
+
export default function RootLayout({ children }: { children: ReactNode }) {
|
|
6
|
+
return children;
|
|
7
|
+
}
|
package/template2/app/page.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { redirect } from 'next/navigation';
|
|
2
|
-
import { DEFAULT_LOCALE } from '@/config/constants';
|
|
3
|
-
|
|
4
|
-
export default function RootPage() {
|
|
5
|
-
redirect(`/${DEFAULT_LOCALE}`);
|
|
6
|
-
}
|
|
1
|
+
import { redirect } from 'next/navigation';
|
|
2
|
+
import { DEFAULT_LOCALE } from '@/config/constants';
|
|
3
|
+
|
|
4
|
+
export default function RootPage() {
|
|
5
|
+
redirect(`/${DEFAULT_LOCALE}`);
|
|
6
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useEffect } from 'react';
|
|
4
|
-
import { usePathname } from 'next/navigation';
|
|
5
|
-
|
|
6
|
-
// Listens for the `auth:unauthorized` event dispatched by the axios interceptor
|
|
7
|
-
// (see services/httpClient/httpClient.ts) and bounces the user to /login.
|
|
8
|
-
export function AuthEventListener() {
|
|
9
|
-
const pathname = usePathname();
|
|
10
|
-
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
const locale = pathname.split('/')[1] || 'az';
|
|
13
|
-
const handler = async () => {
|
|
14
|
-
await fetch('/api/clear-session', { method: 'POST' }).catch(() => {});
|
|
15
|
-
window.location.href = `/${locale}/login`;
|
|
16
|
-
};
|
|
17
|
-
window.addEventListener('auth:unauthorized', handler);
|
|
18
|
-
return () => window.removeEventListener('auth:unauthorized', handler);
|
|
19
|
-
}, [pathname]);
|
|
20
|
-
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import { usePathname } from 'next/navigation';
|
|
5
|
+
|
|
6
|
+
// Listens for the `auth:unauthorized` event dispatched by the axios interceptor
|
|
7
|
+
// (see services/httpClient/httpClient.ts) and bounces the user to /login.
|
|
8
|
+
export function AuthEventListener() {
|
|
9
|
+
const pathname = usePathname();
|
|
10
|
+
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const locale = pathname.split('/')[1] || 'az';
|
|
13
|
+
const handler = async () => {
|
|
14
|
+
await fetch('/api/clear-session', { method: 'POST' }).catch(() => {});
|
|
15
|
+
window.location.href = `/${locale}/login`;
|
|
16
|
+
};
|
|
17
|
+
window.addEventListener('auth:unauthorized', handler);
|
|
18
|
+
return () => window.removeEventListener('auth:unauthorized', handler);
|
|
19
|
+
}, [pathname]);
|
|
20
|
+
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
const links = [
|
|
2
|
-
{ label: 'GitHub', href: 'https://github.com/javidselimov' },
|
|
3
|
-
{ label: 'LinkedIn', href: 'https://www.linkedin.com/in/javidsalim/' },
|
|
4
|
-
{ label: 'npm', href: 'https://www.npmjs.com/~ubuligan' },
|
|
5
|
-
];
|
|
6
|
-
|
|
7
|
-
export function AuthorCredit() {
|
|
8
|
-
return (
|
|
9
|
-
<div className="fixed bottom-4 right-4 z-50 flex items-center gap-3 rounded-full border bg-background/80 px-4 py-2 text-sm shadow-lg backdrop-blur">
|
|
10
|
-
<span className="font-medium">Javid Salimov</span>
|
|
11
|
-
<span className="text-muted-foreground">·</span>
|
|
12
|
-
{links.map((l) => (
|
|
13
|
-
<a
|
|
14
|
-
key={l.label}
|
|
15
|
-
href={l.href}
|
|
16
|
-
target="_blank"
|
|
17
|
-
rel="noreferrer"
|
|
18
|
-
className="text-muted-foreground transition-colors hover:text-foreground"
|
|
19
|
-
>
|
|
20
|
-
{l.label}
|
|
21
|
-
</a>
|
|
22
|
-
))}
|
|
23
|
-
</div>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
1
|
+
const links = [
|
|
2
|
+
{ label: 'GitHub', href: 'https://github.com/javidselimov' },
|
|
3
|
+
{ label: 'LinkedIn', href: 'https://www.linkedin.com/in/javidsalim/' },
|
|
4
|
+
{ label: 'npm', href: 'https://www.npmjs.com/~ubuligan' },
|
|
5
|
+
];
|
|
6
|
+
|
|
7
|
+
export function AuthorCredit() {
|
|
8
|
+
return (
|
|
9
|
+
<div className="fixed bottom-4 right-4 z-50 flex items-center gap-3 rounded-full border bg-background/80 px-4 py-2 text-sm shadow-lg backdrop-blur">
|
|
10
|
+
<span className="font-medium">Javid Salimov</span>
|
|
11
|
+
<span className="text-muted-foreground">·</span>
|
|
12
|
+
{links.map((l) => (
|
|
13
|
+
<a
|
|
14
|
+
key={l.label}
|
|
15
|
+
href={l.href}
|
|
16
|
+
target="_blank"
|
|
17
|
+
rel="noreferrer"
|
|
18
|
+
className="text-muted-foreground transition-colors hover:text-foreground"
|
|
19
|
+
>
|
|
20
|
+
{l.label}
|
|
21
|
+
</a>
|
|
22
|
+
))}
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
|
|
5
|
-
type Mode = "dark" | "light";
|
|
6
|
-
|
|
7
|
-
type ThemeProviderProps = {
|
|
8
|
-
children: React.ReactNode;
|
|
9
|
-
defaultMode?: Mode;
|
|
10
|
-
storageKey?: string;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
type ThemeProviderState = {
|
|
14
|
-
mode: Mode;
|
|
15
|
-
setMode: (mode: Mode) => void;
|
|
16
|
-
toggleMode: () => void;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const initialState: ThemeProviderState = {
|
|
20
|
-
mode: "light",
|
|
21
|
-
setMode: () => null,
|
|
22
|
-
toggleMode: () => null,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const ThemeProviderContext =
|
|
26
|
-
React.createContext<ThemeProviderState>(initialState);
|
|
27
|
-
|
|
28
|
-
export function ThemeProvider({
|
|
29
|
-
children,
|
|
30
|
-
defaultMode = "light",
|
|
31
|
-
storageKey = "app-theme",
|
|
32
|
-
...props
|
|
33
|
-
}: Readonly<ThemeProviderProps>) {
|
|
34
|
-
const [mode, setModeState] = React.useState<Mode>(() => {
|
|
35
|
-
if (typeof window !== "undefined") {
|
|
36
|
-
return (localStorage.getItem(`${storageKey}-mode`) as Mode) || defaultMode;
|
|
37
|
-
}
|
|
38
|
-
return defaultMode;
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
React.useEffect(() => {
|
|
42
|
-
const root = window.document.documentElement;
|
|
43
|
-
root.classList.remove("light", "dark");
|
|
44
|
-
root.classList.add(mode);
|
|
45
|
-
}, [mode]);
|
|
46
|
-
|
|
47
|
-
const setMode = React.useCallback(
|
|
48
|
-
(next: Mode) => {
|
|
49
|
-
localStorage.setItem(`${storageKey}-mode`, next);
|
|
50
|
-
setModeState(next);
|
|
51
|
-
},
|
|
52
|
-
[storageKey],
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
const value = React.useMemo<ThemeProviderState>(
|
|
56
|
-
() => ({
|
|
57
|
-
mode,
|
|
58
|
-
setMode,
|
|
59
|
-
toggleMode: () => setMode(mode === "dark" ? "light" : "dark"),
|
|
60
|
-
}),
|
|
61
|
-
[mode, setMode],
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<ThemeProviderContext.Provider {...props} value={value}>
|
|
66
|
-
{children}
|
|
67
|
-
</ThemeProviderContext.Provider>
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export const useTheme = () => {
|
|
72
|
-
const context = React.useContext(ThemeProviderContext);
|
|
73
|
-
|
|
74
|
-
if (context === undefined)
|
|
75
|
-
throw new Error("useTheme must be used within a ThemeProvider");
|
|
76
|
-
|
|
77
|
-
return context;
|
|
78
|
-
};
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
type Mode = "dark" | "light";
|
|
6
|
+
|
|
7
|
+
type ThemeProviderProps = {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
defaultMode?: Mode;
|
|
10
|
+
storageKey?: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type ThemeProviderState = {
|
|
14
|
+
mode: Mode;
|
|
15
|
+
setMode: (mode: Mode) => void;
|
|
16
|
+
toggleMode: () => void;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const initialState: ThemeProviderState = {
|
|
20
|
+
mode: "light",
|
|
21
|
+
setMode: () => null,
|
|
22
|
+
toggleMode: () => null,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const ThemeProviderContext =
|
|
26
|
+
React.createContext<ThemeProviderState>(initialState);
|
|
27
|
+
|
|
28
|
+
export function ThemeProvider({
|
|
29
|
+
children,
|
|
30
|
+
defaultMode = "light",
|
|
31
|
+
storageKey = "app-theme",
|
|
32
|
+
...props
|
|
33
|
+
}: Readonly<ThemeProviderProps>) {
|
|
34
|
+
const [mode, setModeState] = React.useState<Mode>(() => {
|
|
35
|
+
if (typeof window !== "undefined") {
|
|
36
|
+
return (localStorage.getItem(`${storageKey}-mode`) as Mode) || defaultMode;
|
|
37
|
+
}
|
|
38
|
+
return defaultMode;
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
React.useEffect(() => {
|
|
42
|
+
const root = window.document.documentElement;
|
|
43
|
+
root.classList.remove("light", "dark");
|
|
44
|
+
root.classList.add(mode);
|
|
45
|
+
}, [mode]);
|
|
46
|
+
|
|
47
|
+
const setMode = React.useCallback(
|
|
48
|
+
(next: Mode) => {
|
|
49
|
+
localStorage.setItem(`${storageKey}-mode`, next);
|
|
50
|
+
setModeState(next);
|
|
51
|
+
},
|
|
52
|
+
[storageKey],
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const value = React.useMemo<ThemeProviderState>(
|
|
56
|
+
() => ({
|
|
57
|
+
mode,
|
|
58
|
+
setMode,
|
|
59
|
+
toggleMode: () => setMode(mode === "dark" ? "light" : "dark"),
|
|
60
|
+
}),
|
|
61
|
+
[mode, setMode],
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<ThemeProviderContext.Provider {...props} value={value}>
|
|
66
|
+
{children}
|
|
67
|
+
</ThemeProviderContext.Provider>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const useTheme = () => {
|
|
72
|
+
const context = React.useContext(ThemeProviderContext);
|
|
73
|
+
|
|
74
|
+
if (context === undefined)
|
|
75
|
+
throw new Error("useTheme must be used within a ThemeProvider");
|
|
76
|
+
|
|
77
|
+
return context;
|
|
78
|
+
};
|