Refine toolbox navigation and local data controls
All checks were successful
Deploy Sokko G / deploy (push) Successful in 20s
All checks were successful
Deploy Sokko G / deploy (push) Successful in 20s
This commit is contained in:
parent
954240adf9
commit
2f2e79d200
27 changed files with 614 additions and 302 deletions
|
|
@ -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."
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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']"
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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" />
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -4,3 +4,4 @@
|
|||
@use "overlays/modals";
|
||||
@use "overlays/notifications";
|
||||
@use "overlays/tool-add";
|
||||
@use "overlays/toolbox-management";
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
107
website/src/styles/overlays/_toolbox-management.scss
Normal file
107
website/src/styles/overlays/_toolbox-management.scss
Normal 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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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%;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue