refactor(ui): 统一胶囊页签并将面板收窄至640点
This commit is contained in:
@@ -58,6 +58,7 @@ 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 {
|
||||
|
||||
@@ -88,7 +88,8 @@ extension MenuPanelView {
|
||||
thirdColor: Color("MemoryWired"), fourthColor: Color("MemoryCompressed"), fixedScale: Double(snapshot.memory?.total ?? 1),
|
||||
scaleLabel: MetricFormat.memory(snapshot.memory?.total), firstValueFormat: .memory, firstLabel: "gpu.totalUtilization",
|
||||
secondLabel: "memory.app", thirdLabel: "memory.wired", fourthLabel: "memory.compressed",
|
||||
expectedInterval: chartInterval, boundaryDates: chartBoundaries, intervals: chartIntervals)
|
||||
expectedInterval: chartInterval, boundaryDates: chartBoundaries, intervals: chartIntervals,
|
||||
showsLegendValues: cardContentWidth >= 340)
|
||||
if let memory = snapshot.memory {
|
||||
MemoryDetailsView(memory: memory)
|
||||
} else {
|
||||
@@ -184,7 +185,8 @@ extension MenuPanelView {
|
||||
Text("battery.timeEstimate").foregroundStyle(.secondary)
|
||||
Spacer(minLength: 4)
|
||||
if battery.externalPower {
|
||||
Text("battery.timeNotApplicable").font(PanelStyle.value)
|
||||
Text("battery.notApplicableShort").font(PanelStyle.value)
|
||||
.help(Text("battery.timeNotApplicable"))
|
||||
} else if let minutes = battery.minutesRemaining {
|
||||
MetricText(value: "\(minutes) min").font(PanelStyle.value)
|
||||
} else {
|
||||
|
||||
@@ -124,11 +124,9 @@ struct MenuPanelView: View {
|
||||
}
|
||||
|
||||
private var pagePicker: some View {
|
||||
Picker("panel.page", selection: Binding(get: { presentation.page }, set: { presentation.page = $0 })) {
|
||||
Text("panel.overview").tag(PanelPage.overview)
|
||||
Text("panel.processes").tag(PanelPage.processes)
|
||||
}
|
||||
.pickerStyle(.segmented).labelsHidden().frame(width: 164)
|
||||
NeutralTabPicker(title: "panel.page", selection: Binding(get: { presentation.page }, set: { presentation.page = $0 }),
|
||||
options: [(.overview, "panel.overview"), (.processes, "panel.processes")])
|
||||
.frame(width: 164)
|
||||
.accessibilityIdentifier("panel.tabs")
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import CoreGraphics
|
||||
nonisolated enum PanelLayout {
|
||||
static let baseCardHeight: CGFloat = 204
|
||||
static func headerHeight(width: CGFloat) -> CGFloat { width >= 840 ? 32 : 64 }
|
||||
static func columns(width: CGFloat) -> Int { width >= 680 ? 2 : 1 }
|
||||
static func columns(width: CGFloat) -> Int { width >= 560 ? 2 : 1 }
|
||||
static func cardWidth(size: CGSize) -> CGFloat {
|
||||
let count = columns(width: size.width)
|
||||
return max(0, (size.width - 20 - CGFloat(count - 1) * 8) / CGFloat(count))
|
||||
@@ -28,7 +28,7 @@ nonisolated enum PanelLayout {
|
||||
}
|
||||
|
||||
static func contentSize(visible: CGRect, chrome: CGSize = .zero) -> CGSize {
|
||||
CGSize(width: max(1, min(960, visible.width - 32 - max(0, chrome.width))),
|
||||
CGSize(width: max(1, min(640, visible.width - 32 - max(0, chrome.width))),
|
||||
height: max(1, min(800, visible.height - 32 - max(0, chrome.height))))
|
||||
}
|
||||
static func centeredFrame(_ frame: CGRect, visible: CGRect) -> CGRect {
|
||||
|
||||
@@ -20,12 +20,8 @@ struct AppearanceSettingsView: View {
|
||||
.padding(12)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .principal) {
|
||||
Picker("settings.title", selection: $selection) {
|
||||
Text("settings.general").tag(SettingsPage.general)
|
||||
Text("settings.about").tag(SettingsPage.about)
|
||||
}
|
||||
.pickerStyle(.segmented)
|
||||
.labelsHidden()
|
||||
NeutralTabPicker(title: "settings.title", selection: $selection,
|
||||
options: [(.general, "settings.general"), (.about, "settings.about")])
|
||||
}
|
||||
}
|
||||
.background(SettingsWindowLifecycle(title: AppLocalization.string("settings.title", locale: locale),
|
||||
|
||||
Reference in New Issue
Block a user