refactor(ui): 精简重复及解释性悬浮提示
This commit is contained in:
@@ -245,3 +245,5 @@ MenuPanelView 主文件保留生命周期、布局和顶栏控制,资源卡片
|
||||
GPU 核心数格式文案按面板 SwiftUI locale 通过 AppLocalization 解析,与原生搜索框、状态菜单使用同一应用语言选择;三语词条审评及验证边界见 `docs/localization-review.md`。
|
||||
|
||||
AppKit 场景与面板的语言环境通过 UI 层 `AppLanguageScope` 注入:在 SwiftUI body 内观察 LanguagePreferences,避免在一次性的宿主构造闭包中固定 locale。设置容器的语言变化回调重建原生主菜单,保留当前设置页及进程搜索等视图状态。
|
||||
|
||||
悬浮提示收敛为操作用途、输入约束及精确数据读取。进程标题不再承载覆盖计数/采样语义说明,资源卡片不再接受 statusHelp;长篇指标解释及重复标签不通过 help 展示,图表数据悬浮层保持原有实现。
|
||||
|
||||
@@ -217,3 +217,9 @@ CPU 列移除进度条,保留一位小数数值。进程名称增加 15pt 图
|
||||
### 菜单栏图标交互修正
|
||||
|
||||
左右键动作分流,外部点击关闭路径排除状态按钮和右键菜单跟踪;右键按当前可见状态提供打开/隐藏、设置、退出。Debug 构建通过;PanelWindowChecks 检查连续切换、菜单项及动态标题、设置回调与隐藏。隔离副本可显示实际 NSPanel;原生 UI 工具未提供菜单栏图标入口,真实左右键事件、菜单视觉与退出点击未验证,需人工点击图标验收。
|
||||
|
||||
### 悬浮提示精简
|
||||
|
||||
全量检查 SwiftUI help、AppKit toolTip 和自定义悬浮内容。移除卡片标题/数值/地址的重复提示、进程标题的覆盖计数说明,以及 CPU 温度和负载、GPU 温度/流水线/驱动内存/统计窗口、磁盘容量/IO 范围、文件缓存、电池能耗排序等解释性提示;移除菜单栏品牌重复提示。指标实现及解释仍保留在源码与文档,未清理字符串表以免混入本地化修改。
|
||||
|
||||
保留顶部工具栏无文字按钮的操作提示、刷新间隔输入范围、CPU 单核身份与读数、图表时间点读数及原有数据明细交互;高温告警和读取受限等可见状态不变。公共 ResourceCard 删除 statusHelp 入参及重复数值回退。Debug 构建与调用点检查通过;未逐一实际悬停验收。
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -27,7 +27,7 @@ struct CardField<Content: View>: View {
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
Text(title).font(PanelStyle.label).foregroundStyle(.secondary).help(Text(title)).frame(height: 14)
|
||||
Text(title).font(PanelStyle.label).foregroundStyle(.secondary).frame(height: 14)
|
||||
content().font(PanelStyle.value).monospacedDigit().frame(height: 14)
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
@@ -81,7 +81,7 @@ struct CapacityField: View {
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
HStack(spacing: 3) {
|
||||
Circle().fill(color).frame(width: 4, height: 4)
|
||||
Text(title).font(PanelStyle.label).foregroundStyle(.secondary).help(Text(title))
|
||||
Text(title).font(PanelStyle.label).foregroundStyle(.secondary)
|
||||
}.frame(height: 14)
|
||||
AnimatedMetricText(value: value).font(PanelStyle.value).frame(height: 14)
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ struct ResourceCard<Content: View>: View {
|
||||
var secondaryValueColor: Color? = nil
|
||||
var status: String? = nil
|
||||
var statusWarning = false
|
||||
var statusHelp: Text? = nil
|
||||
var warningText: Text? = nil
|
||||
var detail: String? = nil
|
||||
@ViewBuilder var content: () -> Content
|
||||
@@ -30,7 +29,6 @@ struct ResourceCard<Content: View>: View {
|
||||
.foregroundStyle(statusWarning ? .red : color)
|
||||
.padding(.horizontal, 6).frame(height: 16)
|
||||
.background((statusWarning ? Color.red : color).opacity(0.14), in: Capsule())
|
||||
.help(statusHelp ?? Text(verbatim: status))
|
||||
if let warningText {
|
||||
warningText
|
||||
.font(.system(size: 10)).foregroundStyle(.red).lineLimit(1)
|
||||
|
||||
Reference in New Issue
Block a user