fix(ui): 缩小卡片并还原设计稿紧凑排布
This commit is contained in:
@@ -3,39 +3,28 @@ import SwiftUI
|
||||
struct StorageDetailsView: View {
|
||||
let disk: DiskMetrics?
|
||||
let health: DiskHealthMetrics?
|
||||
let showVolumes: () -> Void
|
||||
let io: DiskIOMetrics?
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
HStack(spacing: 8) {
|
||||
VStack(spacing: 4) {
|
||||
field("memory.available", value: MetricFormat.bytes(disk?.available))
|
||||
field("disk.powerOnHours", value: health?.powerOnHours.map { "\($0) h" } ?? "--")
|
||||
}
|
||||
Divider().frame(height: 32)
|
||||
VStack(spacing: 4) {
|
||||
field("disk.remainingLife", value: MetricFormat.percent(health?.remainingLife))
|
||||
Button(action: showVolumes) {
|
||||
HStack(spacing: 3) {
|
||||
Text("disk.localVolumes")
|
||||
Spacer(minLength: 3)
|
||||
Image(systemName: "chevron.right").font(.system(size: 8))
|
||||
}.contentShape(.rect)
|
||||
}
|
||||
.buttonStyle(.plain).help(Text("disk.viewDetails"))
|
||||
.frame(height: 14)
|
||||
}
|
||||
}.font(PanelStyle.label).lineLimit(1)
|
||||
field("memory.available", value: MetricFormat.bytes(disk?.available))
|
||||
HStack(spacing: 6) {
|
||||
field("disk.read", value: MetricFormat.rate(io?.read))
|
||||
field("disk.write", value: MetricFormat.rate(io?.written))
|
||||
}
|
||||
HStack(spacing: 4) {
|
||||
field("disk.lifeShort", value: MetricFormat.percent(health?.remainingLife))
|
||||
Text("·").foregroundStyle(.secondary)
|
||||
field("disk.powerOnShort", value: health?.powerOnHours.map { "\($0) h" } ?? "--")
|
||||
}.font(.system(size: 8))
|
||||
}
|
||||
.font(.system(size: 9)).lineLimit(1).minimumScaleFactor(0.75)
|
||||
}
|
||||
|
||||
private func field(_ title: LocalizedStringKey, value: String) -> some View {
|
||||
HStack(spacing: 3) {
|
||||
Text(title).foregroundStyle(.secondary).help(Text(title))
|
||||
Spacer(minLength: 3)
|
||||
MetricText(value: value).font(PanelStyle.value)
|
||||
MetricText(value: value)
|
||||
}
|
||||
.frame(height: 14)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user