diff --git a/src/pages/ExportPage.scss b/src/pages/ExportPage.scss index 6aa0468..8192e23 100644 --- a/src/pages/ExportPage.scss +++ b/src/pages/ExportPage.scss @@ -1382,10 +1382,14 @@ line-height: 1.2; color: var(--text-secondary); font-variant-numeric: tabular-nums; + display: inline-flex; + align-items: center; + justify-content: center; + min-height: 14px; + } - &.loading { - color: var(--text-tertiary); - } + .row-media-metric-icon { + color: var(--text-tertiary); } .row-message-stats { diff --git a/src/pages/ExportPage.tsx b/src/pages/ExportPage.tsx index 3fdf589..5bc9d8a 100644 --- a/src/pages/ExportPage.tsx +++ b/src/pages/ExportPage.tsx @@ -4185,22 +4185,24 @@ function ExportPage() { const hintedMessages = normalizeMessageCount(matchedSession?.messageCountHint) const displayedMessageCount = countedMessages ?? hintedMessages const mediaMetric = sessionContentMetrics[contact.username] - const metricLoadingReady = canExport && isSessionCountStageReady const messageCountLabel = !canExport ? '--' : typeof displayedMessageCount === 'number' ? displayedMessageCount.toLocaleString('zh-CN') : '获取中' - const metricToLabel = (value: unknown): string => { + const metricToDisplay = (value: unknown): { state: 'value'; text: string } | { state: 'loading' } | { state: 'na'; text: '--' } => { const normalized = normalizeMessageCount(value) - if (!canExport) return '--' - if (!metricLoadingReady) return '--' - return typeof normalized === 'number' ? normalized.toLocaleString('zh-CN') : '...' + if (!canExport) return { state: 'na', text: '--' } + if (!isSessionCountStageReady) return { state: 'loading' } + if (typeof normalized === 'number') { + return { state: 'value', text: normalized.toLocaleString('zh-CN') } + } + return { state: 'loading' } } - const emojiLabel = metricToLabel(mediaMetric?.emojiMessages) - const voiceLabel = metricToLabel(mediaMetric?.voiceMessages) - const imageLabel = metricToLabel(mediaMetric?.imageMessages) - const videoLabel = metricToLabel(mediaMetric?.videoMessages) + const emojiMetric = metricToDisplay(mediaMetric?.emojiMessages) + const voiceMetric = metricToDisplay(mediaMetric?.voiceMessages) + const imageMetric = metricToDisplay(mediaMetric?.imageMessages) + const videoMetric = metricToDisplay(mediaMetric?.videoMessages) const openChatLabel = contact.type === 'friend' ? '打开私聊' : contact.type === 'group' @@ -4256,16 +4258,32 @@ function ExportPage() { )}
- {emojiLabel} + + {emojiMetric.state === 'loading' + ? + : emojiMetric.text} +
- {voiceLabel} + + {voiceMetric.state === 'loading' + ? + : voiceMetric.text} +
- {imageLabel} + + {imageMetric.state === 'loading' + ? + : imageMetric.text} +
- {videoLabel} + + {videoMetric.state === 'loading' + ? + : videoMetric.text} +