fix(servers): compact connectivity table layout

This commit is contained in:
Qiu Yuzhou
2026-10-14 17:11:34 +08:00
parent 2a0ac4dd2d
commit d5f32ec83d
4 changed files with 11 additions and 31 deletions
@@ -391,23 +391,6 @@
}
}
}
},
"最快 %@": {
"extractionState": "manual",
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "Fastest %@"
}
},
"zh-Hans": {
"stringUnit": {
"state": "translated",
"value": "最快 %@"
}
}
}
}
},
"version": "1.0"
@@ -47,7 +47,7 @@ struct ConnectivityCell: View {
let summary = module.summary(for: node.connectivityServerIDs, at: date)
if node.isGroup {
record = summary.record
text = record.map { ConnectivityCopy.fastest($0.outcome) } ?? (summary.hasResults ? "—" : "")
text = record.map { ConnectivityCopy.outcome($0.outcome) } ?? (summary.hasResults ? "—" : "")
if let id = summary.serverID { prefix = workflow.displayName(for: id) + " · " }
} else {
record = module.history(for: node.id).first
@@ -111,9 +111,6 @@ enum ConnectivityCopy {
case .http(let status): "HTTP \(status)"
}
}
static func fastest(_ value: ServerConnectivity.Outcome) -> String {
String.localizedStringWithFormat(text("最快 %@"), outcome(value))
}
}
struct ConnectivityDetailView: View {
@@ -36,13 +36,13 @@ struct FavoriteServersTable<MenuContent: View>: View {
TableColumn("名称") { node in
ServerTableNameCell(node: node, activeTargetID: activeTargetID)
}
.width(min: 140, ideal: 200)
.width(min: 140, ideal: 160)
TableColumn(ConnectivityCopy.text("响应延迟")) { node in
if let module = workflow.connectivity {
ConnectivityCell(module: module, node: node, workflow: workflow)
}
}
.width(min: 90, ideal: 110)
.width(min: 50, ideal: 60)
TableColumn("路径") { node in
let path = path(for: node)
Text(path)
@@ -153,19 +153,19 @@ struct ServersView: View {
}
.padding(.leading, CGFloat(depths[node.id] ?? 0) * 14)
}
.width(min: 160, ideal: 240)
TableColumn(ConnectivityCopy.text("响应延迟")) { node in
if let module = workflow.connectivity {
ConnectivityCell(module: module, node: node, workflow: workflow)
}
}
.width(min: 90, ideal: 110)
.width(min: 160, ideal: 180)
TableColumn("收藏") { node in
Image(systemName: workflow.isFavorite(node.id) ? "star.fill" : "star")
.accessibilityLabel(Text("收藏"))
.accessibilityValue(Text(workflow.isFavorite(node.id) ? "收藏" : "—"))
}
.width(44)
.width(36)
TableColumn(ConnectivityCopy.text("响应延迟")) { node in
if let module = workflow.connectivity {
ConnectivityCell(module: module, node: node, workflow: workflow)
}
}
.width(min: 50, ideal: 60)
TableColumn("创建时间", sortUsing: ServerTableSort(.createdAt)) { node in
timestampCell(node.createdAt)
}