Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import SwiftUI
@MainActor
struct SettingsSectionSlot<Content: View>: View {
let section: SettingsSectionID
/// Only the selected pane is part of the hierarchy. Keeping inactive
/// sections out avoids constructing all settings controls at window open
/// and gives the window true one-pane-at-a-time behavior.
let isActive: Bool
let isMounted: Bool
/// `false` renders nothing while unmounted, for sections that hide
/// themselves entirely (Cloud before it is available).
Expand All @@ -23,12 +27,18 @@ struct SettingsSectionSlot<Content: View>: View {
var body: some View {
// The same spacing as the enclosing detail stack, so a section's
// header and cards sit exactly where the flat stack put them.
VStack(alignment: .leading, spacing: 14) {
if isMounted {
content()
.onAppear { onMountedAppear() }
} else if showsPlaceholder {
SettingsSectionPlaceholder(section: section)
Group {
if isActive {
VStack(alignment: .leading, spacing: 14) {
if isMounted {
content()
.onAppear { onMountedAppear() }
} else if showsPlaceholder {
SettingsSectionPlaceholder(section: section)
}
}
} else {
EmptyView()
}
}
.id("section:\(section.rawValue)")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ extension SettingsWindowRoot {
) -> some View {
SettingsSectionSlot(
section: section,
isActive: section == selectedSection,
isMounted: mountModel.isMounted(section),
showsPlaceholder: section != .cloudMachines || isCloudSectionAvailable,
onMountedAppear: { sectionContentDidAppear(section, proxy: proxy) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ public struct SettingsWindowRoot: View {
.onReceive(NotificationCenter.default.publisher(for: Self.navigationRequestName)) { notification in
applyScrollNavigation(notification, proxy: proxy)
}
.navigationTitle(selectedSection.title)
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions Sources/App/SettingsWindowFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ enum SettingsWindowFactory {
// the defaults is what produced the #8015 hybrid chrome.
window.styleMask = [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView]
window.title = String(localized: "settings.title", defaultValue: "Settings")
// Settings panes are not document windows: HIG guidance keeps the
// minimize and zoom controls visible but unavailable.
window.standardWindowButton(.miniaturizeButton)?.isEnabled = false
window.standardWindowButton(.zoomButton)?.isEnabled = false
// [flexible space, sidebar toggle, sidebar tracking separator] is the
// exact item layout the SwiftUI-owned 0.64.17 window built for its
// NavigationSplitView: the toggle sits at the sidebar's trailing edge
Expand Down
Loading