summaryrefslogtreecommitdiff
path: root/Sora/Views/Post/Grid/PostGridView.swift
diff options
context:
space:
mode:
authorFuwn <[email protected]>2025-03-15 20:37:05 -0700
committerFuwn <[email protected]>2025-03-15 20:37:05 -0700
commit8eae995c5bf475b2e40a807dbdf8927dbd993222 (patch)
tree9d89f0e2c3f5f856429312cebd1cde9bb107cc55 /Sora/Views/Post/Grid/PostGridView.swift
parentfeat: Development commit (diff)
downloadsora-testing-8eae995c5bf475b2e40a807dbdf8927dbd993222.tar.xz
sora-testing-8eae995c5bf475b2e40a807dbdf8927dbd993222.zip
feat: Development commit
Diffstat (limited to 'Sora/Views/Post/Grid/PostGridView.swift')
-rw-r--r--Sora/Views/Post/Grid/PostGridView.swift93
1 files changed, 25 insertions, 68 deletions
diff --git a/Sora/Views/Post/Grid/PostGridView.swift b/Sora/Views/Post/Grid/PostGridView.swift
index ebf262b..21605e6 100644
--- a/Sora/Views/Post/Grid/PostGridView.swift
+++ b/Sora/Views/Post/Grid/PostGridView.swift
@@ -63,38 +63,14 @@ struct PostGridView: View {
}
#endif
- #if os(macOS)
- ToolbarItem {
- Button(action: { Task { manager.loadNextPage() } }) {
- Label(
- "Manually Load Next Page",
- systemImage: "arrow.down.to.line"
- )
- }
- .disabled(manager.isLoading)
- }
- #else
+ #if !os(macOS)
ToolbarItem(placement: .bottomBar) {
Button(action: { Task { isSearchHistoryPresented.toggle() } }) {
Label("Search History", systemImage: "clock.arrow.circlepath")
}
}
- ToolbarItem(placement: .bottomBar) {
- Button(action: { Task { manager.loadNextPage() } }) {
- Label(
- "Manually Load Next Page",
- systemImage: "arrow.down.to.line"
- )
- }
- .disabled(manager.isLoading)
- }
-
- if manager.isLoading {
- ToolbarItem {
- ProgressView()
- }
- }
+ if manager.isLoading { ToolbarItem { ProgressView() } }
#if DEBUG
if manager.historyIndex < manager.searchHistory.count {
@@ -105,52 +81,33 @@ struct PostGridView: View {
#endif
#endif
- if !manager.tags.isEmpty {
- #if os(macOS)
- ToolbarItem { PostGridBookmarkButtonView() }
- #else
- ToolbarItem(placement: .bottomBar) { PostGridBookmarkButtonView() }
- #endif
+ PlatformSpecificToolbarItem {
+ Button(action: { Task { manager.loadNextPage() } }) {
+ Label(
+ "Manually Load Next Page",
+ systemImage: "arrow.down.to.line"
+ )
+ }
+ .disabled(manager.isLoading)
}
- if manager.historyIndex > 0 {
- #if os(macOS)
- ToolbarItem {
- Button(action: {
- manager.goBackInHistory()
- }) {
- Label("Previous Search", systemImage: "chevron.left")
- }
- }
- #else
- ToolbarItem(placement: .bottomBar) {
- Button(action: {
- manager.goBackInHistory()
- }) {
- Label("Previous Search", systemImage: "chevron.left")
- }
- }
- #endif
+ PlatformSpecificToolbarItem {
+ PostGridBookmarkButtonView()
+ .disabled(manager.tags.isEmpty)
}
- if manager.historyIndex < manager.searchHistory.count - 1 {
- #if os(macOS)
- ToolbarItem {
- Button(action: {
- manager.goForwardInHistory()
- }) {
- Label("Next Search", systemImage: "chevron.right")
- }
- }
- #else
- ToolbarItem(placement: .bottomBar) {
- Button(action: {
- manager.goForwardInHistory()
- }) {
- Label("Next Search", systemImage: "chevron.right")
- }
- }
- #endif
+ PlatformSpecificToolbarItem {
+ Button(action: { manager.goBackInHistory() }) {
+ Label("Previous Search", systemImage: "chevron.left")
+ }
+ .disabled(!(manager.historyIndex > 0))
+ }
+
+ PlatformSpecificToolbarItem {
+ Button(action: { manager.goForwardInHistory() }) {
+ Label("Next Search", systemImage: "chevron.right")
+ }
+ .disabled(!(manager.historyIndex < manager.searchHistory.count - 1))
}
}
.navigationTitle("Posts")