diff options
| author | Fuwn <[email protected]> | 2025-06-15 00:45:53 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-06-15 00:45:53 -0700 |
| commit | 8941deac5766609cbb0d039c8390afb2febae635 (patch) | |
| tree | 39db5f2c16793ef649a4070c8366bb576fee477e | |
| parent | feat: Development commit (diff) | |
| download | sora-testing-8941deac5766609cbb0d039c8390afb2febae635.tar.xz sora-testing-8941deac5766609cbb0d039c8390afb2febae635.zip | |
feat: Development commit
| -rw-r--r-- | Sora/Views/PlatformSpecificToolbarItem.swift | 14 | ||||
| -rw-r--r-- | Sora/Views/Post/Grid/PostGridView.swift | 20 |
2 files changed, 22 insertions, 12 deletions
diff --git a/Sora/Views/PlatformSpecificToolbarItem.swift b/Sora/Views/PlatformSpecificToolbarItem.swift index 7c2fb86..4a44db0 100644 --- a/Sora/Views/PlatformSpecificToolbarItem.swift +++ b/Sora/Views/PlatformSpecificToolbarItem.swift @@ -1,9 +1,19 @@ import SwiftUI struct PlatformSpecificToolbarItem<Content: View>: ToolbarContent { + let placement: ToolbarItemPlacement let content: () -> Content - init(@ViewBuilder content: @escaping () -> Content) { + init( + placement: ToolbarItemPlacement?, + @ViewBuilder content: @escaping () -> Content + ) { + #if os(macOS) + self.placement = .automatic + #else + self.placement = placement ?? .bottomBar + #endif + self.content = content } @@ -13,7 +23,7 @@ struct PlatformSpecificToolbarItem<Content: View>: ToolbarContent { content() } #else - ToolbarItem(placement: .bottomBar) { + ToolbarItem(placement: placement) { content() } #endif diff --git a/Sora/Views/Post/Grid/PostGridView.swift b/Sora/Views/Post/Grid/PostGridView.swift index dc65c7d..39cd7da 100644 --- a/Sora/Views/Post/Grid/PostGridView.swift +++ b/Sora/Views/Post/Grid/PostGridView.swift @@ -127,18 +127,23 @@ struct PostGridView: View { #endif #if !os(macOS) - ToolbarItem(placement: .bottomBar) { + ToolbarItem(placement: .secondaryAction) { Button(action: { Task { isSearchHistoryPresented.toggle() } }) { Label("Search History", systemImage: "clock.arrow.circlepath") } } if manager.isLoading || manager.isNavigatingHistory { - ToolbarItem { ProgressView() } + ToolbarItem(placement: .status) { ProgressView() } } #endif - PlatformSpecificToolbarItem { + PlatformSpecificToolbarItem(placement: .secondaryAction) { + PostGridBookmarkButtonView() + .disabled(manager.tags.isEmpty) + } + + PlatformSpecificToolbarItem(placement: .secondaryAction) { Button(action: { Task { manager.loadNextPage() } }) { Label( "Manually Load Next Page", @@ -148,19 +153,14 @@ struct PostGridView: View { .disabled(manager.isLoading || manager.endOfData) } - PlatformSpecificToolbarItem { - PostGridBookmarkButtonView() - .disabled(manager.tags.isEmpty) - } - - PlatformSpecificToolbarItem { + PlatformSpecificToolbarItem(placement: .navigation) { Button(action: { manager.goBackInHistory() }) { Label("Previous Search", systemImage: "chevron.left") } .disabled(!manager.canGoBackInHistory) } - PlatformSpecificToolbarItem { + PlatformSpecificToolbarItem(placement: .navigation) { Button(action: { manager.goForwardInHistory() }) { Label("Next Search", systemImage: "chevron.right") } |