keepsafe rework & alert ajustments
All checks were successful
Deploy Sokko G / deploy (push) Successful in 7s

This commit is contained in:
Shinuwa 2026-07-26 17:48:14 +02:00
parent 68005ef918
commit 2e6d8a2c0c
11 changed files with 129 additions and 45 deletions

View file

@ -18,8 +18,8 @@ export function AppOverlays({
setStorageError,
image,
setImage,
notification,
setNotification,
notifications,
dismissNotification,
toastPosition,
getGame,
toolboxes,
@ -49,7 +49,18 @@ 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} position={toastPosition} onClose={() => setNotification(null)} />}
{notifications.length > 0 && (
<div className={`notification-toast-stack is-${toastPosition === "left" ? "left" : "right"}`} aria-live="polite" aria-relevant="additions">
{notifications.map((notification) => (
<NotificationToast
key={notification.id}
id={notification.id}
message={notification.message}
onClose={dismissNotification}
/>
))}
</div>
)}
</>
);
}

View file

@ -24,11 +24,16 @@ export function ConfirmModal({ title, message, confirmLabel = "Confirmer", cance
);
}
export function NotificationToast({ message, position = "right", onClose }) {
export function NotificationToast({ id, message, onClose }) {
useEffect(() => {
const timeoutId = window.setTimeout(() => onClose(id), 120000);
return () => window.clearTimeout(timeoutId);
}, [id, onClose]);
return (
<div className={`notification-toast is-${position === "left" ? "left" : "right"}`} role="status" aria-live="polite">
<div className="notification-toast" role="status">
<span>{message}</span>
<button type="button" onClick={onClose} aria-label="Fermer l'alerte" title="Fermer">
<button type="button" onClick={() => onClose(id)} aria-label="Fermer l'alerte" title="Fermer">
<Icon name="close" />
</button>
</div>