mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-03-25 07:16:51 +00:00
fix(export): restore loading states for session metrics
This commit is contained in:
@@ -5236,6 +5236,7 @@ function ExportPage() {
|
|||||||
const renderContactRow = useCallback((_: number, contact: ContactInfo) => {
|
const renderContactRow = useCallback((_: number, contact: ContactInfo) => {
|
||||||
const matchedSession = sessionRowByUsername.get(contact.username)
|
const matchedSession = sessionRowByUsername.get(contact.username)
|
||||||
const canExport = Boolean(matchedSession?.hasSession)
|
const canExport = Boolean(matchedSession?.hasSession)
|
||||||
|
const isSessionBindingPending = !matchedSession && (isLoading || isSessionEnriching)
|
||||||
const checked = canExport && selectedSessions.has(contact.username)
|
const checked = canExport && selectedSessions.has(contact.username)
|
||||||
const isRunning = canExport && runningSessionIds.has(contact.username)
|
const isRunning = canExport && runningSessionIds.has(contact.username)
|
||||||
const isQueued = canExport && queuedSessionIds.has(contact.username)
|
const isQueued = canExport && queuedSessionIds.has(contact.username)
|
||||||
@@ -5246,14 +5247,17 @@ function ExportPage() {
|
|||||||
const hintedMessages = normalizeMessageCount(matchedSession?.messageCountHint)
|
const hintedMessages = normalizeMessageCount(matchedSession?.messageCountHint)
|
||||||
const displayedMessageCount = countedMessages ?? hintedMessages
|
const displayedMessageCount = countedMessages ?? hintedMessages
|
||||||
const mediaMetric = sessionContentMetrics[contact.username]
|
const mediaMetric = sessionContentMetrics[contact.username]
|
||||||
const messageCountLabel = !canExport
|
const messageCountState: { state: 'value'; text: string } | { state: 'loading' } | { state: 'na'; text: '--' } =
|
||||||
? '--'
|
!canExport
|
||||||
|
? (isSessionBindingPending ? { state: 'loading' } : { state: 'na', text: '--' })
|
||||||
: typeof displayedMessageCount === 'number'
|
: typeof displayedMessageCount === 'number'
|
||||||
? displayedMessageCount.toLocaleString('zh-CN')
|
? { state: 'value', text: displayedMessageCount.toLocaleString('zh-CN') }
|
||||||
: '获取中'
|
: { state: 'loading' }
|
||||||
const metricToDisplay = (value: unknown): { state: 'value'; text: string } | { state: 'loading' } | { state: 'na'; text: '--' } => {
|
const metricToDisplay = (value: unknown): { state: 'value'; text: string } | { state: 'loading' } | { state: 'na'; text: '--' } => {
|
||||||
const normalized = normalizeMessageCount(value)
|
const normalized = normalizeMessageCount(value)
|
||||||
if (!canExport) return { state: 'na', text: '--' }
|
if (!canExport) {
|
||||||
|
return isSessionBindingPending ? { state: 'loading' } : { state: 'na', text: '--' }
|
||||||
|
}
|
||||||
if (typeof normalized === 'number') {
|
if (typeof normalized === 'number') {
|
||||||
return { state: 'value', text: normalized.toLocaleString('zh-CN') }
|
return { state: 'value', text: normalized.toLocaleString('zh-CN') }
|
||||||
}
|
}
|
||||||
@@ -5310,8 +5314,10 @@ function ExportPage() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="row-message-count">
|
<div className="row-message-count">
|
||||||
<div className="row-message-stats">
|
<div className="row-message-stats">
|
||||||
<strong className={`row-message-count-value ${typeof displayedMessageCount === 'number' ? '' : 'muted'}`}>
|
<strong className={`row-message-count-value ${messageCountState.state === 'value' ? '' : 'muted'}`}>
|
||||||
{messageCountLabel}
|
{messageCountState.state === 'loading'
|
||||||
|
? <Loader2 size={12} className="spin row-media-metric-icon" aria-label="统计加载中" />
|
||||||
|
: messageCountState.text}
|
||||||
</strong>
|
</strong>
|
||||||
</div>
|
</div>
|
||||||
{canExport && (
|
{canExport && (
|
||||||
@@ -5424,6 +5430,8 @@ function ExportPage() {
|
|||||||
sessionLoadTraceMap,
|
sessionLoadTraceMap,
|
||||||
sessionMessageCounts,
|
sessionMessageCounts,
|
||||||
sessionRowByUsername,
|
sessionRowByUsername,
|
||||||
|
isLoading,
|
||||||
|
isSessionEnriching,
|
||||||
showSessionDetailPanel,
|
showSessionDetailPanel,
|
||||||
shouldShowSnsColumn,
|
shouldShowSnsColumn,
|
||||||
snsUserPostCounts,
|
snsUserPostCounts,
|
||||||
|
|||||||
Reference in New Issue
Block a user