mirror of
https://github.com/shadowsocks/ShadowsocksX-NG.git
synced 2026-11-02 16:53:45 +00:00
refactor(ui): remove home quick action card
This commit is contained in:
@@ -5134,23 +5134,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"快速操作": {
|
||||
"extractionState": "manual",
|
||||
"localizations": {
|
||||
"zh-Hans": {
|
||||
"stringUnit": {
|
||||
"state": "translated",
|
||||
"value": "快速操作"
|
||||
}
|
||||
},
|
||||
"en": {
|
||||
"stringUnit": {
|
||||
"state": "translated",
|
||||
"value": "Quick actions"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"所有系统代理流量通过本地 SOCKS 与 HTTP 入口转发,不使用规则分流。": {
|
||||
"extractionState": "manual",
|
||||
"localizations": {
|
||||
@@ -5814,23 +5797,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"更新全部订阅": {
|
||||
"extractionState": "manual",
|
||||
"localizations": {
|
||||
"zh-Hans": {
|
||||
"stringUnit": {
|
||||
"state": "translated",
|
||||
"value": "更新全部订阅"
|
||||
}
|
||||
},
|
||||
"en": {
|
||||
"stringUnit": {
|
||||
"state": "translated",
|
||||
"value": "Refresh All Subscriptions"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"有 %lld 台服务器因 UUID 缺失、无效、重复或冲突而生成了新身份。": {
|
||||
"extractionState": "manual",
|
||||
"localizations": {
|
||||
@@ -6421,23 +6387,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"正在更新…": {
|
||||
"extractionState": "manual",
|
||||
"localizations": {
|
||||
"zh-Hans": {
|
||||
"stringUnit": {
|
||||
"state": "translated",
|
||||
"value": "正在更新…"
|
||||
}
|
||||
},
|
||||
"en": {
|
||||
"stringUnit": {
|
||||
"state": "translated",
|
||||
"value": "Refreshing…"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"此操作不可撤销。": {
|
||||
"extractionState": "manual",
|
||||
"localizations": {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import SwiftUI
|
||||
|
||||
/// 首页分区:代理模式切换、运行控制、终端代理环境变量
|
||||
/// 命令与快速操作。模式与两个开关(agent/系统代理)走代理控制
|
||||
/// 首页分区:代理模式切换、运行控制、终端代理环境变量命令。
|
||||
/// 模式与两个开关(agent/系统代理)走代理控制
|
||||
/// 工作流的整体 snapshot;命令复制是 UI 副作用。三种模式(规则/全局/直连)
|
||||
/// 与规则子选项共用同一快照。
|
||||
struct HomeView: View {
|
||||
@@ -26,7 +26,6 @@ struct HomeView: View {
|
||||
RuntimeControlCard(control: control)
|
||||
ModeCard(control: control)
|
||||
TerminalProxyEnvironmentCard(control: control, clipboard: clipboard, errors: errors)
|
||||
QuickActionCard(workflow: workflow)
|
||||
}
|
||||
.frame(width: 400)
|
||||
}
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
import SwiftUI
|
||||
|
||||
/// 「快速操作」卡:更新全部订阅。
|
||||
struct QuickActionCard: View {
|
||||
@ObservedObject var workflow: CatalogWorkflow
|
||||
|
||||
@State private var isRefreshingAll = false
|
||||
|
||||
var body: some View {
|
||||
HomeCard(
|
||||
title: String(localized: "快速操作"),
|
||||
subtitle: nil,
|
||||
trailing: { EmptyView() },
|
||||
content: {
|
||||
VStack(spacing: 10) {
|
||||
QuickActionButton(
|
||||
icon: "arrow.triangle.2.circlepath",
|
||||
title: isRefreshingAll ? String(localized: "正在更新…") : String(localized: "更新全部订阅"),
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// 快速操作行按钮。
|
||||
struct QuickActionButton: View {
|
||||
let icon: String
|
||||
let title: String
|
||||
var help: String?
|
||||
let action: () -> Void
|
||||
|
||||
var body: some View {
|
||||
Button(action: action) {
|
||||
HStack(spacing: 10) {
|
||||
Image(systemName: icon)
|
||||
.foregroundStyle(.tint)
|
||||
Text(title)
|
||||
.font(.callout.weight(.medium))
|
||||
.foregroundStyle(.primary)
|
||||
.lineLimit(1)
|
||||
Spacer(minLength: 0)
|
||||
Image(systemName: "arrow.right")
|
||||
.font(.caption.weight(.semibold))
|
||||
.foregroundStyle(.tertiary)
|
||||
}
|
||||
.padding(.horizontal, 12)
|
||||
.padding(.vertical, 10)
|
||||
.contentShape(Rectangle())
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.background(
|
||||
.quaternary.opacity(0.5), in: RoundedRectangle(cornerRadius: 8, style: .continuous)
|
||||
)
|
||||
.help(help ?? title)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user