fix(memory): 对齐概念图配色与底栏排版
This commit is contained in:
@@ -3,7 +3,7 @@ import SwiftUI
|
||||
struct MemoryDetailsView: View {
|
||||
let memory: MemoryMetrics
|
||||
@Environment(\.accessibilityReduceMotion) private var reduceMotion
|
||||
private var colors: [Color] { [Color("MetricMemory"), Color("MetricNetwork"), Color("MetricDisk"), .secondary.opacity(0.25)] }
|
||||
private var colors: [Color] { [Color("MemoryApplication"), Color("MemoryWired"), Color("MemoryCompressed"), Color("MemoryAvailable")] }
|
||||
private var values: [UInt64] { [memory.app, memory.wired, memory.compressed, memory.available] }
|
||||
private let labels: [LocalizedStringKey] = ["memory.app", "memory.wired", "memory.compressed", "memory.available"]
|
||||
|
||||
@@ -13,8 +13,8 @@ struct MemoryDetailsView: View {
|
||||
HStack {
|
||||
Text("memory.distribution").fontWeight(.semibold)
|
||||
Spacer()
|
||||
Text("panel.total").foregroundStyle(.secondary)
|
||||
AnimatedMetricText(value: MetricFormat.percent(memory.usage)).foregroundStyle(Color("MetricMemory"))
|
||||
Text("gpu.totalUtilization").foregroundStyle(.secondary)
|
||||
AnimatedMetricText(value: MetricFormat.percent(memory.usage)).foregroundStyle(Color("MemoryApplication"))
|
||||
}
|
||||
GeometryReader { proxy in
|
||||
HStack(spacing: 0) {
|
||||
@@ -45,11 +45,13 @@ struct MemoryDetailsView: View {
|
||||
Text("memory.pressure").foregroundStyle(.secondary)
|
||||
pressure
|
||||
}.frame(maxWidth: .infinity, alignment: .leading)
|
||||
Divider().frame(height: 30)
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
Text("memory.cached").foregroundStyle(.secondary)
|
||||
AnimatedMetricText(value: MetricFormat.memory(memory.cached))
|
||||
}.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.help(Text("memory.cachedHelp"))
|
||||
Divider().frame(height: 30)
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
Text("memory.swap").foregroundStyle(.secondary)
|
||||
AnimatedMetricText(value: MetricFormat.memory(memory.swapUsed))
|
||||
|
||||
@@ -231,12 +231,12 @@ struct MenuPanelView: View {
|
||||
}.font(.system(size: 10)).help(Text("gpu.pipelineHelp"))
|
||||
}
|
||||
private var memoryCard: some View {
|
||||
ResourceCard(title: "metric.memory", symbol: "memorychip", color: Color("MetricMemory"),
|
||||
ResourceCard(title: "metric.memory", symbol: "memorychip", color: Color("MemoryApplication"),
|
||||
value: snapshot.memory.map { String(format: "%.1f / %.0f GiB", Double($0.used) / 1_073_741_824, Double($0.total) / 1_073_741_824) } ?? "--") {
|
||||
PanelTrendChart(dates: samples.map(\.date),
|
||||
first: samples.map { $0.memory.map { $0 * Double(snapshot.memory?.total ?? 1) } },
|
||||
color: Color("MetricMemory"), fixedScale: Double(snapshot.memory?.total ?? 1),
|
||||
scaleLabel: MetricFormat.memory(snapshot.memory?.total), firstValueFormat: .memory,
|
||||
color: Color("MemoryApplication"), fixedScale: Double(snapshot.memory?.total ?? 1),
|
||||
scaleLabel: MetricFormat.memory(snapshot.memory?.total), firstValueFormat: .memory, firstLabel: "gpu.totalUtilization",
|
||||
expectedInterval: chartInterval, boundaryDates: chartBoundaries, intervals: chartIntervals)
|
||||
if let memory = snapshot.memory {
|
||||
MemoryDetailsView(memory: memory)
|
||||
|
||||
Reference in New Issue
Block a user