refactor(ui): 精简重复及解释性悬浮提示

This commit is contained in:
2026-11-03 20:46:58 +08:00
parent 7109d483b6
commit 418fc360c6
11 changed files with 19 additions and 21 deletions
@@ -15,12 +15,12 @@ struct GPUStatisticsView: View {
VStack(spacing: 5) {
memoryRow("gpu.driverMemory", bytes: inUse, color: Color("MetricMemory"))
memoryRow("gpu.allocatedMemory", bytes: allocated, color: Color("MetricNetwork"))
}.frame(maxWidth: .infinity).help(Text("gpu.memoryComparisonHelp"))
}.frame(maxWidth: .infinity)
Divider()
HStack(spacing: 6) {
MetricRingGauge(title: "gpu.recentAverage", value: average, color: Color("MetricCPU"))
MetricRingGauge(title: "gpu.peak", value: peak, color: Color("MetricGPU"))
}.frame(maxWidth: .infinity).help(Text("gpu.summaryHelp"))
}.frame(maxWidth: .infinity)
}.frame(height: 46)
}
@@ -23,7 +23,7 @@ struct MemoryDetailsView: View {
Divider().frame(height: 32)
CardField(title: "memory.cached") {
AnimatedMetricText(value: MetricFormat.memory(memory.cached))
}.help(Text("memory.cachedHelp"))
}
Divider().frame(height: 32)
CardField(title: "memory.swap") {
AnimatedMetricText(value: MetricFormat.memory(memory.swapUsed))
@@ -43,7 +43,6 @@ import Observation
let item = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength)
item.button?.image = NSImage(named: "BrandMark")
item.button?.image?.isTemplate = true
item.button?.toolTip = "Kymo"
item.button?.setAccessibilityLabel("Kymo")
item.button?.target = self
item.button?.action = #selector(statusItemClicked)
@@ -67,7 +67,6 @@ extension MenuPanelView {
HStack(spacing: 4) {
Text(title).foregroundStyle(.secondary)
Text(verbatim: address ?? "--").font(PanelStyle.value).monospacedDigit().textSelection(.enabled)
.help(Text(verbatim: address ?? "--"))
Spacer(minLength: 0)
if let address {
Button {
@@ -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)
}
@@ -86,7 +86,6 @@ struct ProcessTableView: View {
private var processTitle: some View {
Label("panel.processes", systemImage: "list.bullet.rectangle")
.font(PanelStyle.title)
.help(Text("\(Text("panel.processScope"))\n\(Text("panel.coverage"))\n\(snapshot?.readable ?? 0) / \(snapshot?.enumerated ?? 0) · \(rows.count)"))
}
private var searchField: some View {
NativeSearchField(text: $search, isFocused: $searchFocused,
@@ -11,7 +11,6 @@ struct StorageDetailsView: View {
CardSeparator()
CardSectionHeader(title: "disk.distribution", valueLabel: "disk.utilization",
value: MetricFormat.percent(disk?.usage), color: color)
.help(Text("disk.capacityScope"))
CapacityBar(values: [Double(disk.map { $0.total - min($0.total, $0.available) } ?? 0), Double(disk?.available ?? 0)],
colors: [color, Color("MemoryAvailable")], total: Double(disk?.total ?? 1))
HStack(spacing: 4) {