Move the Mac toolbar buttons to the window toolbar
Sidebar-column toolbar items are confined to the sidebar's narrow section of the unified toolbar and collapse into overflow; attaching New Routine and Starter Gallery to the split view gives them the full trailing section.
This commit is contained in:
@@ -30,7 +30,7 @@ private struct PendingRoutineEdit: Identifiable {
|
|||||||
/// Root content once iCloud is available: a Mac-native `NavigationSplitView` shell.
|
/// Root content once iCloud is available: a Mac-native `NavigationSplitView` shell.
|
||||||
/// The sidebar lists the two Library destinations plus every routine (reorderable,
|
/// The sidebar lists the two Library destinations plus every routine (reorderable,
|
||||||
/// with a per-row context menu); the detail column swaps on selection. New Routine
|
/// with a per-row context menu); the detail column swaps on selection. New Routine
|
||||||
/// and the Starter Gallery are surfaced as sheets from the sidebar toolbar.
|
/// and the Starter Gallery are surfaced as sheets from the window toolbar.
|
||||||
struct MacContentView: View {
|
struct MacContentView: View {
|
||||||
@Environment(SyncEngine.self) private var syncEngine
|
@Environment(SyncEngine.self) private var syncEngine
|
||||||
|
|
||||||
@@ -50,6 +50,27 @@ struct MacContentView: View {
|
|||||||
} detail: {
|
} detail: {
|
||||||
detail
|
detail
|
||||||
}
|
}
|
||||||
|
// Attached to the split view, not the sidebar List: sidebar-column toolbar
|
||||||
|
// items are confined to the sidebar's (narrow) section of the unified
|
||||||
|
// toolbar and collapse into the overflow menu. Here they get the full
|
||||||
|
// trailing section instead.
|
||||||
|
.toolbar {
|
||||||
|
ToolbarItemGroup(placement: .primaryAction) {
|
||||||
|
Button {
|
||||||
|
showingNewRoutine = true
|
||||||
|
} label: {
|
||||||
|
Label("New Routine", systemImage: "plus")
|
||||||
|
}
|
||||||
|
.help("New Routine")
|
||||||
|
|
||||||
|
Button {
|
||||||
|
showingStarterGallery = true
|
||||||
|
} label: {
|
||||||
|
Label("Starter Gallery", systemImage: "sparkles")
|
||||||
|
}
|
||||||
|
.help("Browse Starter Routines")
|
||||||
|
}
|
||||||
|
}
|
||||||
.sheet(isPresented: $showingNewRoutine) {
|
.sheet(isPresented: $showingNewRoutine) {
|
||||||
MacRoutineEditorSheet(routine: nil)
|
MacRoutineEditorSheet(routine: nil)
|
||||||
}
|
}
|
||||||
@@ -121,23 +142,6 @@ struct MacContentView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.navigationTitle("Workouts")
|
.navigationTitle("Workouts")
|
||||||
.toolbar {
|
|
||||||
ToolbarItemGroup {
|
|
||||||
Button {
|
|
||||||
showingNewRoutine = true
|
|
||||||
} label: {
|
|
||||||
Label("New Routine", systemImage: "plus")
|
|
||||||
}
|
|
||||||
.help("New Routine")
|
|
||||||
|
|
||||||
Button {
|
|
||||||
showingStarterGallery = true
|
|
||||||
} label: {
|
|
||||||
Label("Starter Gallery", systemImage: "sparkles")
|
|
||||||
}
|
|
||||||
.help("Browse Starter Routines")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Detail
|
// MARK: - Detail
|
||||||
|
|||||||
Reference in New Issue
Block a user