create-modoock-app 2.0.0 → 2.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.
- package/dist/cli.js +121 -121
- package/package.json +1 -1
- package/template/.cursor/rules/ui.mdc +1 -1
- package/template/README.md +7 -7
- package/template/app/{(local) → (main)}/components/page.tsx +5 -5
- package/template/app/auth/login/page.tsx +1 -1
- package/template/app/layout.tsx +1 -1
- package/template/archives/.gitkeep +0 -0
- package/template/backup/.gitkeep +0 -0
- package/template/components/layout/app-layout.tsx +6 -6
- package/template/components/layout/header.tsx +1 -1
- package/template/components/layout/index.ts +3 -3
- package/template/components/layout/side-nav.tsx +8 -7
- package/template/components/shared/index.ts +1 -7
- package/template/data/index.ts +0 -0
- package/template/hooks/.gitkeep +0 -0
- package/template/lib/.gitkeep +0 -0
- package/template/public/docs/.gitkeep +0 -0
- package/template/public/fonts/.gitkeep +0 -0
- package/template/public/images/.gitkeep +0 -0
- package/template/components/shared/detail-header.tsx +0 -39
- package/template/components/shared/info-card.tsx +0 -75
- package/template/components/shared/summary-card.tsx +0 -31
- package/template/components/shared/table-section.tsx +0 -38
- package/template/components/shared/timeline-list.tsx +0 -31
- /package/template/app/{(local) → (main)}/design-system/page.tsx +0 -0
- /package/template/app/{(local) → (main)}/layout.tsx +0 -0
- /package/template/app/{(local) → (main)}/page.tsx +0 -0
- /package/template/public/{login-hero.png → images/login-hero.png} +0 -0
package/dist/cli.js
CHANGED
|
@@ -1,121 +1,121 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
-
};
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
-
const node_child_process_1 = require("node:child_process");
|
|
10
|
-
const COMPONENTS_PACKAGE = "@modoock/components";
|
|
11
|
-
const COMPONENTS_VERSION = "1.0.0";
|
|
12
|
-
function copyDirectory(source, destination) {
|
|
13
|
-
node_fs_1.default.mkdirSync(destination, { recursive: true });
|
|
14
|
-
for (const entry of node_fs_1.default.readdirSync(source, { withFileTypes: true })) {
|
|
15
|
-
const sourcePath = node_path_1.default.join(source, entry.name);
|
|
16
|
-
const destinationPath = node_path_1.default.join(destination, entry.name);
|
|
17
|
-
if (entry.isDirectory()) {
|
|
18
|
-
copyDirectory(sourcePath, destinationPath);
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
node_fs_1.default.copyFileSync(sourcePath, destinationPath);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function getComponentsSource(packageRoot) {
|
|
26
|
-
const temporaryDirectory = node_path_1.default.join(packageRoot, ".modoock-components-temp");
|
|
27
|
-
node_fs_1.default.rmSync(temporaryDirectory, {
|
|
28
|
-
recursive: true,
|
|
29
|
-
force: true,
|
|
30
|
-
});
|
|
31
|
-
node_fs_1.default.mkdirSync(temporaryDirectory, {
|
|
32
|
-
recursive: true,
|
|
33
|
-
});
|
|
34
|
-
console.log(`Getting ${COMPONENTS_PACKAGE}@${COMPONENTS_VERSION}...`);
|
|
35
|
-
(0, node_child_process_1.execSync)(`npm pack ${COMPONENTS_PACKAGE}@${COMPONENTS_VERSION} --pack-destination "${temporaryDirectory}"`, {
|
|
36
|
-
cwd: packageRoot,
|
|
37
|
-
stdio: "inherit",
|
|
38
|
-
});
|
|
39
|
-
const tarball = node_fs_1.default
|
|
40
|
-
.readdirSync(temporaryDirectory)
|
|
41
|
-
.find((file) => file.endsWith(".tgz"));
|
|
42
|
-
if (!tarball) {
|
|
43
|
-
throw new Error("Could not find the components package archive.");
|
|
44
|
-
}
|
|
45
|
-
const extractDirectory = node_path_1.default.join(temporaryDirectory, "package");
|
|
46
|
-
node_fs_1.default.mkdirSync(extractDirectory, {
|
|
47
|
-
recursive: true,
|
|
48
|
-
});
|
|
49
|
-
(0, node_child_process_1.execSync)(`tar -xzf "${node_path_1.default.join(temporaryDirectory, tarball)}" -C "${temporaryDirectory}"`, {
|
|
50
|
-
stdio: "inherit",
|
|
51
|
-
});
|
|
52
|
-
const uiSource = node_path_1.default.join(extractDirectory, "components", "ui");
|
|
53
|
-
if (!node_fs_1.default.existsSync(uiSource)) {
|
|
54
|
-
throw new Error(`Could not find components/ui in ${COMPONENTS_PACKAGE}@${COMPONENTS_VERSION}.`);
|
|
55
|
-
}
|
|
56
|
-
return uiSource;
|
|
57
|
-
}
|
|
58
|
-
function main() {
|
|
59
|
-
const projectName = process.argv[2];
|
|
60
|
-
if (!projectName) {
|
|
61
|
-
console.error("Usage: npx create-modoock-app <project-name>");
|
|
62
|
-
process.exit(1);
|
|
63
|
-
}
|
|
64
|
-
const targetDirectory = node_path_1.default.resolve(process.cwd(), projectName);
|
|
65
|
-
if (node_fs_1.default.existsSync(targetDirectory)) {
|
|
66
|
-
console.error(`Error: Directory "${projectName}" already exists.`);
|
|
67
|
-
process.exit(1);
|
|
68
|
-
}
|
|
69
|
-
const packageRoot = node_path_1.default.resolve(__dirname, "..");
|
|
70
|
-
const templateDirectory = node_path_1.default.join(packageRoot, "template");
|
|
71
|
-
console.log(`Creating Modooock project: ${node_path_1.default.basename(targetDirectory)}`);
|
|
72
|
-
// Copy the project foundation.
|
|
73
|
-
copyDirectory(templateDirectory, targetDirectory);
|
|
74
|
-
// Get the official UI source package.
|
|
75
|
-
let uiSource;
|
|
76
|
-
try {
|
|
77
|
-
uiSource = getComponentsSource(packageRoot);
|
|
78
|
-
const uiDestination = node_path_1.default.join(targetDirectory, "components", "ui");
|
|
79
|
-
// Copy UI components into the generated project.
|
|
80
|
-
copyDirectory(uiSource, uiDestination);
|
|
81
|
-
}
|
|
82
|
-
finally {
|
|
83
|
-
// Remove the temporary downloaded package.
|
|
84
|
-
node_fs_1.default.rmSync(node_path_1.default.join(packageRoot, ".modoock-components-temp"), {
|
|
85
|
-
recursive: true,
|
|
86
|
-
force: true,
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
// Update the generated project's package.json.
|
|
90
|
-
const projectPackageJsonPath = node_path_1.default.join(targetDirectory, "package.json");
|
|
91
|
-
const projectPackageJson = JSON.parse(node_fs_1.default.readFileSync(projectPackageJsonPath, "utf8"));
|
|
92
|
-
// Set the generated project's name.
|
|
93
|
-
projectPackageJson.name =
|
|
94
|
-
node_path_1.default.basename(targetDirectory);
|
|
95
|
-
// Install the Knowledge Base as an npm dependency.
|
|
96
|
-
projectPackageJson.dependencies = {
|
|
97
|
-
...(projectPackageJson.dependencies ?? {}),
|
|
98
|
-
"@modoock/knowledge-base": "1.0.0",
|
|
99
|
-
};
|
|
100
|
-
// Components are copied into components/ui/,
|
|
101
|
-
// so they must not remain an npm dependency.
|
|
102
|
-
if (projectPackageJson.dependencies["@modoock/components"]) {
|
|
103
|
-
delete projectPackageJson.dependencies["@modoock/components"];
|
|
104
|
-
}
|
|
105
|
-
node_fs_1.default.writeFileSync(projectPackageJsonPath, JSON.stringify(projectPackageJson, null, 2) + "\n");
|
|
106
|
-
// Install generated project dependencies.
|
|
107
|
-
console.log("Installing dependencies...");
|
|
108
|
-
(0, node_child_process_1.execSync)("npm install", {
|
|
109
|
-
cwd: targetDirectory,
|
|
110
|
-
stdio: "inherit",
|
|
111
|
-
});
|
|
112
|
-
console.log("");
|
|
113
|
-
console.log("Done!");
|
|
114
|
-
console.log("");
|
|
115
|
-
console.log(`Project created at: ${targetDirectory}`);
|
|
116
|
-
console.log("");
|
|
117
|
-
console.log("Next steps:");
|
|
118
|
-
console.log(` cd ${projectName}`);
|
|
119
|
-
console.log(" npm run dev");
|
|
120
|
-
}
|
|
121
|
-
main();
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const node_child_process_1 = require("node:child_process");
|
|
10
|
+
const COMPONENTS_PACKAGE = "@modoock/components";
|
|
11
|
+
const COMPONENTS_VERSION = "1.0.0";
|
|
12
|
+
function copyDirectory(source, destination) {
|
|
13
|
+
node_fs_1.default.mkdirSync(destination, { recursive: true });
|
|
14
|
+
for (const entry of node_fs_1.default.readdirSync(source, { withFileTypes: true })) {
|
|
15
|
+
const sourcePath = node_path_1.default.join(source, entry.name);
|
|
16
|
+
const destinationPath = node_path_1.default.join(destination, entry.name);
|
|
17
|
+
if (entry.isDirectory()) {
|
|
18
|
+
copyDirectory(sourcePath, destinationPath);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
node_fs_1.default.copyFileSync(sourcePath, destinationPath);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function getComponentsSource(packageRoot) {
|
|
26
|
+
const temporaryDirectory = node_path_1.default.join(packageRoot, ".modoock-components-temp");
|
|
27
|
+
node_fs_1.default.rmSync(temporaryDirectory, {
|
|
28
|
+
recursive: true,
|
|
29
|
+
force: true,
|
|
30
|
+
});
|
|
31
|
+
node_fs_1.default.mkdirSync(temporaryDirectory, {
|
|
32
|
+
recursive: true,
|
|
33
|
+
});
|
|
34
|
+
console.log(`Getting ${COMPONENTS_PACKAGE}@${COMPONENTS_VERSION}...`);
|
|
35
|
+
(0, node_child_process_1.execSync)(`npm pack ${COMPONENTS_PACKAGE}@${COMPONENTS_VERSION} --pack-destination "${temporaryDirectory}"`, {
|
|
36
|
+
cwd: packageRoot,
|
|
37
|
+
stdio: "inherit",
|
|
38
|
+
});
|
|
39
|
+
const tarball = node_fs_1.default
|
|
40
|
+
.readdirSync(temporaryDirectory)
|
|
41
|
+
.find((file) => file.endsWith(".tgz"));
|
|
42
|
+
if (!tarball) {
|
|
43
|
+
throw new Error("Could not find the components package archive.");
|
|
44
|
+
}
|
|
45
|
+
const extractDirectory = node_path_1.default.join(temporaryDirectory, "package");
|
|
46
|
+
node_fs_1.default.mkdirSync(extractDirectory, {
|
|
47
|
+
recursive: true,
|
|
48
|
+
});
|
|
49
|
+
(0, node_child_process_1.execSync)(`tar -xzf "${node_path_1.default.join(temporaryDirectory, tarball)}" -C "${temporaryDirectory}"`, {
|
|
50
|
+
stdio: "inherit",
|
|
51
|
+
});
|
|
52
|
+
const uiSource = node_path_1.default.join(extractDirectory, "components", "ui");
|
|
53
|
+
if (!node_fs_1.default.existsSync(uiSource)) {
|
|
54
|
+
throw new Error(`Could not find components/ui in ${COMPONENTS_PACKAGE}@${COMPONENTS_VERSION}.`);
|
|
55
|
+
}
|
|
56
|
+
return uiSource;
|
|
57
|
+
}
|
|
58
|
+
function main() {
|
|
59
|
+
const projectName = process.argv[2];
|
|
60
|
+
if (!projectName) {
|
|
61
|
+
console.error("Usage: npx create-modoock-app <project-name>");
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
const targetDirectory = node_path_1.default.resolve(process.cwd(), projectName);
|
|
65
|
+
if (node_fs_1.default.existsSync(targetDirectory)) {
|
|
66
|
+
console.error(`Error: Directory "${projectName}" already exists.`);
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
const packageRoot = node_path_1.default.resolve(__dirname, "..");
|
|
70
|
+
const templateDirectory = node_path_1.default.join(packageRoot, "template");
|
|
71
|
+
console.log(`Creating Modooock project: ${node_path_1.default.basename(targetDirectory)}`);
|
|
72
|
+
// Copy the project foundation.
|
|
73
|
+
copyDirectory(templateDirectory, targetDirectory);
|
|
74
|
+
// Get the official UI source package.
|
|
75
|
+
let uiSource;
|
|
76
|
+
try {
|
|
77
|
+
uiSource = getComponentsSource(packageRoot);
|
|
78
|
+
const uiDestination = node_path_1.default.join(targetDirectory, "components", "ui");
|
|
79
|
+
// Copy UI components into the generated project.
|
|
80
|
+
copyDirectory(uiSource, uiDestination);
|
|
81
|
+
}
|
|
82
|
+
finally {
|
|
83
|
+
// Remove the temporary downloaded package.
|
|
84
|
+
node_fs_1.default.rmSync(node_path_1.default.join(packageRoot, ".modoock-components-temp"), {
|
|
85
|
+
recursive: true,
|
|
86
|
+
force: true,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
// Update the generated project's package.json.
|
|
90
|
+
const projectPackageJsonPath = node_path_1.default.join(targetDirectory, "package.json");
|
|
91
|
+
const projectPackageJson = JSON.parse(node_fs_1.default.readFileSync(projectPackageJsonPath, "utf8"));
|
|
92
|
+
// Set the generated project's name.
|
|
93
|
+
projectPackageJson.name =
|
|
94
|
+
node_path_1.default.basename(targetDirectory);
|
|
95
|
+
// Install the Knowledge Base as an npm dependency.
|
|
96
|
+
projectPackageJson.dependencies = {
|
|
97
|
+
...(projectPackageJson.dependencies ?? {}),
|
|
98
|
+
"@modoock/knowledge-base": "1.0.0",
|
|
99
|
+
};
|
|
100
|
+
// Components are copied into components/ui/,
|
|
101
|
+
// so they must not remain an npm dependency.
|
|
102
|
+
if (projectPackageJson.dependencies["@modoock/components"]) {
|
|
103
|
+
delete projectPackageJson.dependencies["@modoock/components"];
|
|
104
|
+
}
|
|
105
|
+
node_fs_1.default.writeFileSync(projectPackageJsonPath, JSON.stringify(projectPackageJson, null, 2) + "\n");
|
|
106
|
+
// Install generated project dependencies.
|
|
107
|
+
console.log("Installing dependencies...");
|
|
108
|
+
(0, node_child_process_1.execSync)("npm install", {
|
|
109
|
+
cwd: targetDirectory,
|
|
110
|
+
stdio: "inherit",
|
|
111
|
+
});
|
|
112
|
+
console.log("");
|
|
113
|
+
console.log("Done!");
|
|
114
|
+
console.log("");
|
|
115
|
+
console.log(`Project created at: ${targetDirectory}`);
|
|
116
|
+
console.log("");
|
|
117
|
+
console.log("Next steps:");
|
|
118
|
+
console.log(` cd ${projectName}`);
|
|
119
|
+
console.log(" npm run dev");
|
|
120
|
+
}
|
|
121
|
+
main();
|
package/package.json
CHANGED
|
@@ -13,6 +13,6 @@ Same load as `AGENTS.md`. Cursor injects this reminder; it is not a second ruleb
|
|
|
13
13
|
3. Open any other `path` whose `description` matches the need, then that entry's `open:`.
|
|
14
14
|
4. What exists: `components/*/index.ts`. Open a component `.mdc` only if the catalog lists it.
|
|
15
15
|
|
|
16
|
-
List page → `
|
|
16
|
+
List page → `table-page` (then its `open:`). Workflow / dossier → `workflow-page` (then its `open:`).
|
|
17
17
|
|
|
18
18
|
Do not open `knowledge-base/validation/` until verification.
|
package/template/README.md
CHANGED
|
@@ -204,7 +204,7 @@ Honey is **not** generated (`skills/honey/SKILL.md` / `scripts/build-rules.js` d
|
|
|
204
204
|
open: # optional — load graph
|
|
205
205
|
- knowledge-base/…/other.mdc
|
|
206
206
|
# patterns only:
|
|
207
|
-
# id:
|
|
207
|
+
# id: table-page # alias (ui.mdc)
|
|
208
208
|
```
|
|
209
209
|
|
|
210
210
|
| Field | Effect |
|
|
@@ -213,7 +213,7 @@ Honey is **not** generated (`skills/honey/SKILL.md` / `scripts/build-rules.js` d
|
|
|
213
213
|
| `description` | If it matches the need → open `path` |
|
|
214
214
|
| `load: ui` | UI pack. Cursor: the hook **requires** a `Read` of these `path`s (plus `catalog.yaml` and `components/*/index.ts`) before any write under `app/` or `components/`. Other agents follow `AGENTS.md` (hint) |
|
|
215
215
|
| `open:` | After `path`, also open these files (do not copy the rules into them) |
|
|
216
|
-
| `id` | Patterns only — alias (`
|
|
216
|
+
| `id` | Patterns only — alias (`table-page`, `workflow-page`) |
|
|
217
217
|
|
|
218
218
|
With no `load`: on demand only. `catalog.yaml` injects nothing. Cursor injects via `.cursor/rules/` (hints) and **gates** via `.cursor/hooks` (UI writes).
|
|
219
219
|
|
|
@@ -222,7 +222,7 @@ With no `load`: on demand only. `catalog.yaml` injects nothing. Cursor injects v
|
|
|
222
222
|
**Current graph** (`open:`):
|
|
223
223
|
|
|
224
224
|
```
|
|
225
|
-
|
|
225
|
+
table-page.mdc ──open──► tables.mdc
|
|
226
226
|
workflow-page.mdc ──open──► stepper.mdc
|
|
227
227
|
action-stack.mdc
|
|
228
228
|
detail-header.mdc
|
|
@@ -264,7 +264,7 @@ Lot A (**error**, except layout chrome as warning):
|
|
|
264
264
|
| `no-js-layout-size` | `offsetHeight` / `clientHeight` / `ResizeObserver` |
|
|
265
265
|
| `no-password-field-outside-auth` | password `name` / `autoComplete` outside `app/auth` |
|
|
266
266
|
| `no-block-typing` | inline `preventDefault` on `onPaste` / `onKeyDown` |
|
|
267
|
-
| `no-two-tables` | two `
|
|
267
|
+
| `no-two-tables` | two `Table` or `<table>` on one page |
|
|
268
268
|
|
|
269
269
|
Copy, scroll, information density, destructive confirmation, “ask don’t invent”: still `validation/*.mdc` + the agent. Do not run `ast-grep scan -U` on existing app JSX to silence a warning.
|
|
270
270
|
|
|
@@ -293,7 +293,7 @@ After code → lint / typecheck / sg:scan; validation/*.mdc for the theme (st
|
|
|
293
293
|
|
|
294
294
|
### 5. Splitting a module (list page)
|
|
295
295
|
|
|
296
|
-
Pattern `knowledge-base/patterns/pages/
|
|
296
|
+
Pattern `knowledge-base/patterns/pages/table-page.mdc`:
|
|
297
297
|
|
|
298
298
|
```
|
|
299
299
|
/entity → one list, one entity
|
|
@@ -348,9 +348,9 @@ Do not copy the need → file table into the README or the router.
|
|
|
348
348
|
|
|
349
349
|
### UI (`components/ui/`)
|
|
350
350
|
|
|
351
|
-
`ClickableButton`, `Input`, `Textarea`, `Badge`, `
|
|
351
|
+
`ClickableButton`, `Input`, `Textarea`, `Badge`, `Table`, `Select` / `MultiSelect` / `SelectFilter`, `Modal`, `Tabs`, `Icon`, `Loader`, `MetricBar`, `Stepper`, `ActionStack`.
|
|
352
352
|
|
|
353
|
-
`
|
|
353
|
+
`Table` handles sort, pagination, empty message, transpose, and below `md` table → cards (every column stays reachable).
|
|
354
354
|
|
|
355
355
|
### Shared (`components/shared/`)
|
|
356
356
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
ActionStack,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
Stepper,
|
|
18
18
|
Tabs,
|
|
19
19
|
Textarea,
|
|
20
|
-
|
|
20
|
+
Table,
|
|
21
21
|
} from "@/components/ui";
|
|
22
22
|
import type { CardAction, Column } from "@/components/ui";
|
|
23
23
|
import { useEffect, useState } from "react";
|
|
@@ -375,7 +375,7 @@ function TabsDemo() {
|
|
|
375
375
|
}
|
|
376
376
|
|
|
377
377
|
export default function CompsPage() {
|
|
378
|
-
// Showcase page: allow page scroll; explicit height for
|
|
378
|
+
// Showcase page: allow page scroll; explicit height for Table (md:h-full).
|
|
379
379
|
return (
|
|
380
380
|
<main className="flex flex-col">
|
|
381
381
|
{/* Vitrine des variantes du champ de saisie */}
|
|
@@ -863,11 +863,11 @@ export default function CompsPage() {
|
|
|
863
863
|
<div className="mb-component flex shrink-0 flex-wrap items-baseline justify-between gap-inline">
|
|
864
864
|
<h2 className="text-section-title text-foreground">Tableau</h2>
|
|
865
865
|
<span className="text-small text-muted-foreground">
|
|
866
|
-
Composant <code className="font-mono">
|
|
866
|
+
Composant <code className="font-mono">Table</code>
|
|
867
867
|
</span>
|
|
868
868
|
</div>
|
|
869
869
|
<div className="min-h-0 flex-1">
|
|
870
|
-
<
|
|
870
|
+
<Table
|
|
871
871
|
columns={COLUMNS}
|
|
872
872
|
data={USERS}
|
|
873
873
|
rowsPerPage={8}
|
package/template/app/layout.tsx
CHANGED
|
@@ -21,7 +21,7 @@ export default function RootLayout({ children }: LayoutProps<"/">) {
|
|
|
21
21
|
return (
|
|
22
22
|
<html lang="fr" className={`${montserrat.className} antialiased`}>
|
|
23
23
|
<body className="flex h-screen overflow-hidden bg-background">
|
|
24
|
-
|
|
24
|
+
{children}
|
|
25
25
|
</body>
|
|
26
26
|
</html>
|
|
27
27
|
);
|
|
File without changes
|
|
File without changes
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { useState } from "react";
|
|
4
|
-
import Header from "./header";
|
|
5
|
-
import SideNav from "./side-nav";
|
|
4
|
+
import { Header } from "./header";
|
|
5
|
+
import { SideNav } from "./side-nav";
|
|
6
6
|
|
|
7
|
-
export
|
|
7
|
+
export function AppLayout({ children }: { children: React.ReactNode }) {
|
|
8
8
|
const [navCollapsed, setNavCollapsed] = useState(true);
|
|
9
9
|
|
|
10
10
|
return (
|
|
@@ -16,7 +16,7 @@ export default function AppLayout({ children }: { children: React.ReactNode }) {
|
|
|
16
16
|
Dashboard, list and compact-detail pages (/, equipment, infrastructure, incidents
|
|
17
17
|
and their [id] detail pages, plus /interventions, /projects, /patients, /research) MUST NOT create page-level vertical
|
|
18
18
|
scrolling at md+: their `flex min-h-0 flex-1` roots plus internally
|
|
19
|
-
scrolling components (
|
|
19
|
+
scrolling components (Table, InfoCard with `scrollable`) keep
|
|
20
20
|
them fitting the viewport. Workflow / dossier pages (/change-request) and other pages
|
|
21
21
|
(/tables, /design-system) use this scroll when their
|
|
22
22
|
content is taller than the visible area.
|
|
@@ -26,7 +26,7 @@ export default function AppLayout({ children }: { children: React.ReactNode }) {
|
|
|
26
26
|
padding) keeps content detached from the viewport bottom. */}
|
|
27
27
|
<main
|
|
28
28
|
id="app-main"
|
|
29
|
-
className={`
|
|
29
|
+
className={`flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto overflow-x-hidden pb-component${
|
|
30
30
|
navCollapsed ? "" : " max-md:overflow-hidden"
|
|
31
31
|
}`}
|
|
32
32
|
>
|
|
@@ -38,4 +38,4 @@ export default function AppLayout({ children }: { children: React.ReactNode }) {
|
|
|
38
38
|
</main>
|
|
39
39
|
</div>
|
|
40
40
|
);
|
|
41
|
-
}
|
|
41
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
1
|
+
export { AppLayout } from "./app-layout";
|
|
2
|
+
export { Header } from "./header";
|
|
3
|
+
export { SideNav } from "./side-nav";
|
|
@@ -23,9 +23,9 @@ interface NavItem {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
const NAV_ITEMS: NavItem[] = [
|
|
26
|
-
{ label: "
|
|
26
|
+
{ label: "Accueil", href: "/", icon: "Flame" },
|
|
27
27
|
{ label: "Design System", href: "/design-system", icon: "Palette" },
|
|
28
|
-
{ label: "Components", href: "/components", icon: "Puzzle" }
|
|
28
|
+
{ label: "Components", href: "/components", icon: "Puzzle" },
|
|
29
29
|
];
|
|
30
30
|
|
|
31
31
|
interface SideNavProps {
|
|
@@ -33,7 +33,7 @@ interface SideNavProps {
|
|
|
33
33
|
onCollapsedChange: (collapsed: boolean) => void;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
export
|
|
36
|
+
export function SideNav({
|
|
37
37
|
collapsed,
|
|
38
38
|
onCollapsedChange,
|
|
39
39
|
}: SideNavProps) {
|
|
@@ -152,9 +152,9 @@ export default function SideNav({
|
|
|
152
152
|
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"
|
|
153
153
|
>
|
|
154
154
|
{collapsed ? (
|
|
155
|
-
<Icon name="PanelLeftOpen" aria-hidden="true" />
|
|
155
|
+
<Icon name="PanelLeftOpen" variant="white" aria-hidden="true" />
|
|
156
156
|
) : (
|
|
157
|
-
<Icon name="PanelLeftClose" aria-hidden="true" />
|
|
157
|
+
<Icon name="PanelLeftClose" variant="white" aria-hidden="true" />
|
|
158
158
|
)}
|
|
159
159
|
</button>
|
|
160
160
|
</div>
|
|
@@ -186,11 +186,12 @@ export default function SideNav({
|
|
|
186
186
|
: "text-white/80 hover:bg-white/10 hover:text-white"
|
|
187
187
|
} ${showLabels ? "" : "justify-center"}`}
|
|
188
188
|
>
|
|
189
|
-
<Icon name={item.icon} aria-hidden="true" />
|
|
189
|
+
<Icon name={item.icon} variant="white" aria-hidden="true" />
|
|
190
190
|
{showLabels ? <span className="truncate">{item.label}</span> : null}
|
|
191
191
|
{hasChildren && showLabels ? (
|
|
192
192
|
<Icon
|
|
193
193
|
name="ChevronDown"
|
|
194
|
+
variant="white"
|
|
194
195
|
aria-hidden="true"
|
|
195
196
|
className={`ml-auto transition-transform ${
|
|
196
197
|
isOpen ? "rotate-180" : ""
|
|
@@ -200,7 +201,7 @@ export default function SideNav({
|
|
|
200
201
|
</button>
|
|
201
202
|
|
|
202
203
|
{hasChildren && showLabels && isOpen ? (
|
|
203
|
-
<div className="ml-
|
|
204
|
+
<div className="ml-5 flex flex-col gap-1 border-l border-white/20 pl-2">
|
|
204
205
|
{item.children!.map((child) => {
|
|
205
206
|
const isChildActive = pathname === child.href;
|
|
206
207
|
return (
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export { default as InfoCard, InfoList } from "./info-card";
|
|
3
|
-
export type { InfoListLayout } from "./info-card";
|
|
4
|
-
export { default as DetailHeader } from "./detail-header";
|
|
5
|
-
export { default as TableSection } from "./table-section";
|
|
6
|
-
export { default as TimelineList } from "./timeline-list";
|
|
7
|
-
export type { TimelineEntry } from "./timeline-list";
|
|
1
|
+
|
|
8
2
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
import { Icon } from "@/components/ui";
|
|
3
|
-
import type { IconName } from "@/components/ui";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* En-tête d'identité d'une fiche : icône, titre, description, badges ou actions.
|
|
7
|
-
*/
|
|
8
|
-
export default function DetailHeader({
|
|
9
|
-
icon,
|
|
10
|
-
title,
|
|
11
|
-
description,
|
|
12
|
-
children,
|
|
13
|
-
}: {
|
|
14
|
-
icon: IconName;
|
|
15
|
-
title: string;
|
|
16
|
-
description?: string;
|
|
17
|
-
children?: ReactNode;
|
|
18
|
-
}) {
|
|
19
|
-
return (
|
|
20
|
-
<header className="flex flex-wrap items-start justify-between gap-inline">
|
|
21
|
-
<div className="flex min-w-0 items-start gap-inline">
|
|
22
|
-
<div className="flex size-14 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary">
|
|
23
|
-
<Icon name={icon} size="large" aria-hidden="true" />
|
|
24
|
-
</div>
|
|
25
|
-
<div className="min-w-0">
|
|
26
|
-
<h2 className="text-section-title text-foreground">{title}</h2>
|
|
27
|
-
{description ? (
|
|
28
|
-
<p className="mt-micro text-small text-muted-foreground">
|
|
29
|
-
{description}
|
|
30
|
-
</p>
|
|
31
|
-
) : null}
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
{children ? (
|
|
35
|
-
<div className="flex flex-wrap items-center gap-inline">{children}</div>
|
|
36
|
-
) : null}
|
|
37
|
-
</header>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
import { Icon } from "@/components/ui";
|
|
3
|
-
import type { IconName } from "@/components/ui";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Carte d'information des fiches détail : en-tête icône + titre, corps libre.
|
|
7
|
-
* Réutilisée par les fiches équipement, service et incident.
|
|
8
|
-
*/
|
|
9
|
-
export default function InfoCard({
|
|
10
|
-
icon,
|
|
11
|
-
title,
|
|
12
|
-
children,
|
|
13
|
-
scrollable = false,
|
|
14
|
-
}: {
|
|
15
|
-
icon: IconName;
|
|
16
|
-
title: string;
|
|
17
|
-
children: ReactNode;
|
|
18
|
-
/** At md+, the body scrolls inside the card. Below md, the page scrolls instead. */
|
|
19
|
-
scrollable?: boolean;
|
|
20
|
-
}) {
|
|
21
|
-
return (
|
|
22
|
-
<section className={scrollable ? "flex min-h-0 flex-col rounded-large border border-border bg-surface p-component" : "rounded-large border border-border bg-surface p-component"}>
|
|
23
|
-
<header className={scrollable ? "shrink-0 flex items-center gap-inline" : "flex items-center gap-inline"}>
|
|
24
|
-
<Icon name={icon} variant="muted" aria-hidden="true" />
|
|
25
|
-
<h3 className="text-component-title text-foreground">{title}</h3>
|
|
26
|
-
</header>
|
|
27
|
-
<div
|
|
28
|
-
className={scrollable ? "mt-component min-h-0 flex-1 md:overflow-y-auto" : "mt-component"}
|
|
29
|
-
>
|
|
30
|
-
{children}
|
|
31
|
-
</div>
|
|
32
|
-
</section>
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export type InfoListLayout = "inline" | "stacked";
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Liste label/valeur compacte affichée dans les cartes d'information.
|
|
40
|
-
* `inline` : valeur à droite (fiches courtes). `stacked` : label au-dessus (textes longs).
|
|
41
|
-
*/
|
|
42
|
-
export function InfoList({
|
|
43
|
-
rows,
|
|
44
|
-
layout = "inline",
|
|
45
|
-
}: {
|
|
46
|
-
rows: { label: string; value: ReactNode }[];
|
|
47
|
-
layout?: InfoListLayout;
|
|
48
|
-
}) {
|
|
49
|
-
const stacked = layout === "stacked";
|
|
50
|
-
return (
|
|
51
|
-
<dl>
|
|
52
|
-
{rows.map((row) => (
|
|
53
|
-
<div
|
|
54
|
-
key={row.label}
|
|
55
|
-
className={
|
|
56
|
-
stacked
|
|
57
|
-
? "border-b border-border py-inline last:border-b-0"
|
|
58
|
-
: "flex items-start justify-between gap-inline border-b border-border py-inline last:border-b-0"
|
|
59
|
-
}
|
|
60
|
-
>
|
|
61
|
-
<dt className="text-label text-muted-foreground">{row.label}</dt>
|
|
62
|
-
<dd
|
|
63
|
-
className={
|
|
64
|
-
stacked
|
|
65
|
-
? "mt-micro text-body-medium text-foreground"
|
|
66
|
-
: "max-w-[60%] text-right text-body-medium text-foreground break-all"
|
|
67
|
-
}
|
|
68
|
-
>
|
|
69
|
-
{row.value}
|
|
70
|
-
</dd>
|
|
71
|
-
</div>
|
|
72
|
-
))}
|
|
73
|
-
</dl>
|
|
74
|
-
);
|
|
75
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Icon } from "@/components/ui";
|
|
2
|
-
import type { IconName, IconVariant } from "@/components/ui";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Carte de synthèse compacte des pages dashboard : une icône, un chiffre clé
|
|
6
|
-
* et son libellé. Réutilisée par les pages équipements, infrastructure et
|
|
7
|
-
* incidents.
|
|
8
|
-
*/
|
|
9
|
-
export default function SummaryCard({
|
|
10
|
-
icon,
|
|
11
|
-
iconVariant,
|
|
12
|
-
label,
|
|
13
|
-
count,
|
|
14
|
-
}: {
|
|
15
|
-
icon: IconName;
|
|
16
|
-
iconVariant: IconVariant;
|
|
17
|
-
label: string;
|
|
18
|
-
count: number | string;
|
|
19
|
-
}) {
|
|
20
|
-
return (
|
|
21
|
-
<div className="rounded-large border border-border bg-surface p-component">
|
|
22
|
-
<div className="flex items-center gap-inline">
|
|
23
|
-
<Icon name={icon} variant={iconVariant} size="large" aria-hidden="true" />
|
|
24
|
-
<p className="text-component-title leading-none text-foreground">
|
|
25
|
-
{count}
|
|
26
|
-
</p>
|
|
27
|
-
</div>
|
|
28
|
-
<p className="mt-micro text-small text-muted-foreground">{label}</p>
|
|
29
|
-
</div>
|
|
30
|
-
);
|
|
31
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
import { Badge, Icon } from "@/components/ui";
|
|
3
|
-
import type { IconName } from "@/components/ui";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Section de page avec en-tête (icône + titre + compteur) et contenu libre.
|
|
7
|
-
* Réutilisée par les onglets équipement et autres sections de tableau.
|
|
8
|
-
*/
|
|
9
|
-
export default function TableSection({
|
|
10
|
-
icon,
|
|
11
|
-
title,
|
|
12
|
-
count,
|
|
13
|
-
children,
|
|
14
|
-
className,
|
|
15
|
-
}: {
|
|
16
|
-
icon: IconName;
|
|
17
|
-
title: string;
|
|
18
|
-
count?: number;
|
|
19
|
-
children: ReactNode;
|
|
20
|
-
className?: string;
|
|
21
|
-
}) {
|
|
22
|
-
return (
|
|
23
|
-
<section className={`flex min-h-0 flex-1 flex-col ${className ?? ""}`}>
|
|
24
|
-
<div className="flex items-center justify-between gap-inline">
|
|
25
|
-
<div className="flex items-center gap-inline">
|
|
26
|
-
<Icon name={icon} variant="muted" aria-hidden="true" />
|
|
27
|
-
<h3 className="text-component-title text-foreground">{title}</h3>
|
|
28
|
-
</div>
|
|
29
|
-
{typeof count === "number" ? (
|
|
30
|
-
<Badge variant="secondary">{count}</Badge>
|
|
31
|
-
) : null}
|
|
32
|
-
</div>
|
|
33
|
-
<div className="mt-component flex min-h-0 flex-1 flex-col">
|
|
34
|
-
{children}
|
|
35
|
-
</div>
|
|
36
|
-
</section>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Entrée de timeline avec heure formatée et texte descriptif.
|
|
3
|
-
*/
|
|
4
|
-
export interface TimelineEntry {
|
|
5
|
-
time: string;
|
|
6
|
-
text: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Liste d'historique avec heure et texte descriptif.
|
|
11
|
-
* Réutilisée par les fiches incident et autres vues temporelles.
|
|
12
|
-
*/
|
|
13
|
-
export default function TimelineList({ entries }: { entries: TimelineEntry[] }) {
|
|
14
|
-
return (
|
|
15
|
-
<ul className="space-y-component">
|
|
16
|
-
{entries.map((entry, i) => (
|
|
17
|
-
<li
|
|
18
|
-
key={entry.time + "-" + entry.text + "-" + i}
|
|
19
|
-
className="flex items-start gap-inline border-b border-border py-inline last:border-b-0"
|
|
20
|
-
>
|
|
21
|
-
<span className="w-20 shrink-0 font-mono text-body-medium text-muted-foreground">
|
|
22
|
-
{entry.time}
|
|
23
|
-
</span>
|
|
24
|
-
<span className="min-w-0 flex-1 text-body-medium text-foreground">
|
|
25
|
-
{entry.text}
|
|
26
|
-
</span>
|
|
27
|
-
</li>
|
|
28
|
-
))}
|
|
29
|
-
</ul>
|
|
30
|
-
);
|
|
31
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|