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
@@ -4,8 +4,8 @@ import SwiftUI
public enum DashboardCard: String, CaseIterable, Identifiable, Codable, Hashable {
case status
case connections
case traffic
case trafficTotal
case uploadTraffic
case downloadTraffic
case httpProxy
case clashMode
case profile
@@ -18,12 +18,12 @@ public enum DashboardCard: String, CaseIterable, Identifiable, Codable, Hashable
return "Status"
case .connections:
return "Connections"
case .traffic:
return "Traffic"
case .trafficTotal:
return "Traffic Total"
case .uploadTraffic:
return "Upload"
case .downloadTraffic:
return "Download"
case .httpProxy:
return "HTTP Proxy"
return "System HTTP Proxy"
case .clashMode:
return "Clash Mode"
case .profile:
@@ -37,22 +37,22 @@ public enum DashboardCard: String, CaseIterable, Identifiable, Codable, Hashable
return "info.circle.fill"
case .connections:
return "link.circle.fill"
case .traffic:
return "arrow.up.arrow.down.circle.fill"
case .trafficTotal:
return "chart.bar.fill"
case .uploadTraffic:
return "arrow.up.circle.fill"
case .downloadTraffic:
return "arrow.down.circle.fill"
case .httpProxy:
return "network"
case .clashMode:
return "circle.grid.2x2.fill"
case .profile:
return "person.crop.circle.fill"
return "doc.text.fill"
}
}
public var isHalfWidth: Bool {
switch self {
case .status, .connections, .traffic, .trafficTotal:
case .status, .connections, .uploadTraffic, .downloadTraffic:
return true
case .httpProxy, .clashMode, .profile:
return false
@@ -64,6 +64,6 @@ public enum DashboardCard: String, CaseIterable, Identifiable, Codable, Hashable
}
public static var defaultOrder: [DashboardCard] {
[.status, .connections, .traffic, .trafficTotal, .httpProxy, .clashMode, .profile]
[.uploadTraffic, .downloadTraffic, .status, .connections, .httpProxy, .clashMode, .profile]
}
}