Pin search bar to right of macOS toolbar in list views

Match the global Search view by pinning the searchable field and
trailing buttons to the right edge on macOS 26 via a flexible
ToolbarSpacer at .primaryAction. Applied to History, Bookmarks,
Manage Channels, Downloads, Instance Browse, and PeerTube Explore.

In History, the clear-history item moves from .automatic to
.primaryAction so it groups with the other trailing controls.
This commit is contained in:
Arkadiusz Fal
2026-06-12 09:54:24 +02:00
parent d7df883d6f
commit 7ecd408f89
6 changed files with 43 additions and 1 deletions

View File

@@ -38,6 +38,13 @@ struct DownloadsView: View {
.navigationTitle(String(localized: "downloads.title"))
.toolbarTitleDisplayMode(.inlineLarge)
.toolbar {
#if os(macOS)
// Pin the trailing group (search field + toolbar buttons) to the right edge,
// matching the global Search view.
if #available(macOS 26, *) {
ToolbarSpacer(.flexible, placement: .primaryAction)
}
#endif
ToolbarItem(placement: .primaryAction) {
if let settings = downloadSettings {
sortAndGroupMenu(settings)

View File

@@ -153,6 +153,13 @@ struct BookmarksListView: View {
.toolbarTitleDisplayMode(.inlineLarge)
.searchable(text: $searchText, prompt: Text(String(localized: "bookmarks.search.placeholder")))
.toolbar {
#if os(macOS)
// Pin the trailing group (search field + toolbar buttons) to the right edge,
// matching the global Search view.
if #available(macOS 26, *) {
ToolbarSpacer(.flexible, placement: .primaryAction)
}
#endif
ToolbarItem(placement: .primaryAction) {
Button {
showViewOptions = true

View File

@@ -167,6 +167,13 @@ struct HistoryListView: View {
.toolbarTitleDisplayMode(.inlineLarge)
.searchable(text: $searchText, prompt: Text(String(localized: "history.search.placeholder")))
.toolbar {
#if os(macOS)
// Pin the trailing group (search field + toolbar buttons) to the right edge,
// matching the global Search view.
if #available(macOS 26, *) {
ToolbarSpacer(.flexible, placement: .primaryAction)
}
#endif
// View options button (always visible)
ToolbarItem(placement: .primaryAction) {
Button {
@@ -184,7 +191,7 @@ struct HistoryListView: View {
// Clear history menu (only when not empty)
if !history.isEmpty {
ToolbarItem(placement: .automatic) {
ToolbarItem(placement: .primaryAction) {
Menu {
ForEach(ClearHistoryOption.allCases, id: \.self) { option in
Button(role: .destructive) {

View File

@@ -340,6 +340,13 @@ struct InstanceBrowseView: View {
.navigationTitle(instance.displayName)
.toolbarTitleDisplayMode(.inlineLarge)
.toolbar {
#if os(macOS)
// Pin the trailing group (search field + toolbar buttons) to the right edge,
// matching the global Search view.
if #available(macOS 26, *) {
ToolbarSpacer(.flexible, placement: .primaryAction)
}
#endif
ToolbarItem(placement: .primaryAction) {
Button {
showViewOptions = true

View File

@@ -224,6 +224,13 @@ struct PeerTubeInstancesExploreView: View {
sheetCloseToolbarItem { dismiss() }
#endif
#if os(macOS)
// Pin the trailing group (search field + toolbar buttons) to the right edge,
// matching the global Search view.
if #available(macOS 26, *) {
ToolbarSpacer(.flexible, placement: .primaryAction)
}
#endif
ToolbarItem(placement: .primaryAction) {
Button {
showFiltersSheet = true

View File

@@ -191,6 +191,13 @@ struct ManageChannelsView: View {
.toolbarTitleDisplayMode(.inlineLarge)
.searchable(text: $searchText, prompt: Text(String(localized: "channels.search.placeholder")))
.toolbar {
#if os(macOS)
// Pin the trailing group (search field + toolbar buttons) to the right edge,
// matching the global Search view.
if #available(macOS 26, *) {
ToolbarSpacer(.flexible, placement: .primaryAction)
}
#endif
ToolbarItem(placement: .primaryAction) {
Button {
showViewOptions = true