Clarify local persistence and backup states
This commit is contained in:
parent
2f2e79d200
commit
1171eee510
24 changed files with 678 additions and 269 deletions
|
|
@ -74,7 +74,7 @@ export function AppOverlays({
|
|||
actions.linkToolboxToGame(gameId, toolboxId);
|
||||
setDrawerGameId(gameId);
|
||||
}} />}
|
||||
{autoBackupModalOpen && <AutoBackupModal backup={autoBackup} content={autoBackupContent} onClose={() => setAutoBackupModalOpen(false)} />}
|
||||
{autoBackupModalOpen && <AutoBackupModal backup={autoBackup} content={autoBackupContent} onExport={actions.exportAllToolboxes} onClose={() => setAutoBackupModalOpen(false)} />}
|
||||
{storageError && <ConfirmModal title={storageErrorTitle} message={storageError} confirmLabel="Compris" cancelLabel="Fermer" danger onClose={() => setStorageError("")} />}
|
||||
{image && <ImageViewer image={image} onClose={() => setImage(null)} createMarkerId={() => uid("marker")} />}
|
||||
{notifications.length > 0 && (
|
||||
|
|
|
|||
|
|
@ -134,11 +134,31 @@ export function ToolboxManagementModal({ content, toastPosition, setToastPositio
|
|||
);
|
||||
}
|
||||
|
||||
export function AutoBackupModal({ backup, content, onClose }) {
|
||||
export function AutoBackupModal({ backup, content, onClose, onExport }) {
|
||||
const folderName = backup.config.directoryHandle?.name || content.noFolder;
|
||||
const lastBackup = backup.config.lastBackup
|
||||
? new Date(backup.config.lastBackup).toLocaleString()
|
||||
: content.never;
|
||||
const persistencePhase = backup.persistenceStatus?.phase || "confirmed";
|
||||
const persistenceLabel = {
|
||||
pending: content.persistencePending,
|
||||
error: content.persistenceError,
|
||||
conflict: content.persistenceConflict
|
||||
}[persistencePhase];
|
||||
const fileStatus = backup.lastRunStatus === "running"
|
||||
? content.fileStatusRunning
|
||||
: backup.lastRunStatus === "error"
|
||||
? content.fileStatusError
|
||||
: backup.config.hasUnsavedChanges
|
||||
? content.fileStatusDirty
|
||||
: backup.config.lastBackup
|
||||
? content.fileStatusCurrent
|
||||
: content.fileStatusNone;
|
||||
const fileStatusTone = backup.lastRunStatus === "error"
|
||||
? "error"
|
||||
: backup.lastRunStatus === "running" || backup.config.hasUnsavedChanges
|
||||
? "pending"
|
||||
: "confirmed";
|
||||
|
||||
return (
|
||||
<Modal rootClassName="confirm-modal-root auto-backup-modal-root" dialogClassName="confirm-modal nds-modal auto-backup-modal themed-scrollbar" labelledBy="auto-backup-title" onRequestClose={onClose} canClose={!backup.busy}>
|
||||
|
|
@ -150,7 +170,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>
|
||||
{!backup.supported ? <p className="nds-inline-notice" data-variant="warning" role="status">{content.unsupported}</p> : (
|
||||
{persistenceLabel && <p
|
||||
className="nds-inline-notice auto-backup-persistence-status"
|
||||
data-variant={persistencePhase === "pending" ? "warning" : "danger"}
|
||||
role={persistencePhase === "pending" ? "status" : "alert"}
|
||||
>{persistenceLabel}</p>}
|
||||
{!backup.supported ? <>
|
||||
<p className="nds-inline-notice" data-variant="warning" role="status">{content.unsupported}</p>
|
||||
<footer className="nds-modal-footer auto-backup-modal-footer">
|
||||
<button className="nds-button" data-size="sm" type="button" onClick={onExport}><Icon name="export" />{content.manualExport}</button>
|
||||
</footer>
|
||||
</> : (
|
||||
<section className="auto-backup-settings" aria-label={content.title}>
|
||||
<div className="auto-backup-status-grid">
|
||||
<div className="auto-backup-folder">
|
||||
|
|
@ -160,6 +190,7 @@ export function AutoBackupModal({ backup, content, onClose }) {
|
|||
<div className="auto-backup-last">
|
||||
<span className="eyebrow">{content.lastBackup}</span>
|
||||
<strong>{lastBackup}</strong>
|
||||
<span className="auto-backup-file-status" data-state={fileStatusTone}>{fileStatus}</span>
|
||||
</div>
|
||||
</div>
|
||||
<label className="auto-backup-toggle">
|
||||
|
|
@ -170,6 +201,7 @@ export function AutoBackupModal({ backup, content, onClose }) {
|
|||
{backup.config.directoryHandle && (backup.permission === "prompt" || backup.permission === "denied") && <p className="nds-inline-notice" data-variant="warning" role="status">{content.permissionRequired}</p>}
|
||||
{backup.error && <p className="nds-inline-notice" data-variant="danger" role="alert">{backup.error}</p>}
|
||||
<footer className="nds-modal-footer auto-backup-modal-footer">
|
||||
<button className="nds-button" data-size="sm" type="button" disabled={backup.busy} onClick={onExport}><Icon name="export" />{content.manualExport}</button>
|
||||
{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>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,15 @@
|
|||
// Rôle : sérialise les écritures et reconstruit l'état optimiste depuis les succès confirmés.
|
||||
export function createPersistenceQueue(initialState, onChange) {
|
||||
// Rôle : sérialise les écritures, publie leur état et reconstruit l'optimiste depuis les succès confirmés.
|
||||
export function createPersistenceQueue(initialState, onChange, onStatusChange = () => {}) {
|
||||
let confirmed = initialState;
|
||||
let current = initialState;
|
||||
let running = false;
|
||||
const pending = [];
|
||||
let status = { phase: "loading", pendingCount: 0, lastConfirmedAt: "", message: "" };
|
||||
|
||||
function publishStatus(update) {
|
||||
status = { ...status, ...update };
|
||||
onStatusChange(status);
|
||||
}
|
||||
|
||||
function publish() {
|
||||
current = pending.reduce((state, operation) => operation.apply(state), confirmed);
|
||||
|
|
@ -28,6 +34,23 @@ export function createPersistenceQueue(initialState, onChange) {
|
|||
}
|
||||
pending.shift();
|
||||
publish();
|
||||
if (operation.trackStatus) {
|
||||
const pendingCount = Math.max(0, status.pendingCount - 1);
|
||||
if (success) {
|
||||
publishStatus({
|
||||
phase: pendingCount ? "pending" : "confirmed",
|
||||
pendingCount,
|
||||
lastConfirmedAt: new Date().toISOString(),
|
||||
message: ""
|
||||
});
|
||||
} else {
|
||||
publishStatus({
|
||||
phase: failure?.name === "StorageConflictError" ? "conflict" : "error",
|
||||
pendingCount,
|
||||
message: failure?.message || "Erreur de stockage IndexedDB."
|
||||
});
|
||||
}
|
||||
}
|
||||
operation.resolve(success);
|
||||
if (!success) operation.onError?.(failure);
|
||||
}
|
||||
|
|
@ -36,13 +59,18 @@ export function createPersistenceQueue(initialState, onChange) {
|
|||
|
||||
return {
|
||||
getCurrent: () => current,
|
||||
getStatus: () => status,
|
||||
initialize(state) {
|
||||
if (running || pending.length) throw new Error("Cannot initialize while writes are pending");
|
||||
confirmed = state;
|
||||
publish();
|
||||
publishStatus({ phase: "confirmed", pendingCount: 0, message: "" });
|
||||
},
|
||||
enqueue(apply, persist, onError) {
|
||||
const result = new Promise((resolve) => pending.push({ apply, persist, onError, resolve }));
|
||||
enqueue(apply, persist, onError, { trackStatus = true } = {}) {
|
||||
const result = new Promise((resolve) => pending.push({ apply, persist, onError, resolve, trackStatus }));
|
||||
if (trackStatus) {
|
||||
publishStatus({ phase: "pending", pendingCount: status.pendingCount + 1, message: "" });
|
||||
}
|
||||
publish();
|
||||
void drain();
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ export function useAutoBackup(store) {
|
|||
const [busy, setBusy] = useState(false);
|
||||
const [permission, setPermission] = useState("unknown");
|
||||
const [error, setError] = useState("");
|
||||
const [lastRunStatus, setLastRunStatus] = useState("idle");
|
||||
const [backupNeeded, setBackupNeeded] = useState(false);
|
||||
const configRef = useRef(config);
|
||||
const configWriteRef = useRef(Promise.resolve());
|
||||
|
|
@ -92,6 +93,8 @@ export function useAutoBackup(store) {
|
|||
if (!supported || !directoryHandle || runRef.current) return { ok: false, reason: "unavailable" };
|
||||
runRef.current = true;
|
||||
setBusy(true);
|
||||
setError("");
|
||||
setLastRunStatus("running");
|
||||
try {
|
||||
let generatedContents = "";
|
||||
let exportedMutationVersion = null;
|
||||
|
|
@ -127,9 +130,11 @@ export function useAutoBackup(store) {
|
|||
}
|
||||
if (!result.ok) setError(result.reason === "permission" ? "" : result.error?.message || "La sauvegarde locale a échoué.");
|
||||
if (result.ok && result.cleanupError) setError(result.cleanupError);
|
||||
setLastRunStatus(result.ok ? "success" : result.reason === "permission" ? "idle" : "error");
|
||||
return result;
|
||||
} catch (runError) {
|
||||
setError(runError?.message || "La sauvegarde locale a échoué.");
|
||||
setLastRunStatus("error");
|
||||
return { ok: false, reason: "backup", error: runError };
|
||||
} finally {
|
||||
runRef.current = false;
|
||||
|
|
@ -209,6 +214,8 @@ export function useAutoBackup(store) {
|
|||
busy,
|
||||
permission,
|
||||
error,
|
||||
lastRunStatus,
|
||||
persistenceStatus: store.persistenceStatus,
|
||||
setError,
|
||||
setEnabled,
|
||||
chooseDirectory,
|
||||
|
|
|
|||
|
|
@ -76,7 +76,8 @@ export function useIndexedToolboxes(onError) {
|
|||
const pendingReadsRef = useRef(new Map());
|
||||
const storageChannelRef = useRef(null);
|
||||
const [state, setState] = useState({ toolboxes: [], links: {}, moduleData: {}, toastPosition: "right" });
|
||||
const [queue] = useState(() => createPersistenceQueue(state, setState));
|
||||
const [persistenceStatus, setPersistenceStatus] = useState({ phase: "loading", pendingCount: 0, lastConfirmedAt: "", message: "" });
|
||||
const [queue] = useState(() => createPersistenceQueue(state, setState, setPersistenceStatus));
|
||||
const [storageUsage, setStorageUsage] = useState({ used: 0, limit: 0, ratio: 0 });
|
||||
const quotaRefreshRef = useRef(null);
|
||||
const reportStorageError = useCallback((error) => {
|
||||
|
|
@ -133,7 +134,8 @@ export function useIndexedToolboxes(onError) {
|
|||
void queue.enqueue(
|
||||
(confirmed) => confirmed,
|
||||
(next) => readStoredState({ preservedModuleData: next.moduleData, refreshedModuleKeys }),
|
||||
reportStorageError
|
||||
reportStorageError,
|
||||
{ trackStatus: false }
|
||||
);
|
||||
};
|
||||
return () => {
|
||||
|
|
@ -263,7 +265,7 @@ export function useIndexedToolboxes(onError) {
|
|||
if (!writableRef.current) return;
|
||||
await queue.enqueue((current) => ({
|
||||
...current, moduleData: mergeLoadedModuleData(current.moduleData, [key], entries)
|
||||
}), () => {});
|
||||
}), () => {}, undefined, { trackStatus: false });
|
||||
})();
|
||||
pendingReadsRef.current.set(key, request);
|
||||
void request.then(() => pendingReadsRef.current.delete(key), () => pendingReadsRef.current.delete(key));
|
||||
|
|
@ -282,7 +284,7 @@ export function useIndexedToolboxes(onError) {
|
|||
moduleData: stored.moduleData,
|
||||
toastPosition: queue.getCurrent().toastPosition
|
||||
};
|
||||
}, options.onError || reportStorageError);
|
||||
}, options.onError || reportStorageError, { trackStatus: false });
|
||||
return success ? snapshot : null;
|
||||
}
|
||||
|
||||
|
|
@ -301,6 +303,7 @@ export function useIndexedToolboxes(onError) {
|
|||
ready,
|
||||
loadError,
|
||||
retryLoad,
|
||||
persistenceStatus,
|
||||
storageUsage,
|
||||
setToolboxes: persistToolboxes,
|
||||
setLinks: persistLinks,
|
||||
|
|
|
|||
|
|
@ -29,7 +29,32 @@ function getLibraryUrl() {
|
|||
return `${window.location.origin}${window.location.pathname}#/library`;
|
||||
}
|
||||
|
||||
export function useToolboxActions({ store, notify, creationTemplate, setConfirmModal, setCreateModal, setLinkModalGameId, setDrawerGameId, setImage }) {
|
||||
export function useToolboxActions({ store, notify, creationTemplate, importContent, setConfirmModal, setCreateModal, setLinkModalGameId, setDrawerGameId, setImage }) {
|
||||
const importText = {
|
||||
replaceLinksTitle: importContent?.replaceLinksTitle || "Réattribuer des associations de jeu ?",
|
||||
replaceLinksMessage: importContent?.replaceLinksMessage || "Des associations de jeu existantes ({count}) seront réattribuées aux copies importées. Les toolboxes déjà présentes seront conservées.",
|
||||
replaceLinksConfirm: importContent?.replaceLinksConfirm || "Importer et réattribuer",
|
||||
cancel: importContent?.cancel || "Annuler"
|
||||
};
|
||||
|
||||
function confirmLinkReplacement(count, onConfirm) {
|
||||
return new Promise((resolve, reject) => {
|
||||
setConfirmModal({
|
||||
title: importText.replaceLinksTitle,
|
||||
message: importText.replaceLinksMessage.replace("{count}", String(count)),
|
||||
confirmLabel: importText.replaceLinksConfirm,
|
||||
cancelLabel: importText.cancel,
|
||||
onResolve: (confirmed) => {
|
||||
if (!confirmed) {
|
||||
resolve(false);
|
||||
return;
|
||||
}
|
||||
Promise.resolve(onConfirm()).then(resolve, reject);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function createToolbox(name, gameId = "", options = {}) {
|
||||
if (!store.ready) return null;
|
||||
const now = new Date().toISOString();
|
||||
|
|
@ -181,8 +206,7 @@ export function useToolboxActions({ store, notify, creationTemplate, setConfirmM
|
|||
return true;
|
||||
}
|
||||
|
||||
async function importToolboxPayload(file, gameId = "") {
|
||||
const payload = validateToolboxImportPayload(JSON.parse(await file.text()), "single");
|
||||
async function importToolboxPayload(payload, gameId = "") {
|
||||
const imported = normalizeToolbox({ ...payload.toolbox, id: uid("tbx"), updatedAt: new Date().toISOString() });
|
||||
const moduleIdMap = new Map();
|
||||
imported.modules = imported.modules.map((module) => {
|
||||
|
|
@ -218,8 +242,7 @@ export function useToolboxActions({ store, notify, creationTemplate, setConfirmM
|
|||
return normalizedImport;
|
||||
}
|
||||
|
||||
async function importAllToolboxesPayload(file) {
|
||||
const payload = validateToolboxImportPayload(JSON.parse(await file.text()), "global");
|
||||
async function importAllToolboxesPayload(payload) {
|
||||
const toolboxIdMap = new Map();
|
||||
const moduleIdMap = new Map();
|
||||
const importedToolboxes = payload.toolboxes.map((toolbox) => {
|
||||
|
|
@ -301,7 +324,11 @@ export function useToolboxActions({ store, notify, creationTemplate, setConfirmM
|
|||
importToolbox: async (file, gameId = "") => {
|
||||
if (!store.ready) return null;
|
||||
try {
|
||||
const toolbox = await importToolboxPayload(file, gameId);
|
||||
const payload = validateToolboxImportPayload(JSON.parse(await file.text()), "single");
|
||||
const runImport = () => importToolboxPayload(payload, gameId);
|
||||
const toolbox = gameId && store.links?.[gameId]
|
||||
? await confirmLinkReplacement(1, runImport)
|
||||
: await runImport();
|
||||
if (toolbox) notify("Toolbox importée.");
|
||||
return toolbox;
|
||||
} catch (error) {
|
||||
|
|
@ -318,7 +345,13 @@ export function useToolboxActions({ store, notify, creationTemplate, setConfirmM
|
|||
importAllToolboxes: async (file) => {
|
||||
if (!store.ready) return false;
|
||||
try {
|
||||
await importAllToolboxesPayload(file);
|
||||
const payload = validateToolboxImportPayload(JSON.parse(await file.text()), "global");
|
||||
const reassignedLinks = Object.keys(payload.links || {}).filter((gameId) => store.links?.[gameId]);
|
||||
const runImport = () => importAllToolboxesPayload(payload).then(() => true);
|
||||
const imported = reassignedLinks.length
|
||||
? await confirmLinkReplacement(reassignedLinks.length, runImport)
|
||||
: await runImport();
|
||||
if (!imported) return false;
|
||||
notify("Import global terminé.");
|
||||
return true;
|
||||
} catch (error) {
|
||||
|
|
|
|||
|
|
@ -147,6 +147,7 @@ function App() {
|
|||
store,
|
||||
notify,
|
||||
creationTemplate: siteContent?.toolboxes?.creationTemplate,
|
||||
importContent: siteContent?.toolboxes?.imports,
|
||||
setCreateModal,
|
||||
setConfirmModal,
|
||||
setLinkModalGameId,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
@use "overlays/image-viewer";
|
||||
@use "overlays/drawers";
|
||||
@use "overlays/modals";
|
||||
@use "overlays/auto-backup";
|
||||
@use "overlays/notifications";
|
||||
@use "overlays/tool-add";
|
||||
@use "overlays/toolbox-management";
|
||||
|
|
|
|||
264
website/src/styles/overlays/_auto-backup.scss
Normal file
264
website/src/styles/overlays/_auto-backup.scss
Normal file
|
|
@ -0,0 +1,264 @@
|
|||
// Rôle : stylise la fenêtre de sauvegarde automatique et ses états.
|
||||
.auto-backup-modal.nds-modal {
|
||||
width: min(760px, calc(100vw - 32px));
|
||||
max-height: min(760px, calc(100vh - 32px));
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.auto-backup-modal-header {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: var(--space-4);
|
||||
}
|
||||
|
||||
.auto-backup-modal-header h2 {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.auto-backup-modal-header .eyebrow,
|
||||
.auto-backup-folder .eyebrow,
|
||||
.auto-backup-last .eyebrow {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.auto-backup-description {
|
||||
color: var(--color-text-secondary);
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.auto-backup-file-status[data-state="pending"] {
|
||||
color: var(--color-accent-gold);
|
||||
}
|
||||
|
||||
.auto-backup-file-status[data-state="error"] {
|
||||
color: var(--color-danger);
|
||||
}
|
||||
|
||||
.auto-backup-persistence-status {
|
||||
margin-top: var(--space-4);
|
||||
}
|
||||
|
||||
.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-top: var(--space-5);
|
||||
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);
|
||||
}
|
||||
|
||||
.auto-backup-compatibility strong {
|
||||
display: block;
|
||||
color: var(--color-text-primary);
|
||||
font-size: var(--font-size-sm);
|
||||
}
|
||||
|
||||
.auto-backup-compatibility ul {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin: var(--space-3) 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.auto-backup-compatibility li {
|
||||
padding: 5px 9px;
|
||||
border: 1px solid rgba(246, 196, 83, 0.2);
|
||||
border-radius: var(--radius-pill);
|
||||
background: rgba(246, 196, 83, 0.08);
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-xs);
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.auto-backup-permission-guide {
|
||||
margin-top: var(--space-5);
|
||||
padding: var(--space-4);
|
||||
border: 1px solid rgba(34, 211, 238, 0.2);
|
||||
border-radius: var(--radius-md);
|
||||
background: rgba(34, 211, 238, 0.06);
|
||||
}
|
||||
|
||||
.auto-backup-permission-guide strong {
|
||||
color: var(--color-text-primary);
|
||||
}
|
||||
|
||||
.auto-backup-permission-guide p {
|
||||
margin: var(--space-2) 0 var(--space-3);
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-sm);
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.auto-backup-permission-guide ol {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
margin: 0;
|
||||
padding-left: 20px;
|
||||
color: var(--color-text-muted);
|
||||
font-size: var(--font-size-sm);
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.auto-backup-folder {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
gap: var(--space-4);
|
||||
}
|
||||
|
||||
.auto-backup-folder,
|
||||
.auto-backup-last {
|
||||
padding: var(--space-4);
|
||||
border: 1px solid rgba(165, 180, 252, 0.14);
|
||||
border-radius: var(--radius-md);
|
||||
background: rgba(16, 20, 38, 0.42);
|
||||
}
|
||||
|
||||
.auto-backup-folder > div {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.auto-backup-folder strong {
|
||||
overflow-wrap: anywhere;
|
||||
color: var(--color-text-primary);
|
||||
}
|
||||
|
||||
.auto-backup-last {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.auto-backup-last strong {
|
||||
display: block;
|
||||
color: var(--color-text-primary);
|
||||
font-size: var(--font-size-lg);
|
||||
}
|
||||
|
||||
.auto-backup-file-status {
|
||||
display: block;
|
||||
margin-top: var(--space-3);
|
||||
color: var(--color-text-muted);
|
||||
font-size: var(--font-size-xs);
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.auto-backup-toggle {
|
||||
display: grid;
|
||||
grid-template-columns: auto minmax(0, 1fr);
|
||||
align-items: center;
|
||||
gap: var(--space-3);
|
||||
margin-top: var(--space-5);
|
||||
padding: var(--space-4);
|
||||
border: 1px solid rgba(165, 180, 252, 0.16);
|
||||
border-radius: var(--radius-md);
|
||||
background: rgba(16, 20, 38, 0.52);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.auto-backup-toggle:has(input:disabled) {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.65;
|
||||
}
|
||||
|
||||
.auto-backup-toggle .native-switch-input {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0 0 0 0);
|
||||
clip-path: inset(50%);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.auto-backup-toggle .switch-track {
|
||||
position: relative;
|
||||
display: block;
|
||||
width: 52px;
|
||||
height: 30px;
|
||||
flex: 0 0 auto;
|
||||
border: 1px solid rgba(165, 180, 252, 0.24);
|
||||
border-radius: var(--radius-pill);
|
||||
background: rgba(7, 10, 24, 0.72);
|
||||
transition: background-color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
|
||||
}
|
||||
|
||||
.auto-backup-toggle .switch-thumb {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 4px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
background: var(--color-text-muted);
|
||||
transform: translateY(-50%);
|
||||
transition: left var(--duration-fast) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard);
|
||||
}
|
||||
|
||||
.auto-backup-toggle input:checked + .switch-track {
|
||||
border-color: rgba(246, 196, 83, 0.5);
|
||||
background: rgba(246, 196, 83, 0.16);
|
||||
}
|
||||
|
||||
.auto-backup-toggle input:checked + .switch-track .switch-thumb {
|
||||
left: 26px;
|
||||
background: var(--color-accent-gold);
|
||||
}
|
||||
|
||||
.auto-backup-toggle:focus-within {
|
||||
border-color: rgba(246, 196, 83, 0.45);
|
||||
}
|
||||
|
||||
.auto-backup-toggle-copy {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.auto-backup-toggle-copy strong {
|
||||
color: var(--color-text-primary);
|
||||
font-size: var(--font-size-base);
|
||||
}
|
||||
|
||||
.auto-backup-toggle-copy small {
|
||||
color: var(--color-text-muted);
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.auto-backup-modal-footer {
|
||||
margin-top: var(--space-5);
|
||||
}
|
||||
|
||||
.auto-backup-close-footer {
|
||||
margin-top: var(--space-3);
|
||||
padding-top: var(--space-4);
|
||||
border-top: 1px solid rgba(165, 180, 252, 0.12);
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.auto-backup-status-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.auto-backup-modal-footer {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.auto-backup-modal-footer > button {
|
||||
flex: 1 1 180px;
|
||||
}
|
||||
}
|
||||
|
|
@ -31,250 +31,6 @@
|
|||
margin-bottom: var(--space-6);
|
||||
}
|
||||
|
||||
.auto-backup-modal.nds-modal {
|
||||
width: min(760px, calc(100vw - 32px));
|
||||
max-height: min(760px, calc(100vh - 32px));
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.auto-backup-modal-header {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: var(--space-4);
|
||||
}
|
||||
|
||||
.auto-backup-modal-header h2 {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.auto-backup-modal-header .eyebrow,
|
||||
.auto-backup-folder .eyebrow,
|
||||
.auto-backup-last .eyebrow {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.auto-backup-description {
|
||||
color: var(--color-text-secondary);
|
||||
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-top: var(--space-5);
|
||||
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);
|
||||
}
|
||||
|
||||
.auto-backup-compatibility strong {
|
||||
display: block;
|
||||
color: var(--color-text-primary);
|
||||
font-size: var(--font-size-sm);
|
||||
}
|
||||
|
||||
.auto-backup-compatibility ul {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin: var(--space-3) 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.auto-backup-compatibility li {
|
||||
padding: 5px 9px;
|
||||
border: 1px solid rgba(246, 196, 83, 0.2);
|
||||
border-radius: var(--radius-pill);
|
||||
background: rgba(246, 196, 83, 0.08);
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-xs);
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.auto-backup-permission-guide {
|
||||
margin-top: var(--space-5);
|
||||
padding: var(--space-4);
|
||||
border: 1px solid rgba(34, 211, 238, 0.2);
|
||||
border-radius: var(--radius-md);
|
||||
background: rgba(34, 211, 238, 0.06);
|
||||
}
|
||||
|
||||
.auto-backup-permission-guide strong {
|
||||
color: var(--color-text-primary);
|
||||
}
|
||||
|
||||
.auto-backup-permission-guide p {
|
||||
margin: var(--space-2) 0 var(--space-3);
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-sm);
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.auto-backup-permission-guide ol {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
margin: 0;
|
||||
padding-left: 20px;
|
||||
color: var(--color-text-muted);
|
||||
font-size: var(--font-size-sm);
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.auto-backup-folder {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
gap: var(--space-4);
|
||||
}
|
||||
|
||||
.auto-backup-folder,
|
||||
.auto-backup-last {
|
||||
padding: var(--space-4);
|
||||
border: 1px solid rgba(165, 180, 252, 0.14);
|
||||
border-radius: var(--radius-md);
|
||||
background: rgba(16, 20, 38, 0.42);
|
||||
}
|
||||
|
||||
.auto-backup-folder > div {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.auto-backup-folder strong {
|
||||
overflow-wrap: anywhere;
|
||||
color: var(--color-text-primary);
|
||||
}
|
||||
|
||||
.auto-backup-last {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.auto-backup-last strong {
|
||||
display: block;
|
||||
color: var(--color-text-primary);
|
||||
font-size: var(--font-size-lg);
|
||||
}
|
||||
|
||||
.auto-backup-toggle {
|
||||
display: grid;
|
||||
grid-template-columns: auto minmax(0, 1fr);
|
||||
align-items: center;
|
||||
gap: var(--space-3);
|
||||
margin-top: var(--space-5);
|
||||
padding: var(--space-4);
|
||||
border: 1px solid rgba(165, 180, 252, 0.16);
|
||||
border-radius: var(--radius-md);
|
||||
background: rgba(16, 20, 38, 0.52);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.auto-backup-toggle:has(input:disabled) {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.65;
|
||||
}
|
||||
|
||||
.auto-backup-toggle .native-switch-input {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0 0 0 0);
|
||||
clip-path: inset(50%);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.auto-backup-toggle .switch-track {
|
||||
position: relative;
|
||||
display: block;
|
||||
width: 52px;
|
||||
height: 30px;
|
||||
flex: 0 0 auto;
|
||||
border: 1px solid rgba(165, 180, 252, 0.24);
|
||||
border-radius: var(--radius-pill);
|
||||
background: rgba(7, 10, 24, 0.72);
|
||||
transition: background-color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
|
||||
}
|
||||
|
||||
.auto-backup-toggle .switch-thumb {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 4px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
background: var(--color-text-muted);
|
||||
transform: translateY(-50%);
|
||||
transition: left var(--duration-fast) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard);
|
||||
}
|
||||
|
||||
.auto-backup-toggle input:checked + .switch-track {
|
||||
border-color: rgba(246, 196, 83, 0.5);
|
||||
background: rgba(246, 196, 83, 0.16);
|
||||
}
|
||||
|
||||
.auto-backup-toggle input:checked + .switch-track .switch-thumb {
|
||||
left: 26px;
|
||||
background: var(--color-accent-gold);
|
||||
}
|
||||
|
||||
.auto-backup-toggle:focus-within {
|
||||
border-color: rgba(246, 196, 83, 0.45);
|
||||
}
|
||||
|
||||
.auto-backup-toggle-copy {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.auto-backup-toggle-copy strong {
|
||||
color: var(--color-text-primary);
|
||||
font-size: var(--font-size-base);
|
||||
}
|
||||
|
||||
.auto-backup-toggle-copy small {
|
||||
color: var(--color-text-muted);
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.auto-backup-modal-footer {
|
||||
margin-top: var(--space-5);
|
||||
}
|
||||
|
||||
.auto-backup-close-footer {
|
||||
margin-top: var(--space-3);
|
||||
padding-top: var(--space-4);
|
||||
border-top: 1px solid rgba(165, 180, 252, 0.12);
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.auto-backup-status-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.auto-backup-modal-footer {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.auto-backup-modal-footer > button {
|
||||
flex: 1 1 180px;
|
||||
}
|
||||
}
|
||||
|
||||
@property --notification-toast-angle {
|
||||
syntax: "<angle>";
|
||||
inherits: false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue