From e5410bbe9fe8310dc9bb8fc0c65fb607cdede008 Mon Sep 17 00:00:00 2001 From: yoma Date: Thu, 9 Jul 2026 06:13:46 +0800 Subject: [PATCH] Summarize mobile sync queue status --- apps/mobile/src/screens/WorkspaceScreen.tsx | 22 ++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/apps/mobile/src/screens/WorkspaceScreen.tsx b/apps/mobile/src/screens/WorkspaceScreen.tsx index cd16374e..1552617e 100644 --- a/apps/mobile/src/screens/WorkspaceScreen.tsx +++ b/apps/mobile/src/screens/WorkspaceScreen.tsx @@ -4937,7 +4937,7 @@ const SyncQueuePanel = ({ summary: MobileSyncQueueSummary; }) => { const hasQueuedChanges = summary.total > 0; - const value = hasQueuedChanges ? `${summary.pending} 待同步 · ${summary.syncing} 同步中 · ${summary.error} 失败 · ${summary.conflict} 冲突` : "无待同步变更"; + const value = getSyncQueueSummaryLabel(summary, isSyncing); return ( @@ -5704,6 +5704,26 @@ const getSyncQueueStatusLabel = (status: MobileSyncQueueItem["status"]) => { return labels[status]; }; +const getSyncQueueSummaryLabel = (summary: MobileSyncQueueSummary, isSyncing: boolean) => { + if (isSyncing || summary.syncing > 0) { + return "同步中"; + } + + if (summary.conflict > 0) { + return `${summary.conflict} 项同步冲突`; + } + + if (summary.error > 0) { + return `${summary.error} 项等待重试`; + } + + if (summary.pending > 0) { + return `${summary.pending} 项待同步`; + } + + return "已同步"; +}; + const getSyncQueueStatusStyle = (status: MobileSyncQueueItem["status"]) => { if (status === "conflict" || status === "error") { return styles.syncStatusDanger;