refactor(home): split card views into separate files

This commit is contained in:
Qiu Yuzhou
2026-10-14 14:20:59 +08:00
parent 520c459713
commit 0d95a0edfd
2 changed files with 41 additions and 40 deletions
@@ -0,0 +1,41 @@
import SwiftUI
/// 「快速操作」卡:更新全部订阅。
struct QuickActionCard: View {
@ObservedObject var workflow: CatalogWorkflow
@State private var isRefreshingAll = false
var body: some View {
HomeCard(
title: "快速操作",
subtitle: nil,
trailing: { EmptyView() },
content: {
VStack(spacing: 10) {
QuickActionButton(
icon: "arrow.triangle.2.circlepath",
title: isRefreshingAll ? "正在更新…" : "更新全部订阅",
help: nil,
action: refreshAll
)
.disabled(workflow.subscriptions.isEmpty || isRefreshingAll)
if isRefreshingAll {
ProgressView()
.controlSize(.small)
.frame(maxWidth: .infinity, alignment: .leading)
}
}
.padding(.top, 6)
})
}
private func refreshAll() {
isRefreshingAll = true
Task {
await workflow.refreshAllSubscriptions()
isRefreshingAll = false
}
}
}
@@ -144,43 +144,3 @@ extension TerminalCommandShell {
}
}
}
/// 「快速操作」卡:更新全部订阅。
struct QuickActionCard: View {
@ObservedObject var workflow: CatalogWorkflow
@State private var isRefreshingAll = false
var body: some View {
HomeCard(
title: "快速操作",
subtitle: nil,
trailing: { EmptyView() },
content: {
VStack(spacing: 10) {
QuickActionButton(
icon: "arrow.triangle.2.circlepath",
title: isRefreshingAll ? "正在更新…" : "更新全部订阅",
help: nil,
action: refreshAll
)
.disabled(workflow.subscriptions.isEmpty || isRefreshingAll)
if isRefreshingAll {
ProgressView()
.controlSize(.small)
.frame(maxWidth: .infinity, alignment: .leading)
}
}
.padding(.top, 6)
})
}
private func refreshAll() {
isRefreshingAll = true
Task {
await workflow.refreshAllSubscriptions()
isRefreshingAll = false
}
}
}