Refine toolbox navigation and local data controls
All checks were successful
Deploy Sokko G / deploy (push) Successful in 20s

This commit is contained in:
Shinuwa 2026-10-15 10:52:34 +02:00
parent 954240adf9
commit 2f2e79d200
27 changed files with 614 additions and 302 deletions

View file

@ -81,3 +81,19 @@
{"id":"int-509322d17a6683aaacd412fad424ae68","kind":"field_change","created_at":"2026-10-14T09:42:58.067800508Z","actor":"Shinuwa","issue_id":"sokko-g-9bu","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Mutations IndexedDB atomiques par ressource, conflits explicites et rafraîchissement BroadcastChannel ajoutés. Exports cohérents et médias différés préservés. Validation : npm run check, 181 E2E, 2 E2E production et profil toolbox complet."}}
{"id":"int-3406330031f4841c323e62202c4a3c1e","kind":"field_change","created_at":"2026-10-14T14:53:56.830663059Z","actor":"Shinuwa","issue_id":"sokko-g-0la","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Import JSON v2 validé intégralement avant écriture : enveloppes, 17 types, IDs, espaces et références ; refus atomique, remappage global, concurrence, documentation et suites check/E2E vertes."}}
{"id":"int-a4a671aa3d78d0fd93b9b59398a2d7ef","kind":"field_change","created_at":"2026-10-14T17:47:01.41961034Z","actor":"Shinuwa","issue_id":"sokko-g-0lf","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Shared modal behavior implemented and validated across all dialog workflows"}}
{"id":"int-6083f92920e36f7679745ada3f13707e","kind":"field_change","created_at":"2026-10-14T22:03:35.952224656Z","actor":"Shinuwa","issue_id":"sokko-g-g5r","extra":{"field":"status","new_value":"in_progress","old_value":"open"}}
{"id":"int-be8bebb0c40c65ca088170962fbfba92","kind":"field_change","created_at":"2026-10-14T22:22:05.83300631Z","actor":"Shinuwa","issue_id":"sokko-g-g5r","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"P01 livré : en-tête compact, collection prioritaire et gestion locale regroupée. Validation : npm run check vert (18 suites Node, lint, build) ; 183 scénarios E2E non concernés verts puis 11/11 scénarios ciblés verts après adaptation des accès à l'export global ; zéro/une/dix toolboxes, 768x720, clavier, focus et réordonnancement persistant couverts."}}
{"id":"int-97eb3ca346a1ba6c07d87a1a0f56b8b7","kind":"field_change","created_at":"2026-10-15T07:37:46.919567266Z","actor":"Shinuwa","issue_id":"sokko-g-g5r","extra":{"field":"status","new_value":"in_progress","old_value":"open"}}
{"id":"int-24354457415bcbc826f4a5cb4aa99bf7","kind":"field_change","created_at":"2026-10-15T07:43:38.480924801Z","actor":"Shinuwa","issue_id":"sokko-g-g5r","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"P01 corrigé après revue visuelle : hero Toolboxes aligné sur la primitive et la hauteur de la page Jeux, sauvegarde automatique mise en avant dans le hero, jauge de stockage rétablie en bas de la collection. Validation : npm run check vert ; 36 scénarios ciblés exécutés, puis les 4 scénarios toolbox-list repassés après ajustement final (hauteur identique, 768x720, clavier, noms longs, réordonnancement)."}}
{"id":"int-42c7c3b1df6c2a121af8c0b4bf7fb26e","kind":"field_change","created_at":"2026-10-15T07:44:20.054497649Z","actor":"Shinuwa","issue_id":"sokko-g-g5r","extra":{"field":"status","new_value":"in_progress","old_value":"open"}}
{"id":"int-6aeef8bebbffe42833e84cd4d235b817","kind":"field_change","created_at":"2026-10-15T07:51:22.106289573Z","actor":"Shinuwa","issue_id":"sokko-g-g5r","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"P01 ajusté après revue visuelle : actions Créer et Importer sous la description du hero Toolbox, heroes Jeux et Toolboxes alignés à 195 px, sauvegarde automatique déplacée dans le bloc Local only et encart Dans ce navigateur supprimé. Validation : npm run check vert ; 36 scénarios ciblés exécutés lors de la correction, puis 18/18 scénarios layout et toolbox-list verts après l'ajustement final à 768 x 720."}}
{"id":"int-d17d1b8a071f517797131fe5a7952ca4","kind":"field_change","created_at":"2026-10-15T07:52:59.813135702Z","actor":"Shinuwa","issue_id":"sokko-g-g5r","extra":{"field":"status","new_value":"in_progress","old_value":"open"}}
{"id":"int-66ab229eb386db91d702ff3b3dcc466f","kind":"field_change","created_at":"2026-10-15T07:57:26.700386895Z","actor":"Shinuwa","issue_id":"sokko-g-g5r","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"P01 finalisé après nouvelle revue visuelle : compteur accolé à Mes toolboxes, bouton textuel Sauvegarde auto sous Export/Import dans Local only, préférences placées avant les transferts dans Gestion locale avec focus initial cohérent. Validation : npm run check vert ; 36 scénarios E2E ciblés couverts, dont 18/18 layout et toolbox-list verts après l'ajustement final."}}
{"id":"int-aff8780b2751830a67f3395d1b3088ac","kind":"field_change","created_at":"2026-10-15T08:04:39.276393948Z","actor":"Shinuwa","issue_id":"sokko-g-g5r","extra":{"field":"status","new_value":"in_progress","old_value":"open"}}
{"id":"int-12538c3332f2eb35f77250a29896ae58","kind":"field_change","created_at":"2026-10-15T08:05:46.099721938Z","actor":"Shinuwa","issue_id":"sokko-g-g5r","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Ajustement final du bloc Local only : Export et Import se partagent toute la largeur sur sidebar large, tout en conservant les contrôles compacts sous 1025 px. Validation : 18/18 scénarios E2E layout et toolbox-list, puis npm run check vert."}}
{"id":"int-1c29ba5f515ed689ec87242fd2ad5825","kind":"field_change","created_at":"2026-10-15T08:07:20.457360142Z","actor":"Shinuwa","issue_id":"sokko-g-g5r","extra":{"field":"status","new_value":"in_progress","old_value":"open"}}
{"id":"int-a7f947ab812c5d927505a8707762e158","kind":"field_change","created_at":"2026-10-15T08:08:53.896664687Z","actor":"Shinuwa","issue_id":"sokko-g-g5r","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Ajustement visuel final : icône retirée de Sauvegarde auto en sidebar large et trois actions locales réduites à la taille xs de 30 px ; l'icône reste uniquement en sidebar compacte pour conserver un contrôle visible. Validation : 18/18 E2E ciblés et npm run check vert."}}
{"id":"int-2cc51f82fcb13a2a31ee3f77678cbe66","kind":"field_change","created_at":"2026-10-15T08:10:44.303445934Z","actor":"Shinuwa","issue_id":"sokko-g-g5r","extra":{"field":"status","new_value":"in_progress","old_value":"open"}}
{"id":"int-e42488aadb8676bb24c05e9353a5c0b5","kind":"field_change","created_at":"2026-10-15T08:12:10.784897269Z","actor":"Shinuwa","issue_id":"sokko-g-g5r","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Correction de largeur : les actions Local only forment désormais un groupe compact centré calculé sur la largeur naturelle de Sauvegarde auto ; Export et Import se partagent cette largeur au lieu d'occuper tout l'encart. Validation : 18/18 E2E ciblés et npm run check vert."}}
{"id":"int-a35834f1edbd5b644001faba59dd5d3e","kind":"field_change","created_at":"2026-10-15T08:18:29.878536901Z","actor":"Shinuwa","issue_id":"sokko-g-g5r","extra":{"field":"status","new_value":"in_progress","old_value":"open"}}
{"id":"int-75bf6b86c4294cd87f5f531f67811981","kind":"field_change","created_at":"2026-10-15T08:25:01.763951145Z","actor":"Shinuwa","issue_id":"sokko-g-g5r","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Simplified the sidebar to Backup and Import, reorganized the automatic backup modal, and validated the updated flows."}}

View file

