diff --git a/frontend/src/App.svelte b/frontend/src/App.svelte index 04b5dc6..a3f17aa 100644 --- a/frontend/src/App.svelte +++ b/frontend/src/App.svelte @@ -148,6 +148,8 @@ // ===== Sync state ===== let syncStatus = null let syncLoading = false + let syncMessage = '' + let syncMessageKind = '' const tabs = [ { id: 'overview', label: t('tab.overview') }, @@ -1431,15 +1433,35 @@ showSettings = false } + function syncResultMessage(result) { + const conflicts = Array.isArray(result?.conflicts) ? result.conflicts : [] + const applyErrors = Array.isArray(result?.applyErrors) ? result.applyErrors : [] + const parts = [] + if (conflicts.length > 0) { + parts.push(t('sync.conflictsCount', { count: conflicts.length })) + } + if (applyErrors.length > 0) { + parts.push(t('sync.applyErrorsCount', { count: applyErrors.length })) + } + return parts.join(' · ') + } + async function runSyncNow() { syncLoading = true + syncMessage = '' + syncMessageKind = '' try { - await wailsCall('SyncNow') + const result = await wailsCall('SyncNow') await loadSyncStatus() + syncMessage = syncResultMessage(result) + syncMessageKind = syncMessage ? 'warning' : '' } catch (e) { console.error('sync error:', e) + syncMessage = `${t('sync.status.error')}: ${e?.message || e}` + syncMessageKind = 'warning' + } finally { + syncLoading = false } - syncLoading = false } // First run / recovery handlers @@ -1521,7 +1543,7 @@
+ {#if syncMessage} +