Refactor Dashboard traffic cards with line charts

This commit is contained in:
世界
2025-12-06 21:19:37 +08:00
parent 52efbd97d2
commit 0e206cc452
17 changed files with 299 additions and 93 deletions
@@ -11,20 +11,23 @@ public struct ClashModeCard: View {
public var body: some View {
if shouldShowPicker {
DashboardCardView(title: String(localized: "Mode"), isHalfWidth: false) {
Picker("", selection: Binding(get: {
clashMode
}, set: { newMode in
clashMode = newMode
Task {
await setClashMode(newMode)
}
})) {
ForEach(commandClient.clashModeList, id: \.self) { mode in
Text(mode)
DashboardCardView(title: "", isHalfWidth: false) {
VStack(alignment: .leading, spacing: 12) {
DashboardCardHeader(icon: "circle.grid.2x2.fill", title: "Mode")
Picker("", selection: Binding(get: {
clashMode
}, set: { newMode in
clashMode = newMode
Task {
await setClashMode(newMode)
}
})) {
ForEach(commandClient.clashModeList, id: \.self) { mode in
Text(mode)
}
}
.pickerStyle(.segmented)
}
.pickerStyle(.segmented)
}
.onAppear {
clashMode = commandClient.clashMode