@ -626,6 +626,8 @@ Outil Tableau :
Les toolboxes sont locales et stockees dans le navigateur.
Les pages Jeux et Toolboxes partagent le hero `primary-list-hero` de `195px`. Sur Toolboxes, les actions « Créer » et « Importer » suivent directement la description, à gauche comme sur l'accueil. L'accès « Données et préférences » et la librairie forment la barre secondaire. Le nombre de toolboxes est accolé au titre « Mes toolboxes ». Dans le bloc « Local only », « Sauvegarde auto » est accompagné d'un bouton d'import réduit à son icône et à son infobulle ; l'export global reste dans « Données et préférences ». En sidebar compacte, les deux actions utilisent leurs icônes et infobulles. Aucun second encart de stockage local n'est affiché dans la collection. La jauge de stockage reste en bas de page. La fenêtre de gestion présente d'abord les préférences d'alertes, puis l'import/export global et les explications IndexedDB. La fenêtre de sauvegarde place la configuration et ses actions en premier, puis la compatibilité ; la section « Comment fonctionne la sauvegarde » termine le contenu explicatif. À `768px`, le nom de la première carte et sa couverture ouvrable doivent rester visibles sans défilement, y compris avec un nom long et une association de jeu.
La fenêtre « Ajouter un outil » peut s'étendre jusqu'à `900px` et présente les outils sur 4 colonnes à `768px`, puis 5 à partir de `900px`. Chaque carte compacte place l'icône à gauche du nom complet, puis une courte phrase d'usage issue de `site.json` sur toute la largeur. Le contenu est réparti dans les cinq catégories du catalogue, chacune signalée par un titre et un séparateur discret, sans onglets de filtrage. Lorsque la hauteur disponible ne suffit pas, la modale utilise directement `scrollbar-control`, la scrollbar verticale du NDS. L'ajout rapide reste une grille d'icônes sans description ; ses boutons utilisent les infobulles NDS au survol et au focus.
Regles UI :
@ -634,8 +636,9 @@ Regles UI :
- image de jeu si associee a un jeu ;
- icone editable si toolbox libre ;
- action importer/exporter clairement identifiee ;
- budget IndexedDB recommande visible en bas de page/panneau, avec quota navigateur reel seulement informatif ;
- import/export global disponibles.
- budget IndexedDB recommande visible en bas de la collection et des panneaux de toolbox, avec quota navigateur reel seulement informatif ;
- import/export global disponibles dans « Données et préférences » ; import individuel accessible directement depuis l'en-tête de collection ;
- états vide, un élément et collection dense sans détour pédagogique dans la grille des cartes.
Les cards toolbox doivent garder une taille compacte. L'image/icone de cover est cliquable.

View file

@ -26,10 +26,12 @@ Compléter ensuite `aria-current` et l'accès direct au contenu dans `Shell.jsx`
Lot partagé avec le [plan des parcours](04_PARCOURS_DU_SITE.md), constats S02/F01. Effort moyen. Réutiliser S01 pour toute nouvelle fenêtre.
Composition proposée : en-tête compact et création, collection personnelle, accès secondaire unique aux préférences et sauvegardes. Le stockage local reste indiqué brièvement. Le contenu précis des actions est défini dans le plan parcours pour éviter deux versions du même écran.
**État au 15 octobre 2026 : réalisé après revue visuelle.** La carte pédagogique et les préférences ont quitté la grille. Les pages Jeux et Toolboxes partagent un hero légèrement agrandi ; sur Toolboxes, création et import suivent la description comme sur l'accueil, et le compteur reste accolé au titre de collection. « Sauvegarde auto » et l'icône d'import forment les deux seules actions du bloc « Local only » de la barre latérale. La jauge de stockage revient en bas de la collection, la modale de gestion présente les préférences avant les transferts et la modale de sauvegarde relègue son explication détaillée en dernière section. Les tests de layout et de parcours vérifient l'égalité de hauteur avec la page Jeux, la largeur minimale, les noms longs, les associations de jeu, le focus et l'absence de débordement global.
Composition retenue après revue : hero commun avec la page Jeux, création et import sous la description, puis collection personnelle et accès secondaires. Le stockage local et la sauvegarde automatique restent regroupés dans la barre latérale, avec la jauge en bas de page. Le contenu précis des actions est défini dans le plan parcours pour éviter deux versions du même écran.
1. Capturer la page avec zéro, une et dix toolboxes à 768 × 720 et en large.
2. Réduire la hauteur du hero et sortir les préférences d'alertes ainsi que la carte pédagogique de la grille des toolboxes.
2. Réutiliser la hauteur du hero Jeux et sortir les préférences d'alertes ainsi que la carte pédagogique de la grille des toolboxes.
3. Réutiliser boutons, surfaces, focus et scrollbars NDS ; garder une seule action visuellement dominante par zone.
4. Vérifier noms longs, couverture personnalisée, association jeu, déplacement des cartes et accès aux sauvegardes.

View file

@ -9,10 +9,12 @@ Ces lots démarrent après la consolidation des données. Ils conservent le stoc
Constats F01/S02. Effort moyen. Dépend de S01 pour les fenêtres réutilisées.
**État au 15 octobre 2026 : réalisé après revue visuelle.** Les pages Jeux et Toolboxes partagent un hero légèrement agrandi. Sur Toolboxes, « Créer » et « Importer » suivent la description à gauche, comme sur l'accueil, et le compteur est accolé au titre de collection. Le bloc « Local only » conserve seulement « Sauvegarde auto » et l'action d'import sous forme d'icône ; l'export global reste dans « Données et préférences ». La sidebar compacte utilise les icônes de ces deux actions. La jauge de stockage reste en bas de la collection, sans second encart explicatif redondant. La gestion locale commence par les préférences, avant les transferts. La fenêtre de sauvegarde présente sa configuration avant la compatibilité et termine par « Comment fonctionne la sauvegarde ». Les scénarios Playwright couvrent l'égalité de hauteur des heroes, l'état vide, une toolbox liée avec nom long à `768 × 720`, dix toolboxes, le clavier, le retour du focus et le réordonnancement persistant.
1. Préparer trois états : aucune toolbox, une toolbox, collection avec noms longs et associations de jeux.
2. Remplacer le grand hero de la liste par un en-tête compact : titre, création et accès aux actions secondaires. Afficher ensuite les toolboxes.
3. Regrouper les commandes de sauvegarde/import/export dans un accès nommé clairement, et déplacer les préférences d'alertes hors de la collection. Conserver un accès explicite à l'import individuel.
4. Garder un rappel court « Dans ce navigateur » et réserver les détails techniques à une explication secondaire. Ne pas annoncer un état enregistré non confirmé.
2. Aligner les heroes Toolboxes et Jeux sur une taille commune légèrement supérieure. Placer « Créer » et « Importer » sous la description du hero Toolboxes, dans la colonne gauche.
3. Placer « Sauvegarde auto » et l'icône d'import dans le bloc « Local only » de la barre latérale. Conserver l'export global avec les préférences et transferts dans « Données et préférences », avec les préférences en premier.
4. Garder la jauge de stockage en bas de la collection et supprimer le second rappel « Dans ce navigateur » devenu redondant. Réserver les détails techniques à une explication secondaire et ne pas annoncer un état enregistré non confirmé.
5. Conserver création avec tutoriel depuis l'accueil, réorganisation des cartes et lien vers la librairie.
Fichiers : `ToolboxPages.jsx`, `ToolboxCard.jsx`, `ToolboxModals.jsx`, styles de layout toolbox, `site.json` et son validateur.

View file

