mirror of
https://github.com/yattee/yattee.git
synced 2026-07-21 06:42:01 +00:00
Pin view options button to leading toolbar edge on macOS
Place the view options control on the leading (`.navigation`) edge on macOS so it is consistently the first/leftmost toolbar button across all views, instead of sitting on the right next to the search field in search views and on the left in non-search views. Each affected view gains a computed `viewOptionsPlacement` (`.navigation` on macOS, `.primaryAction` elsewhere) so iOS/iPadOS/tvOS keep the button trailing. Search-style views (Search, InstanceBrowse) declare the view options item first so it renders left of the search-filters button; their flexible spacer is kept to right-pin the search field. Channel's fixed spacer between view options and the channel menu is now iOS-only.
This commit is contained in:
@@ -27,6 +27,15 @@ struct DownloadsView: View {
|
||||
appEnvironment?.settingsManager.listStyle ?? .inset
|
||||
}
|
||||
|
||||
/// View options control lives on the leading edge on macOS, trailing elsewhere.
|
||||
private var viewOptionsPlacement: ToolbarItemPlacement {
|
||||
#if os(macOS)
|
||||
.navigation
|
||||
#else
|
||||
.primaryAction
|
||||
#endif
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
Group {
|
||||
if let manager = downloadManager, let settings = downloadSettings {
|
||||
@@ -45,7 +54,7 @@ struct DownloadsView: View {
|
||||
ToolbarSpacer(.flexible, placement: .primaryAction)
|
||||
}
|
||||
#endif
|
||||
ToolbarItem(placement: .primaryAction) {
|
||||
ToolbarItem(placement: viewOptionsPlacement) {
|
||||
if let settings = downloadSettings {
|
||||
sortAndGroupMenu(settings)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user