// RĂ´le : regroupe les modales, notifications et viewers rendus au-dessus de l'application. import { Icon } from "./Icon.jsx"; import { ImageViewer } from "./ImageViewer.jsx"; import { AutoBackupModal, ConfirmModal, CreateToolboxModal, LinkToolboxModal, NotificationToast } from "./ToolboxModals.jsx"; import { navigate } from "../router/hashRouter.js"; import { uid } from "../features/toolboxes/storage/toolboxStorage.js"; function scrollToTopAfterNavigation() { window.requestAnimationFrame(() => { window.requestAnimationFrame(() => window.scrollTo({ top: 0, left: 0, behavior: "auto" })); }); } export function InlineNotice({ className = "", iconName = "link", message, tone = "warning" }) { if (!message) return null; const classes = ["inline-notice", "nds-inline-notice", `is-${tone}`, className].filter(Boolean).join(" "); return ( {message} ); } export function AppOverlays({ actions, confirmModal, setConfirmModal, createModal, setCreateModal, linkModalGameId, setLinkModalGameId, setDrawerGameId, storageError, storageErrorTitle, setStorageError, image, setImage, notifications, dismissNotification, toastPosition, getGame, toolboxes, links, setPendingTutorialToolboxId, autoBackupModalOpen, setAutoBackupModalOpen, autoBackup, autoBackupContent }) { return ( <> {confirmModal && { const onResolve = confirmModal.onResolve; setConfirmModal(null); onResolve?.(value); }} />} {createModal && { const gameId = createModal.gameId || ""; setCreateModal(null); if (!name) return; const toolbox = actions.createToolbox(name, gameId, { tutorial: createModal.tutorial === true }); if (toolbox && createModal.tutorial === true) setPendingTutorialToolboxId?.(toolbox.id); if (toolbox && gameId) setDrawerGameId(gameId); else if (toolbox) { navigate(`/toolbox/${toolbox.id}`); scrollToTopAfterNavigation(); } }} />} {linkModalGameId && { const gameId = linkModalGameId; setLinkModalGameId(""); if (toolboxId == null) return; actions.linkToolboxToGame(gameId, toolboxId); setDrawerGameId(gameId); }} />} {autoBackupModalOpen && setAutoBackupModalOpen(false)} />} {storageError && setStorageError("")} />} {image && setImage(null)} createMarkerId={() => uid("marker")} />} {notifications.length > 0 && (
{notifications.map((notification) => ( ))}
)} ); }