Improve local backup permissions and change tracking
All checks were successful
Deploy Sokko G / deploy (push) Successful in 19s
All checks were successful
Deploy Sokko G / deploy (push) Successful in 19s
This commit is contained in:
parent
34e542be28
commit
ee823d2c37
13 changed files with 372 additions and 37 deletions
|
|
@ -85,6 +85,8 @@ export function AppOverlays({
|
|||
id={notification.id}
|
||||
message={notification.message}
|
||||
durationMs={notification.durationMs}
|
||||
actionLabel={notification.actionLabel}
|
||||
onAction={notification.onAction}
|
||||
onClose={dismissNotification}
|
||||
/>
|
||||
))}
|
||||
|
|
|
|||
|
|
@ -24,15 +24,20 @@ export function ConfirmModal({ title, message, confirmLabel = "Confirmer", cance
|
|||
);
|
||||
}
|
||||
|
||||
export function NotificationToast({ id, message, durationMs = 120000, onClose }) {
|
||||
export function NotificationToast({ id, message, durationMs = 120000, actionLabel = "", onAction, onClose }) {
|
||||
useEffect(() => {
|
||||
if (durationMs <= 0) return undefined;
|
||||
const timeoutId = window.setTimeout(() => onClose(id), durationMs);
|
||||
return () => window.clearTimeout(timeoutId);
|
||||
}, [durationMs, id, onClose]);
|
||||
|
||||
return (
|
||||
<div className="notification-toast nds-toast" role="status">
|
||||
<div className={`notification-toast nds-toast${actionLabel && onAction ? " has-action" : ""}`} role="status">
|
||||
<span>{message}</span>
|
||||
{actionLabel && onAction && <button className="nds-button notification-toast-action" data-size="xs" data-variant="primary" type="button" onClick={() => {
|
||||
onAction();
|
||||
onClose(id);
|
||||
}}>{actionLabel}</button>}
|
||||
<button className="nds-icon-button" data-size="xs" type="button" onClick={() => onClose(id)} aria-label="Fermer l'alerte" title="Fermer">
|
||||
<Icon name="close" />
|
||||
</button>
|
||||
|
|
@ -103,6 +108,11 @@ export function AutoBackupModal({ backup, content, onClose }) {
|
|||
<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">
|
||||
|
|
@ -121,7 +131,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">
|
||||
{backup.config.directoryHandle && (backup.permission === "prompt" || backup.permission === "denied") && <button className="nds-button" data-size="sm" type="button" disabled={backup.busy} onClick={() => void backup.requestPermission()}>{content.reauthorize}</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>
|
||||
</>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue