mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-03-25 07:16:51 +00:00
feat(export): show running state on content and sns cards
This commit is contained in:
@@ -322,6 +322,15 @@
|
|||||||
&:hover {
|
&:hover {
|
||||||
background: var(--primary-hover);
|
background: var(--primary-hover);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:disabled {
|
||||||
|
cursor: not-allowed;
|
||||||
|
opacity: 0.86;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.running {
|
||||||
|
background: var(--primary-hover);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.skeleton-card {
|
&.skeleton-card {
|
||||||
|
|||||||
@@ -1892,6 +1892,21 @@ function ExportPage() {
|
|||||||
return set
|
return set
|
||||||
}, [tasks])
|
}, [tasks])
|
||||||
|
|
||||||
|
const runningCardTypes = useMemo(() => {
|
||||||
|
const set = new Set<ContentCardType>()
|
||||||
|
for (const task of tasks) {
|
||||||
|
if (task.status !== 'running') continue
|
||||||
|
if (task.payload.scope === 'sns') {
|
||||||
|
set.add('sns')
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if (task.payload.scope === 'content' && task.payload.contentType) {
|
||||||
|
set.add(task.payload.contentType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return set
|
||||||
|
}, [tasks])
|
||||||
|
|
||||||
const contentCards = useMemo(() => {
|
const contentCards = useMemo(() => {
|
||||||
const scopeSessions = sessions.filter(isContentScopeSession)
|
const scopeSessions = sessions.filter(isContentScopeSession)
|
||||||
const totalSessions = tabCounts.private + tabCounts.group + tabCounts.former_friend
|
const totalSessions = tabCounts.private + tabCounts.group + tabCounts.former_friend
|
||||||
@@ -2498,6 +2513,7 @@ function ExportPage() {
|
|||||||
const isCardStatsLoading = card.type === 'sns'
|
const isCardStatsLoading = card.type === 'sns'
|
||||||
? isSnsCardStatsLoading
|
? isSnsCardStatsLoading
|
||||||
: isSessionCardStatsLoading
|
: isSessionCardStatsLoading
|
||||||
|
const isCardRunning = runningCardTypes.has(card.type)
|
||||||
return (
|
return (
|
||||||
<div key={card.type} className="content-card">
|
<div key={card.type} className="content-card">
|
||||||
<div className="card-header">
|
<div className="card-header">
|
||||||
@@ -2518,7 +2534,8 @@ function ExportPage() {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
className="card-export-btn"
|
className={`card-export-btn ${isCardRunning ? 'running' : ''}`}
|
||||||
|
disabled={isCardRunning}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (card.type === 'sns') {
|
if (card.type === 'sns') {
|
||||||
openSnsExport()
|
openSnsExport()
|
||||||
@@ -2527,7 +2544,7 @@ function ExportPage() {
|
|||||||
openContentExport(card.type)
|
openContentExport(card.type)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
导出
|
{isCardRunning ? '导出中' : '导出'}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user