@ -65,11 +65,17 @@ async function disk(page) {
}
async function exportJson(page, buttonName = "Exporter tout") {
const globalExport = buttonName === "Exporter tout";
const management = page.getByRole("dialog", { name: "Données et préférences" });
if (globalExport && !await management.isVisible()) {
await page.getByRole("button", { name: "Données et préférences", exact: true }).click();
}
const download = page.waitForEvent("download");
await page.getByRole("button", { name: buttonName, exact: true }).click();
await (globalExport ? management : page).getByRole("button", { name: buttonName, exact: true }).click();
const stream = await (await download).createReadStream();
const chunks = [];
for await (const chunk of stream) chunks.push(chunk);
if (globalExport) await management.getByRole("button", { name: "Fermer", exact: true }).last().click();
return JSON.parse(Buffer.concat(chunks).toString());
}
@ -180,7 +186,8 @@ test("failed media exports produce no partial download and can be retried", asyn
const downloads = [];
page.on("download", (download) => downloads.push(download));
await page.evaluate(() => { window.failedMediaKey = "b:images"; });
await page.getByRole("button", { name: "Exporter tout", exact: true }).click();
await page.getByRole("button", { name: "Données et préférences", exact: true }).click();
await page.getByRole("dialog", { name: "Données et préférences" }).getByRole("button", { name: "Exporter tout", exact: true }).click();
const dialog = page.getByRole("dialog", { name: "Erreur de stockage local" });
await expect(dialog).toBeVisible();
expect(downloads).toHaveLength(0);

View file

@ -75,8 +75,10 @@ for (const fault of ["open", "read"]) {
expect(await snapshot(page)).toEqual(original);
await page.evaluate(() => { window.location.hash = "/toolboxes"; });
await page.getByRole("button", { name: "Données et préférences", exact: true }).click();
const management = page.getByRole("dialog", { name: "Données et préférences" });
const downloadPromise = page.waitForEvent("download");
await page.getByRole("button", { name: "Exporter tout", exact: true }).click();
await management.getByRole("button", { name: "Exporter tout", exact: true }).click();
const download = await downloadPromise;
const stream = await download.createReadStream();
const chunks = [];
@ -85,6 +87,7 @@ for (const fault of ["open", "read"]) {
expect(exported.toolboxes[0].id).toBe("saved");
expect(exported.modules["saved:note"].items[0].text).toBe("Ne pas perdre");
expect(await snapshot(page)).toEqual(original);
await management.getByRole("button", { name: "Fermer", exact: true }).last().click();
await page.getByRole("button", { name: "Nouvelle toolbox", exact: true }).click();
await page.getByRole("textbox", { name: "Nom", exact: true }).fill("Après reprise");

View file

@ -102,6 +102,7 @@ for (const width of [1920, 1280, 1025, 1024, 960, 768]) {
const storageActions = await page.locator(".sidebar-action-button").evaluateAll((elements) => elements.map((element) => element.getBoundingClientRect()));
expect(storageActions[1].x).toBeGreaterThan(storageActions[0].x);
expect(storageActions[1].y).toBeCloseTo(storageActions[0].y, 0);
await expect(page.locator(".sidebar-storage-action-label")).toBeVisible();
const secondaryBox = await secondaryLinks.boundingBox();
const storageBox = await page.locator(".sidebar-note").boundingBox();
expect(secondaryBox.y + secondaryBox.height).toBeLessThan(storageBox.y);
@ -142,7 +143,8 @@ for (const width of [1280, 768]) {
<article class="module layout-calculator" data-module-type="calculator"><div class="calculator-module"><div>Formula</div><div class="calculator-result"><strong>12</strong></div></div></article>
<div class="task-planner-module"><div class="task-planner-settings"><label>Reset</label><label>Time</label></div></div>
<div class="equipment-planner-summary"><div class="equipment-planner-summary-source-grid"><div>Equipment</div><div>Materials</div></div></div>
<div class="toolbox-actions-row"><div>Actions</div><div>Preferences</div></div>
<section class="page-hero nds-page-hero primary-list-hero toolbox-list-hero"><div><h1>Toolboxes</h1><p>Collection locale</p><div class="toolbox-list-primary-actions nds-toolbar"><button>Créer</button><button>Importer</button></div></div></section>
<div class="toolbox-list-actions nds-toolbar"><button>Préférences</button><button>Librairie</button></div>
</main>`);
await columns(page.locator(".game-layout"), 1);
await expect(page.locator(".game-grid")).toHaveCSS("display", "grid");
@ -156,7 +158,10 @@ for (const width of [1280, 768]) {
await columns(page.locator(".equipment-planner-summary-source-grid"), width <= 760 ? 1 : 2);
await page.locator(".equipment-planner-summary-source-grid").evaluate((element) => element.classList.add("columns-1"));
await columns(page.locator(".equipment-planner-summary-source-grid"), 1);
await expect(page.locator(".toolbox-actions-row")).toHaveCSS("flex-direction", width <= 760 ? "column" : "row");
await columns(page.locator(".toolbox-list-hero"), 2);
await expect(page.locator(".toolbox-list-hero")).toHaveCSS("min-height", "195px");
await expect(page.locator(".toolbox-list-primary-actions")).toHaveCSS("justify-content", "flex-start");
await expect(page.locator(".toolbox-list-actions")).toHaveCSS("justify-content", "flex-end");
await page.locator(".modules").evaluate((element) => { element.dataset.layoutCols = "1"; });
await columns(page.locator(".modules"), 1);
await expectFits(page.locator("main"));

145
e2e/toolbox-list.spec.js Normal file
View file

@ -0,0 +1,145 @@
// Rôle : valide l’accès immédiat aux toolboxes et aux réglages locaux de la collection.
/* global document */
import { expect, test } from "@playwright/test";
import { resetSokkoStorage } from "./helpers/storage.js";
function toolbox(id, name) {
return {
id,
name,
modules: [],
updatedAt: `2026-10-${String(Number(id.replace("toolbox-", "")) + 1).padStart(2, "0")}T10:00:00.000Z`
};
}
async function seedToolboxes(page, toolboxes, links = {}) {
await page.evaluate(async ({ nextToolboxes, nextLinks }) => {
const db = await import("/src/utils/indexedDbStorage.js");
await db.setToolboxSnapshot(nextToolboxes, nextLinks, {});
}, { nextToolboxes: toolboxes, nextLinks: links });
await page.reload();
}
test.beforeEach(async ({ page }) => {
await page.setViewportSize({ width: 768, height: 720 });
await resetSokkoStorage(page);
await page.goto("/#/toolboxes");
});
test("keeps the empty action clear and groups local data settings in one dialog", async ({ page }) => {
await expect(page.getByRole("heading", { name: "Aucune toolbox" })).toBeVisible();
await expect(page.getByRole("button", { name: "Créer ma première toolbox" })).toBeVisible();
const automaticBackup = page.locator(".sidebar-note").getByRole("button", { name: "Sauvegarde automatique" });
await expect(automaticBackup).toBeVisible();
await expect(automaticBackup).toHaveAttribute("data-variant", "primary");
await expect(page.locator(".sidebar-note").getByRole("button", { name: "Importer toutes les toolboxes" })).toBeVisible();
await expect(page.locator(".sidebar-note").getByRole("button", { name: "Exporter toutes les toolboxes" })).toHaveCount(0);
await expect(page.getByLabel("Budget recommandé de stockage local")).toBeVisible();
const individualImport = page.locator(".toolbox-list-hero").getByRole("button", { name: "Importer une toolbox" });
await expect(individualImport).toBeVisible();
await individualImport.focus();
const fileChooser = page.waitForEvent("filechooser");
await individualImport.press("Enter");
await fileChooser;
const managementTrigger = page.getByRole("button", { name: "Données et préférences" });
await managementTrigger.click();
const management = page.getByRole("dialog", { name: "Données et préférences" });
await expect(management).toBeVisible();
await expect(management.getByRole("radio", { checked: true })).toBeFocused();
await expect(management.getByRole("button", { name: "Importer tout" })).toBeVisible();
await expect(management.getByRole("radiogroup", { name: "Positionnement des alertes" })).toBeVisible();
const preferencesHeading = management.getByRole("heading", { name: "Positionnement des alertes" });
const transfersHeading = management.getByRole("heading", { name: "Transferts de la collection" });
const [preferencesBox, transfersBox] = await Promise.all([preferencesHeading.boundingBox(), transfersHeading.boundingBox()]);
expect(preferencesBox.y).toBeLessThan(transfersBox.y);
const storageDetails = management.getByText("Comprendre le stockage local", { exact: true });
await storageDetails.focus();
await storageDetails.press("Enter");
await expect(management.getByText(/Rien n’est envoyé sur un serveur/)).toBeVisible();
await page.keyboard.press("Escape");
await expect(management).toHaveCount(0);
await expect(managementTrigger).toBeFocused();
await page.setViewportSize({ width: 1280, height: 720 });
const backupLabel = page.locator(".sidebar-storage-action-label");
await expect(backupLabel).toBeVisible();
await expect(backupLabel).toHaveText("Sauvegarde auto");
await expect(automaticBackup).toHaveCSS("padding-left", "8px");
await expect(automaticBackup).toHaveCSS("padding-right", "8px");
const sidebarImport = page.locator(".sidebar-note").getByRole("button", { name: "Importer toutes les toolboxes" });
await expect(sidebarImport).toHaveText("");
await expect(automaticBackup.locator(".ui-icon")).toHaveCount(0);
await expect(sidebarImport.locator(".ui-icon")).toHaveCount(1);
const [noteBox, actionsBox, backupBox, importBox] = await Promise.all([
page.locator(".sidebar-note").boundingBox(),
page.locator(".sidebar-storage-actions").boundingBox(),
automaticBackup.boundingBox(),
sidebarImport.boundingBox()
]);
expect(actionsBox.width).toBeLessThan(noteBox.width - 16);
expect(importBox.x).toBeGreaterThan(backupBox.x + backupBox.width);
expect(importBox.y).toBeCloseTo(backupBox.y, 0);
expect(importBox.height).toBeCloseTo(backupBox.height, 0);
expect(backupBox.height).toBeCloseTo(34, 0);
expect(importBox.width).toBeCloseTo(34, 0);
});
test("uses the same hero height as the games page", async ({ page }) => {
const toolboxHeroHeight = (await page.locator(".toolbox-list-hero").boundingBox()).height;
await page.goto("/#/games");
const gamesHero = page.locator(".page-hero");
await expect(gamesHero).toBeVisible();
const gamesHeroHeight = (await gamesHero.boundingBox()).height;
expect(toolboxHeroHeight).toBeCloseTo(gamesHeroHeight, 0);
});
test("shows one long game-linked toolbox name and its open action without scrolling", async ({ page }) => {
const longName = "Toolbox de préparation extrêmement longue pour la prochaine expédition coopérative";
await seedToolboxes(page, [toolbox("toolbox-1", longName)], { mhwilds: "toolbox-1" });
const card = page.locator(".toolbox-card");
const name = card.getByRole("heading", { name: longName });
const open = card.getByRole("link", { name: `Ouvrir ${longName}` }).first();
await expect(name).toBeVisible();
await expect(open).toBeVisible();
await expect(card.getByText(/Monster Hunter.*Wilds/)).toBeVisible();
const [nameBox, openBox] = await Promise.all([name.boundingBox(), open.boundingBox()]);
expect(nameBox.y + nameBox.height).toBeLessThanOrEqual(720);
expect(openBox.y + openBox.height).toBeLessThanOrEqual(720);
expect(await page.evaluate(() => document.documentElement.scrollWidth)).toBeLessThanOrEqual(768);
});
test("renders ten toolboxes without overflow and persists card reordering", async ({ page }) => {
const toolboxes = Array.from({ length: 10 }, (_, index) => toolbox(
`toolbox-${index + 1}`,
`Collection ${index + 1} — préparation détaillée avec un nom volontairement très long`
));
await seedToolboxes(page, toolboxes, { mhwilds: "toolbox-1", diablo4: "toolbox-2" });
const cards = page.locator(".toolbox-card");
await expect(cards).toHaveCount(10);
await expect(page.locator(".toolbox-collection-heading .nds-badge")).toHaveText("10");
const [titleBox, badgeBox] = await Promise.all([
page.getByRole("heading", { name: "Mes toolboxes" }).boundingBox(),
page.locator(".toolbox-collection-heading .nds-badge").boundingBox()
]);
expect(badgeBox.x).toBeGreaterThanOrEqual(titleBox.x + titleBox.width);
expect(badgeBox.x - (titleBox.x + titleBox.width)).toBeLessThanOrEqual(12);
expect(await page.evaluate(() => document.documentElement.scrollWidth)).toBeLessThanOrEqual(768);
const sourceHandle = cards.nth(0).getByRole("button", { name: /Déplacer Collection 1/ });
const target = cards.nth(1);
const [sourceBox, targetBox] = await Promise.all([sourceHandle.boundingBox(), target.boundingBox()]);
await page.mouse.move(sourceBox.x + sourceBox.width / 2, sourceBox.y + sourceBox.height / 2);
await page.mouse.down();
await page.mouse.move(targetBox.x + targetBox.width * 0.8, targetBox.y + targetBox.height / 2, { steps: 8 });
await page.mouse.up();
await expect(cards.nth(0).getByRole("heading")).toHaveText(/Collection 2/);
await page.reload();
await expect(cards.nth(0).getByRole("heading")).toHaveText(/Collection 2/);
});

View file

@ -328,8 +328,9 @@ test("imports and exports a toolbox payload", async ({ page }) => {
test("opens the local automatic backup settings modal", async ({ page }) => {
await page.goto("/#/toolboxes");
await expect(page.getByRole("button", { name: "Sauvegarde automatique", exact: true })).toBeVisible();
await page.getByRole("button", { name: "Sauvegarde automatique", exact: true }).click();
const backupButton = page.locator(".sidebar-note").getByRole("button", { name: "Sauvegarde automatique", exact: true });
await expect(backupButton).toBeVisible();
await backupButton.click();
const dialog = page.getByRole("dialog", { name: "Sauvegarde automatique" });
await expect(dialog).toBeVisible();
@ -343,9 +344,17 @@ test("opens the local automatic backup settings modal", async ({ page }) => {
await expect(dialog.getByText("Dossier configuré :", { exact: true })).toBeVisible();
await expect(dialog.getByText("Aucun dossier", { exact: true })).toBeVisible();
await expect(dialog.getByRole("checkbox")).toBeVisible();
const [settingsBox, compatibilityBox, guideBox] = await Promise.all([
dialog.locator(".auto-backup-settings").boundingBox(),
dialog.locator(".auto-backup-compatibility").boundingBox(),
dialog.locator(".auto-backup-permission-guide").boundingBox()
]);
expect(compatibilityBox.y).toBeGreaterThanOrEqual(settingsBox.y + settingsBox.height);
expect(guideBox.y).toBeGreaterThanOrEqual(compatibilityBox.y + compatibilityBox.height);
await dialog.getByRole("button", { name: "Fermer", exact: true }).last().click();
await expect(dialog).toHaveCount(0);
await expect(backupButton).toBeFocused();
});
test("offers an actionable backup alert without requesting permission at startup", async ({ page }) => {

View file

@ -269,6 +269,20 @@ export function validateSiteContent(site) {
"toolboxes.drawer.linkLabel",
"toolboxes.title",
"toolboxes.newButton",
"toolboxes.createShortButton",
"toolboxes.emptyAction",
"toolboxes.manageButton",
"toolboxes.primaryActionsLabel",
"toolboxes.collectionActionsLabel",
"toolboxes.collectionEyebrow",
"toolboxes.collectionTitle",
"toolboxes.management.eyebrow",
"toolboxes.management.title",
"toolboxes.management.description",
"toolboxes.management.dataTitle",
"toolboxes.management.dataDescription",
"toolboxes.management.storageDetailsTitle",
"toolboxes.management.close",
"toolboxes.libraryLink",
"toolboxes.importAll",
"toolboxes.exportAll",
@ -277,6 +291,7 @@ export function validateSiteContent(site) {
"toolboxes.toastPositionLabel",
"toolboxes.toastPositionLeft",
"toolboxes.toastPositionRight",
"toolboxes.autoBackup.sidebarLabel",
"toolboxes.autoBackup.eyebrow",
"toolboxes.autoBackup.title",
"toolboxes.autoBackup.description",

View file

@ -1857,6 +1857,22 @@
"eyebrow": "Données locales",
"title": "Toolboxes",
"newButton": "Nouvelle toolbox",
"createShortButton": "Créer",
"emptyAction": "Créer ma première toolbox",
"manageButton": "Données et préférences",
"primaryActionsLabel": "Actions principales des toolboxes",
"collectionActionsLabel": "Actions de la collection",
"collectionEyebrow": "Collection locale",
"collectionTitle": "Mes toolboxes",
"management": {
"eyebrow": "Gestion locale",
"title": "Données et préférences",
"description": "Gérez les sauvegardes, les transferts et l’affichage des alertes de vos toolboxes.",
"dataTitle": "Transferts de la collection",
"dataDescription": "Exportez ou importez toute votre collection dans un fichier.",
"storageDetailsTitle": "Comprendre le stockage local",
"close": "Fermer"
},
"addToolDescriptions": {
"notepad": "Rédiger des notes sur plusieurs pages.",
"memos": "Garder de courts rappels sous les yeux.",
@ -1887,6 +1903,7 @@
"autoBackup": {
"eyebrow": "Sauvegarde locale",
"title": "Sauvegarde automatique",
"sidebarLabel": "Sauvegarde auto",
"description": "La sauvegarde automatique suit les modifications confirmées de vos toolboxes et crée des fichiers JSON dans le dossier choisi. Ces fichiers restent sur votre appareil et ne sont envoyés à aucun serveur. Cette fonctionnalité n’est pas disponible dans tous les navigateurs.",
"compatibleLabel": "Navigateurs compatibles",
"browsers": [
@ -1919,7 +1936,7 @@
"unsupported": "Cette sauvegarde locale n’est pas disponible dans ce navigateur.",
"close": "Fermer"
},
"summary": "Créez des espaces modulaires pour regrouper vos outils de session : notes, suivis, références, captures et futurs outils restent accessibles rapidement, en local, par jeu ou par usage.",
"summary": "Créez et retrouvez vos espaces modulaires.",
"creationTemplate": {
"memos": {
"title": "Mémos",
@ -1969,11 +1986,11 @@
"text": "Chaque outil ajouté peut être retiré de la toolbox avec sa corbeille."
},
{
"target": "exportAll",
"target": "backup",
"placement": "right",
"icon": "export",
"icon": "save",
"title": "Sauvegarder régulièrement",
"text": "Pensez à exporter vos toolboxes avant un nettoyage du navigateur, un changement de machine ou une réinstallation."
"text": "Configurez la sauvegarde locale pour conserver régulièrement une copie de vos toolboxes sur votre appareil."
}
]
},

View file

@ -1,12 +1,25 @@
// Rôle : encapsule l'input fichier JSON derrière un bouton d'import réutilisable.
import { useRef } from "react";
import { Icon } from "./Icon.jsx";
import { Tooltip } from "./Tooltip.jsx";
export function ImportButton({ className, label, title, ariaLabel, icon, onFile, tooltip = "", tooltipPosition = "top", ...props }) {
export function ImportButton({ className, label, title, ariaLabel, icon, onFile, onKeyDown, tabIndex = 0, tooltip = "", tooltipPosition = "top", ...props }) {
const inputRef = useRef(null);
const buttonProps = {
...props,
role: "button",
tabIndex,
onKeyDown: (event) => {
onKeyDown?.(event);
if (event.defaultPrevented || (event.key !== "Enter" && event.key !== " ")) return;
event.preventDefault();
inputRef.current?.click();
}
};
const children = <>
{icon && <Icon name={icon} />}
{label}
<input type="file" accept="application/json" hidden onChange={async (event) => {
<input ref={inputRef} type="file" accept="application/json" hidden onChange={async (event) => {
const file = event.target.files?.[0];
if (file) await onFile(file);
event.target.value = "";
@ -14,7 +27,7 @@ export function ImportButton({ className, label, title, ariaLabel, icon, onFile,
</>;
if (tooltip) {
return <Tooltip as="label" className={className} content={tooltip} position={tooltipPosition} aria-label={ariaLabel} {...props}>{children}</Tooltip>;
return <Tooltip as="label" className={className} content={tooltip} position={tooltipPosition} aria-label={ariaLabel} {...buttonProps}>{children}</Tooltip>;
}
return <label className={className} aria-label={ariaLabel} title={title} {...props}>{children}</label>;
return <label className={className} aria-label={ariaLabel} title={title} {...buttonProps}>{children}</label>;
}

View file

@ -8,6 +8,7 @@ const FOCUSABLE_SELECTOR = [
"button:not([disabled])",
"input:not([disabled]):not([type='hidden'])",
"select:not([disabled])",
"summary",
"textarea:not([disabled])",
"[tabindex]:not([tabindex='-1'])",
"[contenteditable='true']"

View file

@ -4,7 +4,7 @@ import { Icon } from "./Icon.jsx";
import { ImportButton } from "./ImportButton.jsx";
import { Tooltip } from "./Tooltip.jsx";
export function Shell({ route, content, games, drawerGameId = "", drawerVisible = false, compactGameLayout = false, reducedSidebar = false, actions, children }) {
export function Shell({ route, content, games, drawerGameId = "", drawerVisible = false, compactGameLayout = false, reducedSidebar = false, actions, onOpenAutoBackup, children }) {
const gameId = route.split("/")[1] === "games" ? route.split("/")[2] || "" : "";
const game = games.find((item) => item.id === gameId);
const topbarLabel = route === "/design-system" && import.meta.env.DEV ? "Design system" : route.startsWith("/toolbox") ? content.topbar.toolbox : route.startsWith("/games") ? content.topbar.games : route === "/library" ? content.topbar.library : content.topbar.dashboard;
@ -67,8 +67,8 @@ export function Shell({ route, content, games, drawerGameId = "", drawerVisible
<span className="badge">{content.sidebar.badge}</span>
<p>{content.sidebar.note}</p>
<div className="sidebar-storage-actions" aria-label="Actions globales de stockage">
<Tooltip as="button" className="sidebar-action-button nds-icon-button" content={compactSidebar ? "Exporter toutes les toolboxes" : ""} position="right" data-size="sm" data-variant="primary" onClick={actions.exportAllToolboxes} aria-label="Exporter toutes les toolboxes" data-toolbox-tutorial-target="exportAll" title={compactSidebar ? undefined : "Exporter tout"}><Icon name="export" /></Tooltip>
<ImportButton className="sidebar-action-button nds-icon-button import-icon-button" data-size="sm" title={compactSidebar ? undefined : "Importer tout"} ariaLabel="Importer toutes les toolboxes" tooltip={compactSidebar ? "Importer toutes les toolboxes" : ""} tooltipPosition="right" onFile={actions.importAllToolboxes} icon="import" />
<Tooltip as="button" className="sidebar-action-button sidebar-backup-button nds-button" content={compactSidebar ? content.toolboxes.autoBackup.title : ""} position="right" data-size="sm" data-variant="primary" type="button" onClick={onOpenAutoBackup} aria-label={content.toolboxes.autoBackup.title} title={compactSidebar ? undefined : content.toolboxes.autoBackup.title} data-toolbox-tutorial-target="backup">{compactSidebar && <Icon name="save" />}<span className="sidebar-storage-action-label">{content.toolboxes.autoBackup.sidebarLabel}</span></Tooltip>
<ImportButton className="sidebar-action-button nds-icon-button import-icon-button" data-size="sm" ariaLabel="Importer toutes les toolboxes" tooltip="Importer toutes les toolboxes" tooltipPosition="right" onFile={actions.importAllToolboxes} icon="import" />
</div>
</div>
</aside>

View file

@ -1,7 +1,7 @@
// Rôle : expose le choix gauche/droite des notifications via un Radio Button Group NDS.
import { Icon } from "./Icon.jsx";
export function ToastPositionSwitch({ position, labels, onChange }) {
export function ToastPositionSwitch({ position, labels, onChange, initialFocus = false }) {
const normalizedPosition = position === "left" ? "left" : "right";
return (
<div
@ -18,6 +18,7 @@ export function ToastPositionSwitch({ position, labels, onChange }) {
aria-checked={normalizedPosition === "left"}
aria-label={labels.left}
title={labels.left}
data-modal-initial-focus={initialFocus && normalizedPosition === "left" ? "" : undefined}
onClick={() => onChange("left")}
>
<Icon name="toast-left" />
@ -29,6 +30,7 @@ export function ToastPositionSwitch({ position, labels, onChange }) {
aria-checked={normalizedPosition === "right"}
aria-label={labels.right}
title={labels.right}
data-modal-initial-focus={initialFocus && normalizedPosition === "right" ? "" : undefined}
onClick={() => onChange("right")}
>
<Icon name="toast-right" />

View file

@ -2,7 +2,9 @@
import { useEffect, useId, useState } from "react";
import { flushSync } from "react-dom";
import { Icon } from "./Icon.jsx";
import { ImportButton } from "./ImportButton.jsx";
import { Modal } from "./Modal.jsx";
import { ToastPositionSwitch } from "./ToastPositionSwitch.jsx";
export function ConfirmModal({ title, message, confirmLabel = "Confirmer", cancelLabel = "Annuler", danger = false, onClose }) {
const titleId = useId();
@ -72,6 +74,66 @@ export function LinkToolboxModal({ toolboxes, selectedId, onClose }) {
);
}
export function ToolboxManagementModal({ content, toastPosition, setToastPosition, actions, onClose }) {
const titleId = useId();
const descriptionId = useId();
return (
<Modal
rootClassName="confirm-modal-root toolbox-management-modal-root"
dialogClassName="confirm-modal nds-modal toolbox-management-modal themed-scrollbar"
labelledBy={titleId}
describedBy={descriptionId}
onRequestClose={onClose}
>
<header className="toolbox-management-header">
<div>
<p className="eyebrow">{content.management.eyebrow}</p>
<h2 id={titleId}>{content.management.title}</h2>
</div>
<button className="nds-icon-button" data-size="sm" type="button" onClick={onClose} aria-label={content.management.close} title={content.management.close}><Icon name="close" /></button>
</header>
<p id={descriptionId} className="toolbox-management-description">{content.management.description}</p>
<section className="toolbox-management-section toolbox-management-preferences" aria-labelledby="toolbox-management-preferences-title">
<div>
<p className="eyebrow">{content.preferencesLabel}</p>
<h3 id="toolbox-management-preferences-title">{content.toastPositionLabel}</h3>
</div>
<ToastPositionSwitch
position={toastPosition}
onChange={setToastPosition}
initialFocus
labels={{
title: content.toastPositionLabel,
left: content.toastPositionLeft,
right: content.toastPositionRight
}}
/>
</section>
<section className="toolbox-management-section" aria-labelledby="toolbox-management-data-title">
<div>
<h3 id="toolbox-management-data-title">{content.management.dataTitle}</h3>
<p>{content.management.dataDescription}</p>
</div>
<div className="toolbox-management-actions nds-toolbar">
<button className="nds-button" data-size="sm" type="button" onClick={actions.exportAllToolboxes}><Icon name="export" />{content.exportAll}</button>
<ImportButton className="nds-button" data-size="sm" label={content.importAll} icon="import" onFile={actions.importAllToolboxes} />
</div>
</section>
<details className="toolbox-storage-details">
<summary>{content.management.storageDetailsTitle}</summary>
<div className="toolbox-storage-details-content">
<p>{content.storageHelp.text}</p>
<ul>{content.storageHelp.items.map((item) => <li key={item}>{item}</li>)}</ul>
</div>
</details>
<footer className="nds-modal-footer toolbox-management-footer">
<button className="nds-button" data-size="sm" type="button" onClick={onClose}>{content.management.close}</button>
</footer>
</Modal>
);
}
export function AutoBackupModal({ backup, content, onClose }) {
const folderName = backup.config.directoryHandle?.name || content.noFolder;
const lastBackup = backup.config.lastBackup
@ -88,24 +150,17 @@ export function AutoBackupModal({ backup, content, onClose }) {
<button className="nds-icon-button" data-size="sm" type="button" disabled={backup.busy} onClick={onClose} aria-label={content.close} title={content.close}><Icon name="close" /></button>
</header>
<p className="auto-backup-description">{content.description}</p>
<div className="auto-backup-compatibility">
<strong>{content.compatibleLabel}</strong>
<ul>{content.browsers.map((browser) => <li key={browser}>{browser}</li>)}</ul>
</div>
<div className="auto-backup-permission-guide">
<strong>{content.permissionTitle}</strong>
<p>{content.permissionDescription}</p>
<ol>{content.permissionSteps.map((step) => <li key={step}>{step}</li>)}</ol>
</div>
{!backup.supported ? <p className="nds-inline-notice" data-variant="warning" role="status">{content.unsupported}</p> : (
<>
<div className="auto-backup-folder">
<div><span className="eyebrow">{content.folderLabel}</span><strong>{folderName}</strong></div>
<button className="nds-button" data-size="sm" type="button" disabled={backup.busy} onClick={() => void backup.chooseDirectory()}>{backup.config.directoryHandle ? content.changeFolder : content.chooseFolder}</button>
</div>
<div className="auto-backup-last">
<span className="eyebrow">{content.lastBackup}</span>
<strong>{lastBackup}</strong>
<section className="auto-backup-settings" aria-label={content.title}>
<div className="auto-backup-status-grid">
<div className="auto-backup-folder">
<div><span className="eyebrow">{content.folderLabel}</span><strong>{folderName}</strong></div>
<button className="nds-button" data-size="sm" type="button" disabled={backup.busy} onClick={() => void backup.chooseDirectory()}>{backup.config.directoryHandle ? content.changeFolder : content.chooseFolder}</button>
</div>
<div className="auto-backup-last">
<span className="eyebrow">{content.lastBackup}</span>
<strong>{lastBackup}</strong>
</div>
</div>
<label className="auto-backup-toggle">
<input className="native-switch-input" type="checkbox" checked={backup.config.enabled} disabled={backup.busy} onChange={(event) => void backup.setEnabled(event.target.checked)} />
@ -118,8 +173,17 @@ export function AutoBackupModal({ backup, content, onClose }) {
{backup.config.directoryHandle && (backup.permission === "prompt" || backup.permission === "denied") && <button className="nds-button" data-size="sm" data-variant="primary" type="button" disabled={backup.busy} onClick={() => void backup.requestPermission()}>{content.reauthorize}</button>}
<button className="nds-button" data-size="sm" data-variant="primary" type="button" disabled={backup.busy || !backup.config.directoryHandle || backup.permission !== "granted"} onClick={() => void backup.saveNow()}>{content.saveNow}</button>
</footer>
</>
</section>
)}
<section className="auto-backup-compatibility" aria-labelledby="auto-backup-compatibility-title">
<strong id="auto-backup-compatibility-title">{content.compatibleLabel}</strong>
<ul>{content.browsers.map((browser) => <li key={browser}>{browser}</li>)}</ul>
</section>
<section className="auto-backup-permission-guide" aria-labelledby="auto-backup-permission-title">
<strong id="auto-backup-permission-title">{content.permissionTitle}</strong>
<p>{content.permissionDescription}</p>
<ol>{content.permissionSteps.map((step) => <li key={step}>{step}</li>)}</ol>
</section>
<footer className="nds-modal-footer auto-backup-close-footer">
<button className="nds-button" data-size="sm" type="button" disabled={backup.busy} onClick={onClose}>{content.close}</button>
</footer>

View file

@ -4,7 +4,7 @@ export function GamesPage({ siteContent, games, gamesError }) {
return (
<>
<section className="page-hero nds-page-hero">
<section className="page-hero nds-page-hero primary-list-hero">
<div>
<p className="eyebrow">{content.eyebrow}</p>
<h1>{content.title}</h1>

View file

@ -3,9 +3,9 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { GuidedTooltipTour } from "../../components/GuidedTooltipTour.jsx";
import { Icon } from "../../components/Icon.jsx";
import { ImportButton } from "../../components/ImportButton.jsx";
import { ToolboxManagementModal } from "../../components/ToolboxModals.jsx";
import { useGuideChecklist } from "../games/useGuideChecklist.js";
import { StorageQuota } from "../../components/StorageQuota.jsx";
import { ToastPositionSwitch } from "../../components/ToastPositionSwitch.jsx";
import { useGroupedReorder } from "../../hooks/useGroupedReorder.js";
import { useInlineEdit } from "../../hooks/useInlineEdit.js";
import { compressImage } from "../../utils/imageCompression.js";
@ -61,8 +61,9 @@ async function copyText(value) {
}
}
export function ToolboxesPage({ siteContent, toolboxes, getToolboxGame, actions, storageUsage, toastPosition, setToastPosition, onOpenAutoBackup }) {
export function ToolboxesPage({ siteContent, toolboxes, getToolboxGame, actions, storageUsage, toastPosition, setToastPosition }) {
const content = siteContent.toolboxes;
const [managementOpen, setManagementOpen] = useState(false);
const {
itemReorder,
getItemProps,
@ -88,76 +89,61 @@ export function ToolboxesPage({ siteContent, toolboxes, getToolboxGame, actions,
return (
<div className="toolbox-page">
<section className="page-hero nds-page-hero">
<section className="page-hero nds-page-hero primary-list-hero toolbox-list-hero">
<div>
<p className="eyebrow">{content.eyebrow}</p>
<h1>{content.title}</h1>
<p>{content.summary}</p>
<a className="hero-library-button library-link-button nds-button" data-size="sm" href="#/library"><Icon name="book" />{content.libraryLink}</a>
<div className="actions nds-toolbar toolbox-list-primary-actions" aria-label={content.primaryActionsLabel}>
<button className="nds-button" data-size="sm" data-variant="primary" aria-label={content.newButton} onClick={() => actions.setCreateModal({})}><Icon name="add" />{content.createShortButton}</button>
<ImportButton className="nds-button" data-size="sm" label={content.importOne} icon="import" onFile={actions.importToolbox} />
</div>
</div>
</section>
<section className="toolbar nds-toolbar toolbox-actions-row">
<div>
<button className="nds-button" data-size="sm" data-variant="primary" onClick={() => actions.setCreateModal({})}>{content.newButton}</button>
<ImportButton className="nds-button" data-size="sm" label={content.importOne} onFile={actions.importToolbox} />
</div>
<div>
<button className="nds-button" data-size="sm" data-variant="primary" type="button" onClick={onOpenAutoBackup}>{content.autoBackup.title}</button>
<button className="nds-button" data-size="sm" onClick={actions.exportAllToolboxes}>{content.exportAll}</button>
<ImportButton className="nds-button" data-size="sm" label={content.importAll} onFile={actions.importAllToolboxes} />
</div>
<section className="toolbox-list-actions nds-toolbar" aria-label={content.collectionActionsLabel}>
<button className="nds-button" data-size="sm" type="button" onClick={() => setManagementOpen(true)}><Icon name="settings" />{content.manageButton}</button>
<a className="library-link-button nds-button" data-size="sm" href="#/library" aria-label={content.libraryLink} title={content.libraryLink}><Icon name="book" /><span className="toolbox-list-action-label">{content.libraryLink}</span></a>
</section>
<section className="toolbox-preferences-row" aria-label={content.preferencesLabel}>
<div>
<p className="eyebrow">{content.preferencesLabel}</p>
<strong>{content.toastPositionLabel}</strong>
<section className="toolbox-collection" aria-labelledby="toolbox-collection-title">
<header className="toolbox-collection-heading">
<div>
<p className="eyebrow">{content.collectionEyebrow}</p>
<div className="toolbox-collection-title-row">
<h2 id="toolbox-collection-title">{content.collectionTitle}</h2>
<span className="nds-badge" data-variant="neutral">{toolboxes.length}</span>
</div>
</div>
</header>
<div className="cards">
{toolboxes.length ? toolboxes.map((toolbox) => (
<ToolboxCard
key={toolbox.id}
toolbox={toolbox}
game={getToolboxGame(toolbox)}
actions={actions}
reorder={{ itemReorder, getItemProps, isItemDragging, isItemDropTarget, getDropPlacement }}
/>
)) : (
<div className="empty nds-empty-state toolbox-list-empty">
<h2>{content.emptyTitle}</h2>
<p>{content.emptyText}</p>
<button className="nds-button" data-size="sm" data-variant="primary" type="button" onClick={() => actions.setCreateModal({})}>{content.emptyAction}</button>
</div>
)}
</div>
<ToastPositionSwitch
position={toastPosition}
onChange={setToastPosition}
labels={{
title: content.toastPositionLabel,
left: content.toastPositionLeft,
right: content.toastPositionRight
}}
/>
</section>
<section className="cards">
<StorageHelpCard help={content.storageHelp} />
{toolboxes.length ? toolboxes.map((toolbox) => (
<ToolboxCard
key={toolbox.id}
toolbox={toolbox}
game={getToolboxGame(toolbox)}
actions={actions}
reorder={{ itemReorder, getItemProps, isItemDragging, isItemDropTarget, getDropPlacement }}
/>
)) : (
<div className="empty nds-empty-state"><h2>{content.emptyTitle}</h2><p>{content.emptyText}</p></div>
)}
</section>
<StorageQuota usage={storageUsage} />
{managementOpen && <ToolboxManagementModal
content={content}
toastPosition={toastPosition}
setToastPosition={setToastPosition}
actions={actions}
onClose={() => setManagementOpen(false)}
/>}
</div>
);
}
function StorageHelpCard({ help }) {
return (
<article className="card nds-card storage-help-card" aria-labelledby="storage-help-title">
<div className="card-body nds-card-body">
<div className="storage-help-heading">
<span className="storage-help-mark" aria-hidden="true" />
<div><p className="eyebrow">IndexedDB</p><h2 id="storage-help-title">{help.title}</h2></div>
</div>
<p className="storage-help-intro">{help.text}</p>
<ul className="storage-help-list">
{help.items.map((item, index) => <li key={item}><span>{index + 1}</span><p>{item}</p></li>)}
</ul>
</div>
</article>
);
}
export function ToolboxPage(props) {
const { toolboxId, toolboxes, getToolboxGame } = props;
const toolbox = toolboxes.find((item) => item.id === toolboxId);

View file

@ -206,6 +206,7 @@ function App() {
compactGameLayout={compactGameLayout}
reducedSidebar={reducedSidebar}
actions={actions}
onOpenAutoBackup={() => setAutoBackupModalOpen(true)}
>
<div className="route-content-view" aria-hidden={compactGameLayout && drawerVisible || undefined} inert={compactGameLayout && drawerVisible || undefined}>
<AppErrorBoundary route={route}>
@ -229,7 +230,6 @@ function App() {
storageReady={store.ready}
toastPosition={store.toastPosition}
setToastPosition={store.setToastPosition}
onOpenAutoBackup={() => setAutoBackupModalOpen(true)}
getModuleData={store.getModuleData}
updateToolbox={actions.updateToolbox}
updateModuleData={store.updateModuleData}

View file

@ -105,6 +105,10 @@
flex-direction: column;
}
.toolbox-card .card-body h2 {
overflow-wrap: anywhere;
}
.toolbox-card .card-actions {
margin-top: auto;
padding-top: var(--space-5);
@ -157,119 +161,6 @@
gap: var(--space-4);
}
.storage-help-card {
position: relative;
min-height: 292px;
overflow: hidden;
border-color: rgba(246, 196, 83, 0.22);
background:
linear-gradient(135deg, rgba(246, 196, 83, 0.1), transparent 38%),
rgba(10, 13, 29, 0.84);
}
.storage-help-card::after {
content: "";
position: absolute;
inset: 0 auto 0 0;
width: 3px;
background: var(--gradient-brand);
}
.storage-help-card .card-body {
display: flex;
min-height: 100%;
flex-direction: column;
padding: 18px;
}
.storage-help-heading {
display: grid;
grid-template-columns: 36px minmax(0, 1fr);
gap: 10px;
align-items: center;
margin-bottom: 12px;
}
.storage-help-mark {
display: grid;
width: 36px;
height: 36px;
place-items: center;
border: 1px solid rgba(246, 196, 83, 0.32);
border-radius: var(--radius-md);
background: rgba(246, 196, 83, 0.1);
color: var(--color-accent-gold);
box-shadow: 0 0 22px rgba(246, 196, 83, 0.12);
}
.storage-help-mark::before {
content: "";
width: 19px;
height: 19px;
background: currentColor;
mask: url("/static/icons/save.svg") center / contain no-repeat;
-webkit-mask: url("/static/icons/save.svg") center / contain no-repeat;
}
.storage-help-card h2 {
margin: 0;
font-size: var(--font-size-lg);
line-height: 1.2;
}
.storage-help-card .eyebrow {
color: var(--color-accent-gold);
}
.storage-help-intro {
color: var(--color-text-secondary);
font-size: var(--font-size-xs);
line-height: 1.45;
}
.storage-help-card p,
.storage-help-card ul {
margin: 0;
}
.storage-help-list {
display: grid;
gap: 7px;
margin-top: 18px;
padding: 10px 0 0;
list-style: none;
}
.storage-help-list li {
display: grid;
grid-template-columns: 22px minmax(0, 1fr);
gap: 8px;
align-items: start;
padding: 8px 9px;
border: 1px solid rgba(150, 165, 205, 0.12);
border-radius: var(--radius-md);
background: rgba(7, 10, 24, 0.45);
}
.storage-help-list span {
display: grid;
width: 18px;
height: 18px;
place-items: center;
border-radius: var(--radius-sm);
background: rgba(139, 92, 246, 0.18);
color: var(--color-text-primary);
font-size: var(--font-size-xs);
font-weight: 800;
}
.storage-help-list p {
align-self: center;
color: var(--color-text-secondary);
font-size: var(--font-size-xs);
line-height: 1.32;
}
.storage-quota {
position: relative;
isolation: isolate;

View file

@ -4,3 +4,4 @@
@use "overlays/modals";
@use "overlays/notifications";
@use "overlays/tool-add";
@use "overlays/toolbox-management";

View file

@ -244,7 +244,8 @@
.hero,
.game-hero,
.page-hero {
.page-hero,
.page-hero.primary-list-hero {
min-height: auto;
padding: var(--space-6);
}
@ -412,21 +413,6 @@
justify-content: flex-end;
}
.toolbox-actions-row {
align-items: stretch;
flex-direction: column;
}
.toolbox-actions-row > div,
.toolbox-actions-row > div:last-child {
justify-content: flex-start;
}
.toolbox-preferences-row {
max-width: none;
justify-self: stretch;
}
}
@media (max-width: 767px) {

View file

@ -288,12 +288,23 @@
.sidebar-storage-actions {
display: flex;
width: max-content;
max-width: 100%;
gap: var(--space-2);
margin-top: var(--space-4);
margin: var(--space-4) auto 0;
}
.sidebar-action-button {
display: inline-flex;
white-space: nowrap;
}
.sidebar-storage-actions .sidebar-backup-button.nds-button {
padding-inline: var(--space-2);
}
.sidebar-storage-action-label {
color: inherit;
}
.sidebar[data-variant="compact"] {
@ -339,16 +350,22 @@
}
.sidebar[data-variant="compact"] .sidebar-storage-actions {
flex-direction: column;
width: auto;
align-items: center;
flex-direction: column;
gap: 6px;
margin-top: 0;
margin: 0 auto;
}
.sidebar[data-variant="compact"] .sidebar-action-button {
width: 36px;
height: 36px;
flex: 0 0 36px;
padding: 0;
}
.sidebar[data-variant="compact"] .sidebar-storage-action-label {
display: none;
}
.content-shell {

View file

@ -92,6 +92,10 @@
padding: var(--space-6);
}
.page-hero.primary-list-hero {
min-height: 195px;
}
.page-hero p:last-child {
max-width: 720px;
margin-bottom: 0;

View file

@ -59,8 +59,18 @@
line-height: 1.6;
}
.auto-backup-settings {
margin-top: var(--space-5);
}
.auto-backup-status-grid {
display: grid;
grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
gap: var(--space-4);
}
.auto-backup-compatibility {
margin-bottom: var(--space-5);
margin-top: var(--space-5);
padding: var(--space-4);
border: 1px solid rgba(165, 180, 252, 0.14);
border-radius: var(--radius-md);
@ -92,14 +102,8 @@
font-weight: 800;
}
.auto-backup-compatibility p {
margin: 0;
color: var(--color-text-muted);
font-size: var(--font-size-sm);
}
.auto-backup-permission-guide {
margin-bottom: var(--space-5);
margin-top: var(--space-5);
padding: var(--space-4);
border: 1px solid rgba(34, 211, 238, 0.2);
border-radius: var(--radius-md);
@ -132,7 +136,6 @@
align-items: stretch;
flex-direction: column;
gap: var(--space-4);
margin-top: var(--space-5);
}
.auto-backup-folder,
@ -156,7 +159,7 @@
}
.auto-backup-last {
margin-top: var(--space-6);
min-width: 0;
}
.auto-backup-last strong {
@ -259,8 +262,8 @@
}
@media (max-width: 600px) {
.auto-backup-folder {
gap: var(--space-3);
.auto-backup-status-grid {
grid-template-columns: 1fr;
}
.auto-backup-modal-footer {

View file

@ -0,0 +1,107 @@
// Rôle : stylise la fenêtre de gestion locale de la collection de toolboxes.
.toolbox-management-modal.nds-modal {
width: min(720px, calc(100vw - 32px));
max-height: min(760px, calc(100vh - 32px));
overflow-y: auto;
}
.toolbox-management-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: var(--space-4);
}
.toolbox-management-header h2,
.toolbox-management-header .eyebrow {
margin-bottom: 0;
}
.toolbox-management-description {
color: var(--color-text-secondary);
line-height: 1.55;
}
.toolbox-management-section {
display: grid;
gap: var(--space-4);
margin-top: var(--space-4);
padding: var(--space-4);
border: 1px solid rgba(165, 180, 252, 0.14);
border-radius: var(--radius-md);
background: rgba(5, 7, 17, 0.32);
}
.toolbox-management-section h3 {
margin: 0;
font-size: var(--font-size-base);
}
.toolbox-management-section p {
margin: var(--space-2) 0 0;
color: var(--color-text-muted);
font-size: var(--font-size-sm);
line-height: 1.45;
}
.toolbox-management-actions {
flex-wrap: wrap;
justify-content: flex-start;
}
.toolbox-management-preferences {
grid-template-columns: minmax(0, 1fr) auto;
align-items: center;
}
.toolbox-management-preferences .eyebrow {
margin: 0 0 4px;
}
.toolbox-storage-details {
margin-top: var(--space-4);
border: 1px solid rgba(165, 180, 252, 0.14);
border-radius: var(--radius-md);
background: rgba(16, 20, 38, 0.42);
}
.toolbox-storage-details summary {
padding: var(--space-4);
color: var(--color-text-primary);
font-size: var(--font-size-sm);
font-weight: 800;
cursor: pointer;
}
.toolbox-storage-details summary:focus-visible {
outline: 2px solid var(--color-accent-gold);
outline-offset: -2px;
}
.toolbox-storage-details-content {
padding: 0 var(--space-4) var(--space-4);
color: var(--color-text-secondary);
font-size: var(--font-size-sm);
line-height: 1.5;
}
.toolbox-storage-details-content > p {
margin: 0;
}
.toolbox-storage-details-content ul {
display: grid;
gap: var(--space-2);
margin: var(--space-3) 0 0;
padding-left: 20px;
}
.toolbox-management-footer {
margin-top: var(--space-5);
}
@media (max-width: 600px) {
.toolbox-management-preferences {
grid-template-columns: 1fr;
}
}

View file

@ -1,78 +1,91 @@
// Rôle : regroupe les préférences toolbox, colonnes et contrôles de layout.
@use "../../mixins";
// Rôle : structure l’en-tête, la collection et les préférences de la page toolboxes.
.modules-toolbar {
display: flex;
justify-content: flex-end;
margin-top: var(--space-4);
}
.toolbox-actions-row {
display: flex;
width: 100%;
align-items: center;
justify-content: space-between;
gap: var(--space-4);
.toolbox-list-hero .eyebrow,
.toolbox-collection-heading .eyebrow {
margin-bottom: 4px;
}
.toolbox-actions-row > div {
display: flex;
flex-wrap: wrap;
gap: 10px;
.toolbox-list-primary-actions {
justify-content: flex-start;
}
.toolbox-actions-row > div:last-child {
.toolbox-list-actions {
justify-content: flex-end;
}
.toolbox-preferences-row {
position: relative;
isolation: isolate;
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
width: 100%;
max-width: 520px;
.toolbox-list-hero > div > p:last-of-type {
max-width: 720px;
}
.toolbox-collection {
min-width: 0;
}
.toolbox-collection-heading {
display: flex;
align-items: center;
justify-self: end;
justify-content: flex-start;
gap: var(--space-4);
margin-top: var(--space-4);
padding: var(--space-4);
overflow: hidden;
border: 1px solid transparent;
border-radius: var(--radius-lg);
background:
radial-gradient(circle at 100% 0%, rgba(246, 196, 83, 0.08), transparent 34%),
linear-gradient(135deg, rgba(16, 20, 38, 0.84), rgba(5, 7, 17, 0.76));
color: var(--color-text-muted);
font-size: var(--font-size-sm);
font-weight: 800;
box-shadow: var(--shadow-sm);
}
.toolbox-preferences-row::before {
content: "";
position: absolute;
inset: 0;
z-index: -1;
padding: 1px;
border-radius: inherit;
background:
radial-gradient(circle at 100% 0%, rgba(246, 196, 83, 0.38), transparent 30%),
linear-gradient(135deg, rgba(246, 196, 83, 0.26), rgba(139, 92, 246, 0.16), rgba(56, 189, 248, 0.18));
@include mixins.border-mask;
.toolbox-collection-title-row {
display: flex;
align-items: center;
gap: var(--space-2);
}
.toolbox-preferences-row .eyebrow {
margin-bottom: 4px;
font-size: 0.68rem;
.toolbox-collection-heading h2 {
margin: 0;
font-size: var(--font-size-xl);
}
.toolbox-preferences-row strong {
display: block;
color: var(--color-text-primary);
font-size: var(--font-size-sm);
.toolbox-collection-title-row .nds-badge {
flex: 0 0 auto;
}
.toolbox-preferences-row + .cards {
margin-top: 0;
.toolbox-collection > .cards {
margin-top: var(--space-3);
}
.toolbox-list-empty {
grid-column: 1 / -1;
align-items: flex-start;
text-align: left;
}
.toolbox-list-empty .nds-button {
width: fit-content;
}
@media (max-width: 1024px) {
.toolbox-list-actions {
justify-content: flex-end;
}
.toolbox-list-action-label {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip: rect(0 0 0 0);
clip-path: inset(50%);
white-space: nowrap;
}
}
@media (max-width: 767px) {
.toolbox-list-primary-actions,
.toolbox-list-actions {
justify-content: flex-start;
}
.toolbox-list-primary-actions > *,
.toolbox-list-actions > * {
max-width: 100%;
}
}