new tool timer & alert revamp
All checks were successful
Deploy Sokko G / deploy (push) Successful in 6s
All checks were successful
Deploy Sokko G / deploy (push) Successful in 6s
This commit is contained in:
parent
0c7ae46b4d
commit
68005ef918
38 changed files with 2048 additions and 111 deletions
|
|
@ -19,6 +19,8 @@ export function AppOverlays({
|
|||
image,
|
||||
setImage,
|
||||
notification,
|
||||
setNotification,
|
||||
toastPosition,
|
||||
getGame,
|
||||
toolboxes,
|
||||
links
|
||||
|
|
@ -47,7 +49,7 @@ export function AppOverlays({
|
|||
}} />}
|
||||
{storageError && <ConfirmModal title="Quota local atteint" message={storageError} confirmLabel="Compris" cancelLabel="Fermer" danger onClose={() => setStorageError("")} />}
|
||||
{image && <ImageViewer image={image} onClose={() => setImage(null)} createMarkerId={() => uid("marker")} />}
|
||||
{notification && <NotificationToast key={notification.id} message={notification.message} />}
|
||||
{notification && <NotificationToast key={notification.id} message={notification.message} position={toastPosition} onClose={() => setNotification(null)} />}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ export function ImageViewer({ image, onClose, createMarkerId = () => globalThis.
|
|||
onChange={(event) => updateViewerMarker(marker.id, (item) => ({ ...item, label: event.target.value }))}
|
||||
aria-label={`Libellé du marqueur ${index + 1}`}
|
||||
/>
|
||||
<button className="calculator-action-button danger" type="button" onClick={() => removeViewerMarker(marker.id)} aria-label={`${image.deleteMarkerTitle || "Supprimer"} ${marker.label || `${image.markerPrefix || "Marqueur"} ${index + 1}`}`} title={image.deleteMarkerTitle || "Supprimer"}>
|
||||
<button className="tool-split-action-button danger" type="button" onClick={() => removeViewerMarker(marker.id)} aria-label={`${image.deleteMarkerTitle || "Supprimer"} ${marker.label || `${image.markerPrefix || "Marqueur"} ${index + 1}`}`} title={image.deleteMarkerTitle || "Supprimer"}>
|
||||
<Icon name="trash" />
|
||||
</button>
|
||||
</li>
|
||||
|
|
|
|||
25
website/src/components/Tabs.jsx
Normal file
25
website/src/components/Tabs.jsx
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
// Rôle : fournit un contrôle d'onglets réutilisable avec rôles ARIA.
|
||||
export function Tabs({ tabs, activeTab, onChange, className = "", iconOnly = false }) {
|
||||
return (
|
||||
<div className={`tabs ${className}`.trim()} role="tablist">
|
||||
{tabs.map((tab) => {
|
||||
const active = tab.id === activeTab;
|
||||
return (
|
||||
<button
|
||||
key={tab.id}
|
||||
className={active ? "active" : ""}
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={active}
|
||||
aria-label={tab.label}
|
||||
title={tab.label}
|
||||
onClick={() => onChange(tab.id)}
|
||||
>
|
||||
{tab.icon && <span className={`module-icon-svg module-icon-${tab.icon}`} aria-hidden="true" />}
|
||||
{!iconOnly && <span>{tab.label}</span>}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
20
website/src/components/ToastPositionSwitch.jsx
Normal file
20
website/src/components/ToastPositionSwitch.jsx
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// Rôle : affiche le switch global de position des notifications internes.
|
||||
import React from "react";
|
||||
import { Icon } from "./Icon.jsx";
|
||||
|
||||
export function ToastPositionSwitch({ position, labels, onChange }) {
|
||||
const normalizedPosition = position === "left" ? "left" : "right";
|
||||
return (
|
||||
<button
|
||||
className="toast-position-switch"
|
||||
type="button"
|
||||
data-position={normalizedPosition}
|
||||
onClick={() => onChange(normalizedPosition === "left" ? "right" : "left")}
|
||||
aria-label={normalizedPosition === "left" ? labels.left : labels.right}
|
||||
title={labels.title}
|
||||
>
|
||||
<span><Icon name="toast-left" /></span>
|
||||
<span><Icon name="toast-right" /></span>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
// Rôle : fournit les modales globales liées aux toolboxes et confirmations.
|
||||
import { useEffect, useState } from "react";
|
||||
import { Icon } from "./Icon.jsx";
|
||||
import { lockBodyScroll } from "../utils/bodyScrollLock.js";
|
||||
|
||||
function useModalScrollLock() {
|
||||
|
|
@ -23,10 +24,13 @@ export function ConfirmModal({ title, message, confirmLabel = "Confirmer", cance
|
|||
);
|
||||
}
|
||||
|
||||
export function NotificationToast({ message }) {
|
||||
export function NotificationToast({ message, position = "right", onClose }) {
|
||||
return (
|
||||
<div className="notification-toast" role="status" aria-live="polite">
|
||||
{message}
|
||||
<div className={`notification-toast is-${position === "left" ? "left" : "right"}`} role="status" aria-live="polite">
|
||||
<span>{message}</span>
|
||||
<button type="button" onClick={onClose} aria-label="Fermer l'alerte" title="Fermer">
|
||||
<Icon name="close" />
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue