@poadio/starter-next 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/.dockerignore +9 -0
  2. package/.env.example +8 -0
  3. package/Dockerfile +29 -0
  4. package/README.md +141 -2
  5. package/bun.lock +156 -0
  6. package/gitignore +37 -0
  7. package/next.config.ts +14 -0
  8. package/package.json +70 -4
  9. package/public/logo.svg +1 -0
  10. package/public/providers/google.svg +1 -0
  11. package/public/providers/keycloak.svg +1 -0
  12. package/scripts/dev.mjs +68 -0
  13. package/scripts/env.mjs +130 -0
  14. package/scripts/env.test.mjs +71 -0
  15. package/src/app/(auth)/login/login-form.tsx +258 -0
  16. package/src/app/(auth)/login/page.tsx +16 -0
  17. package/src/app/(auth)/mfa/mfa-form.tsx +55 -0
  18. package/src/app/(auth)/mfa/page.tsx +16 -0
  19. package/src/app/(auth)/reset/page.tsx +16 -0
  20. package/src/app/(auth)/reset/reset-form.tsx +51 -0
  21. package/src/app/app/account/account.css +36 -0
  22. package/src/app/app/account/account.tsx +476 -0
  23. package/src/app/app/account/page.tsx +18 -0
  24. package/src/app/app/dashboard.tsx +58 -0
  25. package/src/app/app/hello/[name]/page.tsx +38 -0
  26. package/src/app/app/layout.tsx +12 -0
  27. package/src/app/app/page.tsx +18 -0
  28. package/src/app/app/public/page.tsx +15 -0
  29. package/src/app/app/public/public-content.tsx +31 -0
  30. package/src/app/globals.css +271 -0
  31. package/src/app/home.css +186 -0
  32. package/src/app/home.tsx +92 -0
  33. package/src/app/icon.svg +1 -0
  34. package/src/app/layout.tsx +58 -0
  35. package/src/app/not-found.tsx +6 -0
  36. package/src/app/page.tsx +6 -0
  37. package/src/app/providers.tsx +24 -0
  38. package/src/app/setup/page.tsx +39 -0
  39. package/src/app/shell.css +752 -0
  40. package/src/app.meta.ts +41 -0
  41. package/src/components/brand.tsx +15 -0
  42. package/src/components/captcha.tsx +93 -0
  43. package/src/components/link-button.tsx +9 -0
  44. package/src/components/rich.tsx +14 -0
  45. package/src/components/shell/app-menu.tsx +127 -0
  46. package/src/components/shell/app-shell.tsx +268 -0
  47. package/src/components/shell/page-title.tsx +29 -0
  48. package/src/components/shell/switches.tsx +35 -0
  49. package/src/components/shell/use-layout.ts +123 -0
  50. package/src/core/auth.tsx +227 -0
  51. package/src/core/env.server.ts +27 -0
  52. package/src/core/env.tsx +46 -0
  53. package/src/core/guards.tsx +74 -0
  54. package/src/core/messages.ts +18 -0
  55. package/src/core/providers.ts +32 -0
  56. package/src/core/theme-script.ts +7 -0
  57. package/src/core/theme.tsx +37 -0
  58. package/src/i18n/client.tsx +47 -0
  59. package/src/i18n/en.ts +228 -0
  60. package/src/i18n/fr.ts +251 -0
  61. package/src/i18n/index.ts +38 -0
  62. package/src/i18n/server.ts +19 -0
  63. package/tsconfig.json +21 -0
@@ -0,0 +1,31 @@
1
+ 'use client';
2
+ import { PoadCard, PoadMessage } from '@poadio/ui-react';
3
+ import { LinkButton } from '@/components/link-button';
4
+ import { useAuth } from '@/core/auth';
5
+ import { useT } from '@/i18n/client';
6
+
7
+ export function PublicContent() {
8
+ const auth = useAuth();
9
+ const t = useT();
10
+ return (
11
+ <section className="page">
12
+ <p className="lead">{t('public.lead')}</p>
13
+ <PoadCard>
14
+ {auth.session ? (
15
+ <PoadMessage severity="success" variant="soft">
16
+ {t('public.signedIn', { name: auth.displayName })}
17
+ </PoadMessage>
18
+ ) : (
19
+ <div className="form">
20
+ <PoadMessage severity="info" variant="soft">
21
+ {t('public.signedOut')}
22
+ </PoadMessage>
23
+ <div className="row">
24
+ <LinkButton href="/login?next=%2Fapp">{t('common.signIn')}</LinkButton>
25
+ </div>
26
+ </div>
27
+ )}
28
+ </PoadCard>
29
+ </section>
30
+ );
31
+ }
@@ -0,0 +1,271 @@
1
+ /*
2
+ * Palette de l'application. @poadio/ui-core lit ses tokens --poad-* dans ces
3
+ * variables (--surface-*, --text-*, --accent-*) ; le thème sombre est porté
4
+ * par la classe .theme-dark sur <html> (core/theme.tsx).
5
+ */
6
+ html:root {
7
+ --surface-ground: #f7f8fa;
8
+ --surface-section: #f1f3f6;
9
+ --surface-card: #ffffff;
10
+ --surface-overlay: #ffffff;
11
+ --surface-hover: #f1f3f6;
12
+ --surface-border: #e3e6ec;
13
+ --border-light: #cdd2db;
14
+ --text-primary: #161a23;
15
+ --text-secondary: #4a5263;
16
+ --text-muted: #8a91a0;
17
+ --poad-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
18
+ --poad-accent: #4f46e5;
19
+ --poad-accent-hover: #4338ca;
20
+ --poad-accent-soft: rgba(79, 70, 229, 0.1);
21
+ --poad-ring: rgba(79, 70, 229, 0.45);
22
+ }
23
+ html.theme-dark {
24
+ --surface-ground: #0d0f14;
25
+ --surface-section: #12151c;
26
+ --surface-card: #161a22;
27
+ --surface-overlay: #1b2029;
28
+ --surface-hover: #212734;
29
+ --bg-elevated: #262d3a;
30
+ --surface-border: #272e3b;
31
+ --border-light: #384152;
32
+ --input-bg: #12151c;
33
+ --input-border: #384152;
34
+ --text-primary: #e7e9ef;
35
+ --text-secondary: #b3b9c6;
36
+ --text-muted: #7d8595;
37
+ --poad-accent: #818cf8;
38
+ --poad-accent-hover: #a5b4fc;
39
+ --poad-accent-soft: rgba(129, 140, 248, 0.16);
40
+ --poad-ring: rgba(129, 140, 248, 0.5);
41
+ color-scheme: dark;
42
+ }
43
+
44
+ *,
45
+ *::before,
46
+ *::after {
47
+ box-sizing: border-box;
48
+ }
49
+
50
+ html,
51
+ body {
52
+ margin: 0;
53
+ background: var(--poad-bg);
54
+ color: var(--poad-fg);
55
+ font-family: var(--poad-font);
56
+ }
57
+
58
+ /* Mise en page commune des pages */
59
+ .page {
60
+ display: flex;
61
+ flex-direction: column;
62
+ gap: 16px;
63
+ max-width: 720px;
64
+ }
65
+ .page-wide {
66
+ max-width: 1040px;
67
+ }
68
+ .page-narrow {
69
+ max-width: 460px;
70
+ }
71
+ .page h1 {
72
+ font-size: 22px;
73
+ margin: 0;
74
+ }
75
+ /* Contenu d'un onglet : cartes et messages empilés */
76
+ .stack {
77
+ display: flex;
78
+ flex-direction: column;
79
+ gap: 16px;
80
+ padding-top: 4px;
81
+ }
82
+ .lead {
83
+ margin: 0;
84
+ color: var(--text-secondary, #555);
85
+ font-size: 14px;
86
+ line-height: 1.5;
87
+ }
88
+ .form {
89
+ display: flex;
90
+ flex-direction: column;
91
+ gap: 14px;
92
+ }
93
+ .form > .poad-button {
94
+ align-self: flex-start;
95
+ }
96
+ .row {
97
+ display: flex;
98
+ flex-wrap: wrap;
99
+ align-items: center;
100
+ gap: 8px;
101
+ }
102
+ .muted {
103
+ color: var(--text-secondary, #555);
104
+ font-size: 13px;
105
+ }
106
+ .mono {
107
+ font-family: var(--poad-font-mono, ui-monospace, monospace);
108
+ font-size: 12px;
109
+ overflow-wrap: anywhere;
110
+ }
111
+ code {
112
+ font-family: var(--poad-font-mono, ui-monospace, monospace);
113
+ font-size: 0.92em;
114
+ }
115
+ dl.props {
116
+ display: grid;
117
+ grid-template-columns: max-content minmax(0, 1fr);
118
+ gap: 6px 16px;
119
+ margin: 0;
120
+ font-size: 14px;
121
+ }
122
+ dl.props dt {
123
+ color: var(--text-secondary, #555);
124
+ }
125
+ dl.props dd {
126
+ margin: 0;
127
+ overflow-wrap: anywhere;
128
+ }
129
+ pre.json {
130
+ margin: 0;
131
+ padding: 12px;
132
+ max-height: 360px;
133
+ overflow: auto;
134
+ border-radius: 8px;
135
+ background: var(--poad-bg-subtle);
136
+ font: 12px/1.5 var(--poad-font-mono, ui-monospace, monospace);
137
+ }
138
+ a {
139
+ color: var(--poad-accent);
140
+ }
141
+
142
+ /* Attente d'une garde (session pas encore lue) */
143
+ .pending {
144
+ display: grid;
145
+ place-items: center;
146
+ min-height: 160px;
147
+ color: var(--poad-fg-muted);
148
+ }
149
+
150
+ /* Logo + nom (components/brand.tsx) */
151
+ .brand {
152
+ display: inline-flex;
153
+ align-items: center;
154
+ gap: 10px;
155
+ color: inherit;
156
+ }
157
+ .brand-logo {
158
+ flex: none;
159
+ border-radius: 25%;
160
+ }
161
+ .brand-txt {
162
+ display: flex;
163
+ flex-direction: column;
164
+ gap: 1px;
165
+ min-width: 0;
166
+ }
167
+ .brand-title {
168
+ font-size: 15px;
169
+ font-weight: 600;
170
+ letter-spacing: -0.02em;
171
+ white-space: nowrap;
172
+ }
173
+ .brand-ver {
174
+ font-family: var(--poad-font-mono);
175
+ font-size: 10px;
176
+ color: var(--poad-fg-muted);
177
+ }
178
+
179
+ /* Pages hors du cadre : connexion, MFA, nouveau mot de passe, configuration */
180
+ .screen {
181
+ display: grid;
182
+ place-items: center;
183
+ min-height: 100vh;
184
+ padding: 32px 16px;
185
+ background: var(--poad-bg);
186
+ }
187
+ .screen-top {
188
+ place-items: start center;
189
+ padding-top: 48px;
190
+ }
191
+ .auth {
192
+ width: 100%;
193
+ max-width: 420px;
194
+ display: flex;
195
+ flex-direction: column;
196
+ gap: 16px;
197
+ }
198
+ .auth-head {
199
+ display: flex;
200
+ flex-direction: column;
201
+ gap: 18px;
202
+ margin-bottom: 4px;
203
+ }
204
+ .auth-head a {
205
+ color: inherit;
206
+ text-decoration: none;
207
+ }
208
+ .auth-head h1 {
209
+ margin: 0;
210
+ font-size: 22px;
211
+ letter-spacing: -0.02em;
212
+ }
213
+ .providers {
214
+ display: flex;
215
+ flex-direction: column;
216
+ gap: 8px;
217
+ }
218
+ .provider-logo {
219
+ width: 18px;
220
+ height: 18px;
221
+ }
222
+ .home-link {
223
+ color: inherit;
224
+ text-decoration: none;
225
+ }
226
+ .setup ol {
227
+ margin: 0 0 12px;
228
+ padding-left: 20px;
229
+ line-height: 1.8;
230
+ }
231
+
232
+ /* Choix de la langue : même pastille que la bascule de thème */
233
+ .locale-switch {
234
+ margin-left: 6px;
235
+ }
236
+ .locale-switch button {
237
+ width: auto;
238
+ min-width: 26px;
239
+ padding: 0 6px;
240
+ font: 600 10px/1 var(--poad-font);
241
+ letter-spacing: 0.04em;
242
+ }
243
+
244
+ /* Tableau de bord */
245
+ .hello {
246
+ margin: 0 0 8px;
247
+ font-size: 20px;
248
+ letter-spacing: -0.02em;
249
+ }
250
+ .cards {
251
+ display: grid;
252
+ gap: 16px;
253
+ grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
254
+ }
255
+ .next {
256
+ margin: 0 0 14px;
257
+ padding: 0;
258
+ list-style: none;
259
+ display: flex;
260
+ flex-direction: column;
261
+ gap: 10px;
262
+ font-size: 14px;
263
+ }
264
+ .next li {
265
+ line-height: 1.5;
266
+ }
267
+ .next .poad-icon {
268
+ vertical-align: -2px;
269
+ margin-right: 6px;
270
+ color: var(--poad-fg-muted);
271
+ }
@@ -0,0 +1,186 @@
1
+ /* Page de démarrage (home.tsx) */
2
+ .start {
3
+ position: relative;
4
+ min-height: 100vh;
5
+ display: grid;
6
+ place-items: center;
7
+ padding: 40px 24px 64px;
8
+ background: var(--poad-bg);
9
+ color: var(--poad-fg);
10
+ font-family: var(--poad-font);
11
+ overflow: hidden;
12
+ }
13
+ .start-grid {
14
+ position: absolute;
15
+ inset: 0;
16
+ background-image:
17
+ linear-gradient(var(--poad-border) 1px, transparent 1px),
18
+ linear-gradient(90deg, var(--poad-border) 1px, transparent 1px);
19
+ background-size: 56px 56px;
20
+ mask-image: radial-gradient(ellipse 80% 65% at 50% 42%, #000 25%, transparent 78%);
21
+ -webkit-mask-image: radial-gradient(ellipse 80% 65% at 50% 42%, #000 25%, transparent 78%);
22
+ opacity: 0.85;
23
+ pointer-events: none;
24
+ }
25
+ .start-tools {
26
+ position: absolute;
27
+ top: 18px;
28
+ right: 18px;
29
+ display: flex;
30
+ align-items: center;
31
+ gap: 8px;
32
+ z-index: 1;
33
+ }
34
+ .start-theme {
35
+ width: 30px;
36
+ height: 30px;
37
+ display: grid;
38
+ place-items: center;
39
+ border: none;
40
+ background: none;
41
+ border-radius: var(--poad-radius);
42
+ color: var(--poad-fg-muted);
43
+ cursor: pointer;
44
+ }
45
+ .start-theme:hover {
46
+ background: var(--poad-accent-soft);
47
+ color: var(--poad-fg);
48
+ }
49
+ .start-theme:focus-visible {
50
+ outline: 2px solid var(--poad-ring);
51
+ outline-offset: 1px;
52
+ }
53
+ .start-main {
54
+ position: relative;
55
+ width: 100%;
56
+ max-width: 46rem;
57
+ }
58
+ .start-brand {
59
+ margin-bottom: 36px;
60
+ }
61
+ .start h1 {
62
+ font-size: clamp(32px, 5.2vw, 48px);
63
+ line-height: 1.04;
64
+ font-weight: 600;
65
+ letter-spacing: -0.038em;
66
+ margin: 0 0 18px;
67
+ max-width: 17ch;
68
+ text-wrap: balance;
69
+ }
70
+ .start h1 em {
71
+ font-style: normal;
72
+ color: var(--poad-accent);
73
+ }
74
+ .start-lead {
75
+ font-size: 15px;
76
+ line-height: 1.6;
77
+ color: var(--poad-fg-secondary);
78
+ margin: 0;
79
+ max-width: 58ch;
80
+ }
81
+ .doors {
82
+ display: grid;
83
+ gap: 8px;
84
+ margin-top: 34px;
85
+ }
86
+ @media (min-width: 720px) {
87
+ .doors {
88
+ grid-template-columns: repeat(3, 1fr);
89
+ }
90
+ }
91
+ .door {
92
+ display: flex;
93
+ align-items: flex-start;
94
+ gap: 11px;
95
+ padding: 15px 14px;
96
+ border: 1px solid var(--poad-border);
97
+ border-radius: var(--poad-radius-lg);
98
+ background: var(--poad-surface);
99
+ text-decoration: none;
100
+ color: inherit;
101
+ transition:
102
+ border-color var(--poad-dur) var(--poad-ease),
103
+ transform var(--poad-dur) var(--poad-ease);
104
+ }
105
+ .door:hover {
106
+ border-color: var(--poad-accent);
107
+ transform: translateY(-1px);
108
+ }
109
+ .door:focus-visible {
110
+ outline: 2px solid var(--poad-ring);
111
+ outline-offset: 2px;
112
+ }
113
+ .dicon {
114
+ flex: none;
115
+ width: 30px;
116
+ height: 30px;
117
+ border-radius: 9px;
118
+ display: grid;
119
+ place-items: center;
120
+ background: var(--poad-accent-soft);
121
+ color: var(--poad-accent);
122
+ }
123
+ .dtxt {
124
+ min-width: 0;
125
+ display: flex;
126
+ flex-direction: column;
127
+ gap: 3px;
128
+ }
129
+ .dtitle {
130
+ font-size: 13.5px;
131
+ font-weight: 600;
132
+ letter-spacing: -0.012em;
133
+ }
134
+ .dtext {
135
+ font-size: 12px;
136
+ line-height: 1.45;
137
+ color: var(--poad-fg-muted);
138
+ }
139
+ .darrow {
140
+ margin-left: auto;
141
+ flex: none;
142
+ color: var(--poad-fg-muted);
143
+ transition: color var(--poad-dur) var(--poad-ease);
144
+ }
145
+ .door:hover .darrow {
146
+ color: var(--poad-accent);
147
+ }
148
+ .facts {
149
+ display: flex;
150
+ flex-wrap: wrap;
151
+ row-gap: 14px;
152
+ margin: 40px 0 0;
153
+ padding-top: 22px;
154
+ border-top: 1px solid var(--poad-border);
155
+ }
156
+ .facts > div {
157
+ padding-right: 34px;
158
+ margin-right: 34px;
159
+ border-right: 1px solid var(--poad-border);
160
+ }
161
+ .facts > div:last-child {
162
+ border-right: none;
163
+ margin-right: 0;
164
+ padding-right: 0;
165
+ }
166
+ .facts dt {
167
+ font-size: 22px;
168
+ font-weight: 600;
169
+ letter-spacing: -0.03em;
170
+ font-variant-numeric: tabular-nums;
171
+ }
172
+ .facts dd {
173
+ margin: 4px 0 0;
174
+ font-size: 10.5px;
175
+ letter-spacing: 0.09em;
176
+ text-transform: uppercase;
177
+ color: var(--poad-fg-muted);
178
+ }
179
+ @media (prefers-reduced-motion: reduce) {
180
+ .door {
181
+ transition: none;
182
+ }
183
+ .door:hover {
184
+ transform: none;
185
+ }
186
+ }
@@ -0,0 +1,92 @@
1
+ 'use client';
2
+ import Link from 'next/link';
3
+ import { PoadIcon } from '@poadio/ui-react';
4
+ import { APP } from '@/app.meta';
5
+ import { Brand } from '@/components/brand';
6
+ import { LocaleSwitch } from '@/components/shell/switches';
7
+ import { useAuth } from '@/core/auth';
8
+ import { useTheme } from '@/core/theme';
9
+ import { useT } from '@/i18n/client';
10
+ import './home.css';
11
+
12
+ /**
13
+ * Page de démarrage, hors du cadre de l'application. Écrite sur les tokens
14
+ * --poad-* : elle suit le thème clair/sombre. Les portes d'entrée disent où
15
+ * elles mènent et ce qu'elles démontrent ; à remplacer par celles de l'application.
16
+ */
17
+ export function Home() {
18
+ const theme = useTheme();
19
+ const auth = useAuth();
20
+ const t = useT();
21
+
22
+ const doors = [
23
+ auth.session
24
+ ? { icon: 'layout-dashboard', title: t('home.open'), text: t('home.openText', { name: auth.displayName }), link: '/app' }
25
+ : { icon: 'log-in', title: t('home.signIn'), text: t('home.signInText'), link: '/login' },
26
+ { icon: 'globe', title: t('home.public'), text: t('home.publicText'), link: '/app/public' },
27
+ { icon: 'book-open', title: t('home.docs'), text: t('home.docsText'), href: 'https://github.com/poadio' },
28
+ ];
29
+ const facts = [
30
+ { value: '1', label: t('home.fact1') },
31
+ { value: 'OAuth', label: t('home.fact2') },
32
+ { value: 'MFA', label: t('home.fact3') },
33
+ ];
34
+
35
+ return (
36
+ <div className="start">
37
+ <div className="start-grid" aria-hidden="true" />
38
+
39
+ <div className="start-tools">
40
+ <LocaleSwitch />
41
+ <button type="button" className="start-theme" aria-label={theme.dark ? t('common.toLight') : t('common.toDark')} onClick={theme.toggle}>
42
+ <PoadIcon name={theme.dark ? 'sun' : 'moon'} size={15} />
43
+ </button>
44
+ </div>
45
+
46
+ <main className="start-main">
47
+ <Brand className="start-brand" size={36} version />
48
+
49
+ <h1>
50
+ {t('home.title')}
51
+ <em>{t('home.titleAccent')}</em>
52
+ </h1>
53
+ <p className="start-lead">{t('home.lead', { description: APP.description })}</p>
54
+
55
+ <nav className="doors">
56
+ {doors.map((d) => {
57
+ const inner = (
58
+ <>
59
+ <span className="dicon">
60
+ <PoadIcon name={d.icon} size={17} />
61
+ </span>
62
+ <span className="dtxt">
63
+ <span className="dtitle">{d.title}</span>
64
+ <span className="dtext">{d.text}</span>
65
+ </span>
66
+ <PoadIcon className="darrow" name={d.href ? 'arrow-up-right' : 'arrow-right'} size={15} />
67
+ </>
68
+ );
69
+ return d.href ? (
70
+ <a key={d.title} className="door" href={d.href} target="_blank" rel="noopener">
71
+ {inner}
72
+ </a>
73
+ ) : (
74
+ <Link key={d.title} className="door" href={d.link!}>
75
+ {inner}
76
+ </Link>
77
+ );
78
+ })}
79
+ </nav>
80
+
81
+ <dl className="facts">
82
+ {facts.map((f) => (
83
+ <div key={f.label}>
84
+ <dt>{f.value}</dt>
85
+ <dd>{f.label}</dd>
86
+ </div>
87
+ ))}
88
+ </dl>
89
+ </main>
90
+ </div>
91
+ );
92
+ }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><rect width="32" height="32" rx="8" fill="#4f46e5"/><rect x="9.4" y="7" width="3.2" height="19" rx="1.6" fill="#fff"/><circle cx="17" cy="13" r="4.9" fill="none" stroke="#fff" stroke-width="3.2"/><circle cx="17" cy="13" r="1.5" fill="#fff"/></svg>
@@ -0,0 +1,58 @@
1
+ // Composants des pages : feuilles de @poadio/ui-core, une fois pour toute l'application
2
+ import '@poadio/ui-core/tokens.css';
3
+ import '@poadio/ui-core/base.css';
4
+ import '@poadio/ui-core/icon.css';
5
+ import '@poadio/ui-core/button.css';
6
+ import '@poadio/ui-core/field.css';
7
+ import '@poadio/ui-core/password.css';
8
+ import '@poadio/ui-core/meter.css';
9
+ import '@poadio/ui-core/select.css';
10
+ import '@poadio/ui-core/option-list.css';
11
+ import '@poadio/ui-core/floating.css';
12
+ import '@poadio/ui-core/sheet.css';
13
+ import '@poadio/ui-core/tooltip.css';
14
+ import '@poadio/ui-core/popover.css';
15
+ import '@poadio/ui-core/menu.css';
16
+ import '@poadio/ui-core/tabs.css';
17
+ import '@poadio/ui-core/tag.css';
18
+ import '@poadio/ui-core/message.css';
19
+ import '@poadio/ui-core/divider.css';
20
+ import '@poadio/ui-core/progress.css';
21
+ import '@poadio/ui-core/toast.css';
22
+ import '@poadio/ui-core/card.css';
23
+ import './globals.css';
24
+ import './shell.css';
25
+ import type { Metadata } from 'next';
26
+ import type { ReactNode } from 'react';
27
+ import { APP } from '@/app.meta';
28
+ import { publicEnv } from '@/core/env.server';
29
+ import { THEME_SCRIPT } from '@/core/theme-script';
30
+ import { getLocale } from '@/i18n/server';
31
+ import { Providers } from './providers';
32
+
33
+ export const metadata: Metadata = {
34
+ title: { default: APP.name, template: `%s · ${APP.name}` },
35
+ description: APP.description,
36
+ };
37
+
38
+ /**
39
+ * Racine, rendue par le serveur À CHAQUE REQUÊTE (la langue lit les cookies) :
40
+ * les variables publiques (POAD_URL, POAD_ANON_KEY, PUBLIC_*) sont lues dans
41
+ * l'environnement du serveur à ce moment-là, jamais compilées dans le code.
42
+ * L'image Docker est donc construite une fois et configurée au démarrage.
43
+ */
44
+ export default async function RootLayout({ children }: { children: ReactNode }) {
45
+ const locale = await getLocale();
46
+ return (
47
+ <html lang={locale} suppressHydrationWarning>
48
+ <head>
49
+ <script dangerouslySetInnerHTML={{ __html: THEME_SCRIPT }} />
50
+ </head>
51
+ <body>
52
+ <Providers env={publicEnv()} locale={locale}>
53
+ {children}
54
+ </Providers>
55
+ </body>
56
+ </html>
57
+ );
58
+ }
@@ -0,0 +1,6 @@
1
+ import { redirect } from 'next/navigation';
2
+
3
+ /** Une URL inconnue ramène à l'accueil (comme le starter Angular) */
4
+ export default function NotFound() {
5
+ redirect('/');
6
+ }
@@ -0,0 +1,6 @@
1
+ import { Home } from './home';
2
+
3
+ /** Page de démarrage, hors du cadre de l'application (titre : celui de l'application) */
4
+ export default function HomePage() {
5
+ return <Home />;
6
+ }
@@ -0,0 +1,24 @@
1
+ 'use client';
2
+ import type { ReactNode } from 'react';
3
+ import { PoadToast } from '@poadio/ui-react';
4
+ import { AuthProvider } from '@/core/auth';
5
+ import { EnvProvider } from '@/core/env';
6
+ import { ThemeProvider } from '@/core/theme';
7
+ import { I18nProvider } from '@/i18n/client';
8
+ import type { Locale } from '@/i18n';
9
+
10
+ /** Fournisseurs de toute l'application : variables, langue, thème, session, toasts */
11
+ export function Providers({ env, locale, children }: { env: Record<string, string>; locale: Locale; children: ReactNode }) {
12
+ return (
13
+ <EnvProvider values={env}>
14
+ <I18nProvider locale={locale}>
15
+ <ThemeProvider>
16
+ <AuthProvider>
17
+ {children}
18
+ <PoadToast position="bottom-right" />
19
+ </AuthProvider>
20
+ </ThemeProvider>
21
+ </I18nProvider>
22
+ </EnvProvider>
23
+ );
24
+ }