refactor(ui): 精简重复及解释性悬浮提示
This commit is contained in:
@@ -24,7 +24,6 @@ extension MenuPanelView {
|
||||
value: MetricFormat.percent(snapshot.cpu?.usage),
|
||||
status: temperature.map { "\(Int($0.rounded()))°C" },
|
||||
statusWarning: highTemperature,
|
||||
statusHelp: temperature == nil ? nil : Text("cpu.temperature.help", tableName: "CPUDetails"),
|
||||
warningText: highTemperature ? Text("cpu.temperature.high", tableName: "CPUDetails") : nil
|
||||
) {
|
||||
PanelTrendChart(
|
||||
@@ -57,7 +56,7 @@ extension MenuPanelView {
|
||||
value: (snapshot.load.first ?? 0) / Double(max(1, snapshot.cpu?.cores.count ?? 0)), color: Color("MetricCPU")
|
||||
)
|
||||
.frame(height: 5).accessibilityHidden(true)
|
||||
}.frame(maxWidth: .infinity).help(Text("cpu.load.help", tableName: "CPUDetails"))
|
||||
}.frame(maxWidth: .infinity)
|
||||
Rectangle().fill(.primary.opacity(0.08)).frame(width: 1, height: 25)
|
||||
VStack(alignment: .leading, spacing: 3) {
|
||||
Text("panel.uptime").foregroundStyle(.secondary)
|
||||
@@ -73,7 +72,6 @@ extension MenuPanelView {
|
||||
return ResourceCard(
|
||||
title: "metric.gpu", symbol: "square.grid.2x2", color: Color("MetricGPU"), value: MetricFormat.percent(snapshot.gpuUsage),
|
||||
status: snapshot.gpuTemperature.map { "\(Int($0.rounded()))°C" },
|
||||
statusHelp: Text("gpu.temperatureHelp"),
|
||||
detail: snapshot.gpu?.coreCount.map { String(format: AppLocalization.string("gpu.coreCountFormat", locale: locale), $0) }
|
||||
) {
|
||||
PanelTrendChart(
|
||||
@@ -91,7 +89,6 @@ extension MenuPanelView {
|
||||
inUse: snapshot.gpu?.inUseMemory, allocated: snapshot.gpu?.allocatedMemory,
|
||||
average: summary.average, peak: summary.peak
|
||||
)
|
||||
.help(snapshot.gpuUsage == nil ? Text("gpu.unavailable") : Text("gpu.summaryHelp"))
|
||||
Spacer(minLength: 0)
|
||||
let fans = displayedFans
|
||||
if !fans.isEmpty {
|
||||
@@ -110,11 +107,11 @@ extension MenuPanelView {
|
||||
|
||||
func gpuActivity(_ title: LocalizedStringKey, value: Double?, color: Color) -> some View {
|
||||
HStack(spacing: 8) {
|
||||
Text(title).font(PanelStyle.label).frame(width: 100, alignment: .leading).help(Text(title))
|
||||
Text(title).font(PanelStyle.label).frame(width: 100, alignment: .leading)
|
||||
MetricProgressBar(value: value ?? 0, color: color).frame(height: 5)
|
||||
.animation(reduceMotion ? nil : .easeInOut(duration: min(0.35, chartInterval * 0.8)), value: value)
|
||||
AnimatedMetricText(value: MetricFormat.percent(value)).font(PanelStyle.value).frame(width: 30, alignment: .trailing)
|
||||
}.font(PanelStyle.label).help(Text("gpu.pipelineHelp"))
|
||||
}.font(PanelStyle.label)
|
||||
}
|
||||
var memoryCard: some View {
|
||||
ResourceCard(
|
||||
@@ -156,7 +153,7 @@ extension MenuPanelView {
|
||||
secondColor: Color("MetricNetwork"), fixedScale: nil, firstLabel: "disk.read", secondLabel: "disk.write",
|
||||
expectedInterval: chartInterval, boundaryDates: chartBoundaries, intervals: chartIntervals
|
||||
)
|
||||
.help(Text("disk.physicalIO"))
|
||||
|
||||
StorageDetailsView(disk: snapshot.disk, health: snapshot.diskHealth) {
|
||||
showVolumes.toggle()
|
||||
}
|
||||
@@ -224,10 +221,10 @@ extension MenuPanelView {
|
||||
VStack(spacing: 4) {
|
||||
line("battery.cycles", battery.cycles.map(String.init) ?? "--")
|
||||
HStack {
|
||||
Text("battery.timeEstimate").foregroundStyle(.secondary).help(Text("battery.timeEstimate"))
|
||||
Text("battery.timeEstimate").foregroundStyle(.secondary)
|
||||
Spacer(minLength: 4)
|
||||
if battery.externalPower {
|
||||
Text("battery.timeNotApplicable").font(PanelStyle.value).help(Text("battery.timeNotApplicable"))
|
||||
Text("battery.timeNotApplicable").font(PanelStyle.value)
|
||||
} else if let minutes = battery.minutesRemaining {
|
||||
AnimatedMetricText(value: "\(minutes) min").font(PanelStyle.value)
|
||||
} else {
|
||||
@@ -260,7 +257,6 @@ extension MenuPanelView {
|
||||
// Reserve the header and all three rows before process sampling completes.
|
||||
.frame(height: 74, alignment: .top)
|
||||
.lineLimit(1)
|
||||
.help(Text("battery.energyProxyHelp"))
|
||||
|
||||
}.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user