fix(ui): 提升卡片文字对比度与辅助信息可读性
This commit is contained in:
@@ -4,10 +4,10 @@ import SwiftUI
|
||||
extension MenuPanelView {
|
||||
func line(_ key: LocalizedStringKey, _ value: String) -> some View {
|
||||
HStack(alignment: .firstTextBaseline, spacing: 4) {
|
||||
Text(key).font(.system(size: 9)).foregroundStyle(.secondary)
|
||||
Text(key).font(.system(size: 10)).foregroundStyle(.secondary)
|
||||
Spacer(minLength: 6)
|
||||
MetricText(value: value).font(.system(size: 9, weight: .medium))
|
||||
}.frame(height: 12)
|
||||
MetricText(value: value).font(.system(size: 10, weight: .medium))
|
||||
}.frame(height: 16)
|
||||
}
|
||||
|
||||
func inlineMetric(_ title: LocalizedStringKey, _ value: String) -> some View {
|
||||
@@ -15,7 +15,7 @@ extension MenuPanelView {
|
||||
Text(title).foregroundStyle(.secondary)
|
||||
MetricText(value: value).fontWeight(.medium)
|
||||
}
|
||||
.font(.system(size: 9)).lineLimit(1).minimumScaleFactor(0.8)
|
||||
.font(.system(size: 10)).lineLimit(1)
|
||||
}
|
||||
|
||||
func batteryPowerLabel(_ battery: BatteryMetrics) -> LocalizedStringKey {
|
||||
@@ -45,7 +45,7 @@ extension MenuPanelView {
|
||||
HStack(spacing: 5) {
|
||||
inlineMetric("cpu.user", MetricFormat.percent(snapshot.cpu?.user))
|
||||
inlineMetric("cpu.system", MetricFormat.percent(snapshot.cpu?.system))
|
||||
}.frame(height: 12)
|
||||
}.frame(height: 16)
|
||||
if let cpu = snapshot.cpu {
|
||||
CPUCoreGrid(
|
||||
values: cpu.cores, kinds: CPUCoreTopology.cores,
|
||||
@@ -75,9 +75,9 @@ extension MenuPanelView {
|
||||
HStack(spacing: 5) {
|
||||
if let count = snapshot.gpu?.coreCount {
|
||||
Text(verbatim: String(format: AppLocalization.string("gpu.coreCountFormat", locale: locale), count))
|
||||
.foregroundStyle(.secondary)
|
||||
.foregroundStyle(.primary)
|
||||
}
|
||||
}.font(.system(size: 9)).lineLimit(1).minimumScaleFactor(0.75).frame(height: 12)
|
||||
}.font(.system(size: 10)).lineLimit(1).minimumScaleFactor(0.9).frame(height: 16)
|
||||
let fans = displayedFans
|
||||
if !fans.isEmpty {
|
||||
LazyVGrid(columns: Array(repeating: GridItem(.flexible(), spacing: 5, alignment: .leading), count: min(2, fans.count)), spacing: 2) {
|
||||
@@ -87,12 +87,12 @@ extension MenuPanelView {
|
||||
? (fan.id == 0 ? Text("gpu.fanLeft") : Text("gpu.fanRight"))
|
||||
: Text("gpu.fanNumber \(fan.id + 1)"), rpm: fan.rpm,
|
||||
isActive: metrics.isPanelVisible && !metrics.isPaused && !metrics.isSystemSleeping && !metrics.isDisplaySleeping)
|
||||
.frame(height: 12)
|
||||
.frame(height: 16)
|
||||
}
|
||||
}
|
||||
} else if snapshot.fans == nil {
|
||||
Text("metric.waiting").font(.system(size: 9))
|
||||
.frame(maxWidth: .infinity, alignment: .leading).frame(height: 12)
|
||||
Text("metric.waiting").font(.system(size: 10))
|
||||
.frame(maxWidth: .infinity, alignment: .leading).frame(height: 16)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,7 +122,7 @@ extension MenuPanelView {
|
||||
MemoryDetailsView(memory: memory)
|
||||
} else {
|
||||
Text("metric.waiting").foregroundStyle(.secondary)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -136,7 +136,7 @@ extension MenuPanelView {
|
||||
} ?? "--",
|
||||
headerAccessory: AnyView(Button { showVolumes.toggle() } label: {
|
||||
HStack(spacing: 2) { Text("disk.localVolumes"); Image(systemName: "chevron.right").font(.system(size: 7)) }
|
||||
}.font(.system(size: 9)).buttonStyle(.plain).help(Text("disk.viewDetails"))),
|
||||
}.font(.system(size: 10)).buttonStyle(.plain).help(Text("disk.viewDetails"))),
|
||||
chart: {
|
||||
PanelTrendChart(
|
||||
dates: samples.map(\.date), first: samples.map(\.read), second: samples.map(\.write), color: Color("MetricDisk"),
|
||||
@@ -159,7 +159,7 @@ extension MenuPanelView {
|
||||
"\(MetricFormat.bytes(volume.capacity.available)) / \(MetricFormat.bytes(volume.capacity.total))")
|
||||
}
|
||||
}
|
||||
Text("panel.apfsScope").font(.system(size: 9)).foregroundStyle(.secondary)
|
||||
Text("panel.apfsScope").font(.system(size: 10)).foregroundStyle(.secondary)
|
||||
}
|
||||
}.padding(12).frame(width: 330)
|
||||
.environment(\.locale, locale)
|
||||
@@ -191,17 +191,17 @@ extension MenuPanelView {
|
||||
}
|
||||
) {
|
||||
inlineMetric("battery.powerShort", MetricFormat.watts(snapshot.battery?.power))
|
||||
.frame(height: 12)
|
||||
.frame(height: 16)
|
||||
if let battery = snapshot.battery {
|
||||
batteryDetails(battery)
|
||||
} else {
|
||||
Text(snapshot.batteryState == .absent ? "panel.noBattery" : "panel.batteryFailed").foregroundStyle(.secondary)
|
||||
.font(.system(size: 9)).frame(maxWidth: .infinity).frame(height: 32)
|
||||
.font(.system(size: 10)).frame(maxWidth: .infinity).frame(height: 32)
|
||||
}
|
||||
}
|
||||
}
|
||||
private func batteryDetails(_ battery: BatteryMetrics) -> some View {
|
||||
VStack(alignment: .leading, spacing: 3) {
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
HStack(spacing: 8) {
|
||||
inlineMetric("battery.healthShort", MetricFormat.percent(battery.health))
|
||||
inlineMetric("battery.cyclesShort", battery.cycles.map(String.init) ?? "--")
|
||||
@@ -217,6 +217,6 @@ extension MenuPanelView {
|
||||
}
|
||||
}
|
||||
}
|
||||
.font(.system(size: 9)).lineLimit(1).minimumScaleFactor(0.75)
|
||||
.font(.system(size: 10)).lineLimit(1).minimumScaleFactor(0.9)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user