diff --git a/index.html b/index.html index aba4b4e..4797a85 100644 --- a/index.html +++ b/index.html @@ -15,6 +15,8 @@ AzuuCine + +
diff --git a/public/theme-boot.js b/public/theme-boot.js new file mode 100644 index 0000000..677e237 --- /dev/null +++ b/public/theme-boot.js @@ -0,0 +1,26 @@ +/* + * AzuuCine — thème posé avant le premier affichage (script bloquant, chargé dans ). + * Reprend les couleurs calculées au dernier lancement (voir applyTheme dans src/lib/theme.ts), + * pour ne jamais voir le thème par défaut le temps que l'app démarre. + */ +;(function () { + try { + var raw = localStorage.getItem('azuucine:theme-css') + if (!raw) return + var v = JSON.parse(raw) + var hex = /^#[0-9a-f]{6}$/i + var modes = { light: 1, dark: 1, night: 1, starfield: 1 } + if (!v || !modes[v.theme] || !hex.test(v.accent) || !hex.test(v.fill) || !hex.test(v.on) || !hex.test(v.canvas)) return + var root = document.documentElement + root.setAttribute('data-theme', v.theme) + root.style.setProperty('--color-accent', v.accent) + root.style.setProperty('--color-accent-fill', v.fill) + root.style.setProperty('--color-on-accent', v.on) + var meta = document.querySelector('meta[name="theme-color"]') + if (meta) meta.setAttribute('content', v.canvas) + var scheme = document.querySelector('meta[name="color-scheme"]') + if (scheme) scheme.setAttribute('content', v.theme === 'light' ? 'light' : 'dark') + } catch (e) { + /* stockage indisponible : thème par défaut */ + } +})() diff --git a/src/components/AccountSection.tsx b/src/components/AccountSection.tsx index c7aca28..711d25f 100644 --- a/src/components/AccountSection.tsx +++ b/src/components/AccountSection.tsx @@ -1,12 +1,14 @@ import Avatar from './social/Avatar' import { useSocial } from './social/SocialProvider' import { t } from '../i18n' -import { KeyRound, Loader2, LogOut, UserRound } from 'lucide-react' +import { AlertTriangle, Check, CloudOff, KeyRound, Loader2, LogOut, RefreshCw, UserRound } from 'lucide-react' import { useState, type FormEvent } from 'react' import { PASSWORD_MIN, updatePassword } from '../lib/cloud/auth' +import { timeAgo } from '../lib/timeAgo' import type { AccountApi } from '../store' import ConfirmDialog from './ConfirmDialog' import { SectionTitle } from './ui' +import { cx } from '../lib/utils' /** Réglages → Mon compte : mot de passe, déconnexion. La synchro tourne en arrière-plan. */ export default function AccountSection({ account, onMessage }: { account: AccountApi; onMessage: (kind: 'ok' | 'error', text: string) => void }) { @@ -67,6 +69,46 @@ export default function AccountSection({ account, onMessage }: { account: Accoun + {/* État de la synchronisation : visible, surtout quand quelque chose bloque */} +
+ + {sync.state === 'syncing' ? ( + + ) : sync.state === 'offline' ? ( + + ) : sync.state === 'error' ? ( + + ) : ( + + )} + + + + {sync.state === 'syncing' + ? t('sync.syncing') + : sync.state === 'offline' + ? t('sync.offline') + : sync.state === 'error' + ? t('sync.error') + : sync.lastSyncAt + ? t('sync.synced', { when: timeAgo(sync.lastSyncAt) }) + : t('sync.never')} + + {(sync.pending > 0 || (sync.state === 'error' && sync.error)) && ( + + {[sync.pending > 0 ? t('sync.pending', { count: sync.pending }) : '', sync.state === 'error' ? sync.error : ''].filter(Boolean).join(' · ')} + + )} + + +
+