create-modoock-app 2.5.0 → 2.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/dist/commands/update.js +118 -78
- package/dist/constants.js +6 -1
- package/dist/utils/metadata.js +26 -4
- package/package.json +1 -1
- package/template/app/(main)/components/avatar/page.tsx +106 -0
- package/template/app/(main)/components/graphiques/page.tsx +219 -0
- package/template/app/(main)/components/infobulle/page.tsx +99 -0
- package/template/app/(main)/components/interrupteur/page.tsx +92 -0
- package/template/app/(main)/components/page.tsx +36 -0
- package/template/app/(main)/components/tiroir/page.tsx +100 -0
- package/template/app/(main)/components/toasts/page.tsx +165 -0
- package/template/app/(main)/design-system/page.tsx +1 -1
- package/template/app/globals.css +2 -4
- package/template/app/layout.tsx +2 -0
- package/template/components/layout/header.tsx +337 -6
- package/template/components/layout/index.ts +1 -0
- package/template/components/layout/side-nav.tsx +243 -105
- package/template/components/layout/toaster-host.tsx +8 -0
- package/template/next.config.ts +12 -0
- package/template/package-lock.json +425 -17
- package/template/package.json +4 -3
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
useEffect,
|
|
5
|
+
useRef,
|
|
6
|
+
useState,
|
|
7
|
+
type KeyboardEvent as ReactKeyboardEvent,
|
|
8
|
+
} from "react";
|
|
4
9
|
import Image from "next/image";
|
|
5
10
|
import { usePathname, useRouter } from "next/navigation";
|
|
6
11
|
import { Icon } from "@modoock/components";
|
|
@@ -9,6 +14,7 @@ import { scrollAppMainToIdWhenReady } from "@/lib/scroll-to-section";
|
|
|
9
14
|
|
|
10
15
|
const MD_NAV = "(min-width: 56rem)";
|
|
11
16
|
const DESKTOP_NAV = "(min-width: 1024px)";
|
|
17
|
+
const APP_VERSION = "2.5.1";
|
|
12
18
|
const FOCUSABLE_SELECTOR =
|
|
13
19
|
"a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex='-1'])";
|
|
14
20
|
|
|
@@ -38,7 +44,10 @@ const NAV_ITEMS: NavItem[] = [
|
|
|
38
44
|
{ label: "Suite", href: "/documentation#suite" },
|
|
39
45
|
],
|
|
40
46
|
},
|
|
41
|
-
{
|
|
47
|
+
{
|
|
48
|
+
label: "Design System",
|
|
49
|
+
href: "/design-system",
|
|
50
|
+
icon: "Palette",
|
|
42
51
|
children: [
|
|
43
52
|
{ label: "Couleurs", href: "/design-system#colors" },
|
|
44
53
|
{ label: "Typographie", href: "/design-system#typography" },
|
|
@@ -57,17 +66,24 @@ const NAV_ITEMS: NavItem[] = [
|
|
|
57
66
|
href: "/components",
|
|
58
67
|
icon: "Puzzle",
|
|
59
68
|
children: [
|
|
69
|
+
{ label: "Catalogue", href: "/components" },
|
|
60
70
|
{ label: "Champs de saisie", href: "/components/champs" },
|
|
61
71
|
{ label: "Boutons", href: "/components/boutons" },
|
|
72
|
+
{ label: "Interrupteur", href: "/components/interrupteur" },
|
|
73
|
+
{ label: "Infobulle", href: "/components/infobulle" },
|
|
62
74
|
{ label: "Icônes", href: "/components/icones" },
|
|
63
75
|
{ label: "Loader", href: "/components/loader" },
|
|
64
76
|
{ label: "Badges", href: "/components/badges" },
|
|
77
|
+
{ label: "Avatar", href: "/components/avatar" },
|
|
65
78
|
{ label: "Sélecteurs", href: "/components/selecteurs" },
|
|
66
79
|
{ label: "Sélecteurs de date", href: "/components/date-picker" },
|
|
67
80
|
{ label: "Agenda", href: "/components/agenda" },
|
|
68
81
|
{ label: "Onglets", href: "/components/onglets" },
|
|
69
82
|
{ label: "Modale", href: "/components/modale" },
|
|
83
|
+
{ label: "Tiroir", href: "/components/tiroir" },
|
|
84
|
+
{ label: "Toasts", href: "/components/toasts" },
|
|
70
85
|
{ label: "Barres de métrique", href: "/components/barres-de-metrique" },
|
|
86
|
+
{ label: "Graphiques", href: "/components/graphiques" },
|
|
71
87
|
{ label: "Stepper", href: "/components/stepper" },
|
|
72
88
|
{ label: "Tableau", href: "/components/tableau" },
|
|
73
89
|
],
|
|
@@ -83,6 +99,19 @@ function hashOf(href: string) {
|
|
|
83
99
|
return i === -1 ? "" : href.slice(i);
|
|
84
100
|
}
|
|
85
101
|
|
|
102
|
+
function itemMatchesRoute(item: NavItem, pathname: string): boolean {
|
|
103
|
+
if (pathname === item.href) return true;
|
|
104
|
+
if (item.href !== "/" && pathname.startsWith(`${item.href}/`)) return true;
|
|
105
|
+
return (item.children ?? []).some((child) => pathOf(child.href) === pathname);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function findActiveGroupHref(pathname: string): string | null {
|
|
109
|
+
const match = NAV_ITEMS.find(
|
|
110
|
+
(item) => item.children?.length && itemMatchesRoute(item, pathname),
|
|
111
|
+
);
|
|
112
|
+
return match?.href ?? null;
|
|
113
|
+
}
|
|
114
|
+
|
|
86
115
|
interface SideNavProps {
|
|
87
116
|
collapsed: boolean;
|
|
88
117
|
onCollapsedChange: (collapsed: boolean) => void;
|
|
@@ -92,7 +121,7 @@ export default function SideNav({
|
|
|
92
121
|
collapsed,
|
|
93
122
|
onCollapsedChange,
|
|
94
123
|
}: SideNavProps) {
|
|
95
|
-
const [
|
|
124
|
+
const [openGroup, setOpenGroup] = useState<string | null>(null);
|
|
96
125
|
const [hash, setHash] = useState("");
|
|
97
126
|
const [isMdUp, setIsMdUp] = useState(true);
|
|
98
127
|
const navRef = useRef<HTMLElement>(null);
|
|
@@ -124,6 +153,12 @@ export default function SideNav({
|
|
|
124
153
|
};
|
|
125
154
|
}, [onCollapsedChange]);
|
|
126
155
|
|
|
156
|
+
// Keep the section that owns the current route open (accordion).
|
|
157
|
+
useEffect(() => {
|
|
158
|
+
const activeGroup = findActiveGroupHref(pathname);
|
|
159
|
+
if (activeGroup) setOpenGroup(activeGroup);
|
|
160
|
+
}, [pathname]);
|
|
161
|
+
|
|
127
162
|
useEffect(() => {
|
|
128
163
|
if (!drawerOpen) return;
|
|
129
164
|
const main = document.getElementById("app-main");
|
|
@@ -148,7 +183,9 @@ export default function SideNav({
|
|
|
148
183
|
const trapDrawerTab = (event: ReactKeyboardEvent<HTMLElement>) => {
|
|
149
184
|
if (!drawerOpen || event.key !== "Tab") return;
|
|
150
185
|
const focusables = navRef.current
|
|
151
|
-
? Array.from(
|
|
186
|
+
? Array.from(
|
|
187
|
+
navRef.current.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR),
|
|
188
|
+
)
|
|
152
189
|
: [];
|
|
153
190
|
if (focusables.length === 0) return;
|
|
154
191
|
const first = focusables[0];
|
|
@@ -163,6 +200,12 @@ export default function SideNav({
|
|
|
163
200
|
}
|
|
164
201
|
};
|
|
165
202
|
|
|
203
|
+
const closeMobileDrawer = () => {
|
|
204
|
+
if (!window.matchMedia(DESKTOP_NAV).matches) {
|
|
205
|
+
onCollapsedChange(true);
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
|
|
166
209
|
const handleNavigate = (href: string) => {
|
|
167
210
|
router.push(href);
|
|
168
211
|
const sectionHash = hashOf(href);
|
|
@@ -170,13 +213,29 @@ export default function SideNav({
|
|
|
170
213
|
setHash(sectionHash);
|
|
171
214
|
scrollAppMainToIdWhenReady(sectionHash.slice(1));
|
|
172
215
|
}
|
|
173
|
-
|
|
174
|
-
onCollapsedChange(true);
|
|
175
|
-
}
|
|
216
|
+
closeMobileDrawer();
|
|
176
217
|
};
|
|
177
218
|
|
|
219
|
+
/** Accordion: open this group and close every other. */
|
|
178
220
|
const toggleGroup = (href: string) => {
|
|
179
|
-
|
|
221
|
+
setOpenGroup((prev) => (prev === href ? null : href));
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
const handleParentClick = (item: NavItem) => {
|
|
225
|
+
const hasChildren = Boolean(item.children?.length);
|
|
226
|
+
|
|
227
|
+
if (hasChildren) {
|
|
228
|
+
// Collapsed rail: open the menu first, then expand that group.
|
|
229
|
+
if (!showLabels) {
|
|
230
|
+
onCollapsedChange(false);
|
|
231
|
+
setOpenGroup(item.href);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
toggleGroup(item.href);
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
handleNavigate(item.href);
|
|
180
239
|
};
|
|
181
240
|
|
|
182
241
|
return (
|
|
@@ -202,115 +261,194 @@ export default function SideNav({
|
|
|
202
261
|
}`}
|
|
203
262
|
aria-label="Menu principal"
|
|
204
263
|
>
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
>
|
|
211
|
-
{showLabels ? (
|
|
212
|
-
<Image
|
|
213
|
-
src="/identity/full_logo_white.svg"
|
|
214
|
-
alt="Modoock"
|
|
215
|
-
width={168}
|
|
216
|
-
height={46}
|
|
217
|
-
className="h-9 w-auto"
|
|
218
|
-
priority
|
|
219
|
-
/>
|
|
220
|
-
) : null}
|
|
221
|
-
<button
|
|
222
|
-
type="button"
|
|
223
|
-
onClick={() => onCollapsedChange(!collapsed)}
|
|
224
|
-
aria-label={collapsed ? "Ouvrir le menu" : "Fermer le menu"}
|
|
225
|
-
className="grid size-8 place-items-center rounded-small text-white/80 transition-colors hover:bg-white/10 hover:text-white focus-visible:ring-2 focus-visible:ring-white [&_svg]:shrink-0 [&_svg]:text-current"
|
|
264
|
+
{/* Header */}
|
|
265
|
+
<div
|
|
266
|
+
className={`flex items-center border-b border-white/10 p-4 ${
|
|
267
|
+
showLabels ? "justify-between" : "justify-center"
|
|
268
|
+
}`}
|
|
226
269
|
>
|
|
227
|
-
{
|
|
228
|
-
<
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
270
|
+
{showLabels ? (
|
|
271
|
+
<Image
|
|
272
|
+
src="/identity/full_logo_white.svg"
|
|
273
|
+
alt="Modoock"
|
|
274
|
+
width={168}
|
|
275
|
+
height={46}
|
|
276
|
+
className="h-9 w-auto"
|
|
277
|
+
priority
|
|
278
|
+
/>
|
|
279
|
+
) : null}
|
|
280
|
+
<button
|
|
281
|
+
type="button"
|
|
282
|
+
onClick={() => onCollapsedChange(!collapsed)}
|
|
283
|
+
aria-label={collapsed ? "Ouvrir le menu" : "Fermer le menu"}
|
|
284
|
+
className="grid size-8 place-items-center rounded-small text-white/80 transition-colors hover:bg-white/10 hover:text-white focus-visible:ring-2 focus-visible:ring-white [&_svg]:shrink-0 [&_svg]:text-current"
|
|
285
|
+
>
|
|
286
|
+
{collapsed ? (
|
|
287
|
+
<Icon name="PanelLeftOpen" aria-hidden="true" />
|
|
288
|
+
) : (
|
|
289
|
+
<Icon name="PanelLeftClose" aria-hidden="true" />
|
|
290
|
+
)}
|
|
291
|
+
</button>
|
|
292
|
+
</div>
|
|
293
|
+
|
|
294
|
+
{/* Navigation */}
|
|
295
|
+
<div className="nav-scrollbar flex flex-1 flex-col gap-1 overflow-y-auto overscroll-contain px-2 py-2">
|
|
296
|
+
{NAV_ITEMS.map((item) => {
|
|
297
|
+
const hasChildren = Boolean(item.children?.length);
|
|
298
|
+
const isRouteActive = itemMatchesRoute(item, pathname);
|
|
299
|
+
const isOpen = openGroup === item.href;
|
|
300
|
+
|
|
301
|
+
return (
|
|
302
|
+
<div key={item.href} className="flex flex-col gap-1">
|
|
303
|
+
<button
|
|
304
|
+
type="button"
|
|
305
|
+
onClick={() => handleParentClick(item)}
|
|
306
|
+
title={
|
|
307
|
+
hasChildren && !showLabels
|
|
308
|
+
? `${item.label} — ouvrir le menu`
|
|
309
|
+
: item.label
|
|
310
|
+
}
|
|
311
|
+
aria-label={showLabels ? undefined : item.label}
|
|
312
|
+
aria-expanded={
|
|
313
|
+
hasChildren && showLabels ? isOpen : undefined
|
|
314
|
+
}
|
|
315
|
+
aria-haspopup={hasChildren ? "true" : undefined}
|
|
316
|
+
className={`flex items-center gap-3 rounded-small px-3 py-2 text-left text-body-medium transition-colors focus-visible:ring-2 focus-visible:ring-white [&_svg]:shrink-0 [&_svg]:text-current ${
|
|
317
|
+
isRouteActive
|
|
318
|
+
? "bg-white/15 text-white"
|
|
319
|
+
: "text-white/80 hover:bg-white/10 hover:text-white"
|
|
320
|
+
} ${showLabels ? "" : "justify-center"}`}
|
|
321
|
+
>
|
|
322
|
+
<Icon name={item.icon} aria-hidden="true" />
|
|
323
|
+
{showLabels ? (
|
|
324
|
+
<>
|
|
325
|
+
<span className="min-w-0 flex-1 truncate">
|
|
326
|
+
{item.label}
|
|
327
|
+
</span>
|
|
328
|
+
{hasChildren ? (
|
|
329
|
+
<Icon
|
|
330
|
+
name="ChevronDown"
|
|
331
|
+
aria-hidden="true"
|
|
332
|
+
className={`ml-auto transition-transform duration-200 motion-reduce:transition-none ${
|
|
333
|
+
isOpen ? "rotate-180" : ""
|
|
334
|
+
}`}
|
|
335
|
+
/>
|
|
336
|
+
) : null}
|
|
337
|
+
</>
|
|
338
|
+
) : null}
|
|
339
|
+
</button>
|
|
234
340
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
341
|
+
{hasChildren && showLabels ? (
|
|
342
|
+
<div
|
|
343
|
+
className={`grid transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none ${
|
|
344
|
+
isOpen ? "grid-rows-[1fr]" : "grid-rows-[0fr]"
|
|
345
|
+
}`}
|
|
346
|
+
>
|
|
347
|
+
<div className="min-h-0 overflow-hidden">
|
|
348
|
+
<div
|
|
349
|
+
className="ml-5 flex flex-col gap-0.5 border-l border-white/20 py-1 pl-2"
|
|
350
|
+
role="group"
|
|
351
|
+
aria-label={item.label}
|
|
352
|
+
>
|
|
353
|
+
{item.children!.map((child) => {
|
|
354
|
+
const childHash = hashOf(child.href);
|
|
355
|
+
const isChildActive = childHash
|
|
356
|
+
? pathname === pathOf(child.href) &&
|
|
357
|
+
hash === childHash
|
|
358
|
+
: pathname === child.href;
|
|
359
|
+
return (
|
|
360
|
+
<button
|
|
361
|
+
key={child.href}
|
|
362
|
+
type="button"
|
|
363
|
+
onClick={() => handleNavigate(child.href)}
|
|
364
|
+
title={child.label}
|
|
365
|
+
className={`relative flex items-center rounded-small px-3 py-2 text-left text-body-medium transition-colors focus-visible:ring-2 focus-visible:ring-white ${
|
|
366
|
+
isChildActive
|
|
367
|
+
? "bg-white/15 text-white"
|
|
368
|
+
: "text-white/70 hover:bg-white/10 hover:text-white"
|
|
369
|
+
}`}
|
|
370
|
+
>
|
|
371
|
+
{isChildActive ? (
|
|
372
|
+
<span
|
|
373
|
+
className="absolute top-1/2 left-0 h-4 w-0.5 -translate-y-1/2 rounded-full bg-white"
|
|
374
|
+
aria-hidden="true"
|
|
375
|
+
/>
|
|
376
|
+
) : null}
|
|
377
|
+
<span className="truncate">{child.label}</span>
|
|
378
|
+
</button>
|
|
379
|
+
);
|
|
380
|
+
})}
|
|
381
|
+
</div>
|
|
382
|
+
</div>
|
|
383
|
+
</div>
|
|
384
|
+
) : null}
|
|
385
|
+
</div>
|
|
244
386
|
);
|
|
245
|
-
|
|
246
|
-
|
|
387
|
+
})}
|
|
388
|
+
</div>
|
|
247
389
|
|
|
248
|
-
|
|
249
|
-
|
|
390
|
+
{/* Footer */}
|
|
391
|
+
<div
|
|
392
|
+
className={`mt-auto border-t border-white/10 ${
|
|
393
|
+
showLabels ? "p-3" : "p-2"
|
|
394
|
+
}`}
|
|
395
|
+
>
|
|
396
|
+
{showLabels ? (
|
|
397
|
+
<div className="flex flex-col gap-2">
|
|
250
398
|
<button
|
|
251
399
|
type="button"
|
|
252
|
-
onClick={() =>
|
|
253
|
-
|
|
254
|
-
toggleGroup(item.href);
|
|
255
|
-
}
|
|
256
|
-
handleNavigate(item.href);
|
|
257
|
-
}}
|
|
258
|
-
title={item.label}
|
|
259
|
-
aria-label={showLabels ? undefined : item.label}
|
|
260
|
-
aria-expanded={hasChildren && showLabels ? isOpen : undefined}
|
|
261
|
-
className={`flex items-center gap-3 rounded-small px-3 py-2 text-left text-body-medium transition-colors focus-visible:ring-2 focus-visible:ring-white [&_svg]:shrink-0 [&_svg]:text-current ${
|
|
262
|
-
isActive
|
|
263
|
-
? "bg-white/15 text-white"
|
|
264
|
-
: "text-white/80 hover:bg-white/10 hover:text-white"
|
|
265
|
-
} ${showLabels ? "" : "justify-center"}`}
|
|
400
|
+
onClick={() => handleNavigate("/documentation")}
|
|
401
|
+
className="flex items-center gap-3 rounded-small px-2 py-2 text-left transition-colors hover:bg-white/10 focus-visible:ring-2 focus-visible:ring-white [&_svg]:shrink-0"
|
|
266
402
|
>
|
|
267
|
-
<
|
|
268
|
-
{showLabels ? <span className="truncate">{item.label}</span> : null}
|
|
269
|
-
{hasChildren && showLabels ? (
|
|
403
|
+
<span className="grid size-9 place-items-center rounded-full bg-white/15">
|
|
270
404
|
<Icon
|
|
271
|
-
name="
|
|
405
|
+
name="CircleQuestionMark"
|
|
406
|
+
size="small"
|
|
407
|
+
variant="white"
|
|
272
408
|
aria-hidden="true"
|
|
273
|
-
className={`ml-auto transition-transform ${
|
|
274
|
-
isOpen ? "rotate-180" : ""
|
|
275
|
-
}`}
|
|
276
409
|
/>
|
|
277
|
-
|
|
410
|
+
</span>
|
|
411
|
+
<span className="min-w-0 flex-1">
|
|
412
|
+
<span className="block truncate text-body-medium text-white">
|
|
413
|
+
Aide
|
|
414
|
+
</span>
|
|
415
|
+
<span className="block truncate text-small text-white/60">
|
|
416
|
+
Documentation
|
|
417
|
+
</span>
|
|
418
|
+
</span>
|
|
419
|
+
<Icon
|
|
420
|
+
name="ChevronRight"
|
|
421
|
+
size="small"
|
|
422
|
+
aria-hidden="true"
|
|
423
|
+
className="text-white/50"
|
|
424
|
+
/>
|
|
278
425
|
</button>
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
<
|
|
282
|
-
|
|
283
|
-
const childHash = hashOf(child.href);
|
|
284
|
-
const isChildActive = childHash
|
|
285
|
-
? pathname === pathOf(child.href) && hash === childHash
|
|
286
|
-
: pathname === child.href;
|
|
287
|
-
return (
|
|
288
|
-
<button
|
|
289
|
-
key={child.href}
|
|
290
|
-
type="button"
|
|
291
|
-
onClick={() => handleNavigate(child.href)}
|
|
292
|
-
title={child.label}
|
|
293
|
-
className={`flex items-center rounded-small px-3 py-2 text-left text-body-medium transition-colors focus-visible:ring-2 focus-visible:ring-white ${
|
|
294
|
-
isChildActive
|
|
295
|
-
? "bg-white/15 text-white"
|
|
296
|
-
: "text-white/70 hover:bg-white/10 hover:text-white"
|
|
297
|
-
}`}
|
|
298
|
-
>
|
|
299
|
-
<span className="truncate">{child.label}</span>
|
|
300
|
-
</button>
|
|
301
|
-
);
|
|
302
|
-
})}
|
|
303
|
-
</div>
|
|
304
|
-
) : null}
|
|
426
|
+
<div className="flex items-center justify-between px-2 text-small text-white/50">
|
|
427
|
+
<span>Modoock</span>
|
|
428
|
+
<span className="tabular-nums">v{APP_VERSION}</span>
|
|
429
|
+
</div>
|
|
305
430
|
</div>
|
|
306
|
-
)
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
431
|
+
) : (
|
|
432
|
+
<div className="flex flex-col items-center gap-1">
|
|
433
|
+
<button
|
|
434
|
+
type="button"
|
|
435
|
+
onClick={() => handleNavigate("/documentation")}
|
|
436
|
+
title="Aide"
|
|
437
|
+
aria-label="Aide — Documentation"
|
|
438
|
+
className="grid size-10 place-items-center rounded-small text-white/80 transition-colors hover:bg-white/10 hover:text-white focus-visible:ring-2 focus-visible:ring-white [&_svg]:shrink-0"
|
|
439
|
+
>
|
|
440
|
+
<Icon
|
|
441
|
+
name="CircleQuestionMark"
|
|
442
|
+
variant="white"
|
|
443
|
+
aria-hidden="true"
|
|
444
|
+
/>
|
|
445
|
+
</button>
|
|
446
|
+
<span className="text-[10px] tabular-nums text-white/40">
|
|
447
|
+
v{APP_VERSION}
|
|
448
|
+
</span>
|
|
449
|
+
</div>
|
|
450
|
+
)}
|
|
451
|
+
</div>
|
|
314
452
|
</nav>
|
|
315
453
|
</>
|
|
316
454
|
);
|
package/template/next.config.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { NextConfig } from "next";
|
|
2
|
+
import path from "node:path";
|
|
2
3
|
import { networkInterfaces } from "node:os";
|
|
3
4
|
|
|
5
|
+
/** Monorepo root — local `file:../../components` lives outside create-modoock-app/. */
|
|
6
|
+
const monorepoRoot = path.join(__dirname, "../..");
|
|
7
|
+
|
|
4
8
|
function lanHostnames(): string[] {
|
|
5
9
|
const hosts = new Set<string>();
|
|
6
10
|
for (const addrs of Object.values(networkInterfaces())) {
|
|
@@ -16,6 +20,14 @@ function lanHostnames(): string[] {
|
|
|
16
20
|
|
|
17
21
|
const nextConfig: NextConfig = {
|
|
18
22
|
allowedDevOrigins: lanHostnames(),
|
|
23
|
+
// Linked `@modoock/components` lives outside create-modoock-app/; widen FS root.
|
|
24
|
+
outputFileTracingRoot: monorepoRoot,
|
|
25
|
+
experimental: {
|
|
26
|
+
externalDir: true,
|
|
27
|
+
},
|
|
28
|
+
turbopack: {
|
|
29
|
+
root: monorepoRoot,
|
|
30
|
+
},
|
|
19
31
|
};
|
|
20
32
|
|
|
21
33
|
export default nextConfig;
|