diff options
| author | Fuwn <[email protected]> | 2025-02-25 17:17:40 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-02-25 17:17:40 -0800 |
| commit | 398eff7fbcda4145421f8e6adc7c789ec181f00e (patch) | |
| tree | 080fb9b2793c29140c7f441551612acdd8b28ed0 | |
| parent | feat: Development commit (diff) | |
| download | sora-testing-398eff7fbcda4145421f8e6adc7c789ec181f00e.tar.xz sora-testing-398eff7fbcda4145421f8e6adc7c789ec181f00e.zip | |
feat: Development commit
| -rw-r--r-- | Sora/Views/ContentView.swift | 10 | ||||
| -rw-r--r-- | Sora/Views/Post/Grid/PostGridView.swift | 32 |
2 files changed, 23 insertions, 19 deletions
diff --git a/Sora/Views/ContentView.swift b/Sora/Views/ContentView.swift index 8613e56..5c19f37 100644 --- a/Sora/Views/ContentView.swift +++ b/Sora/Views/ContentView.swift @@ -45,6 +45,16 @@ struct ContentView: View { #else NavigationStack { PostGridView() + .navigationDestination( + isPresented: Binding( + get: { manager.selectedPost != nil }, + set: { if !$0 { manager.selectedPost = nil } } + ) + ) { + if let post = manager.selectedPost { + PostDetailsView(post: post) + } + } } #endif } diff --git a/Sora/Views/Post/Grid/PostGridView.swift b/Sora/Views/Post/Grid/PostGridView.swift index 9e8edd6..5f8611a 100644 --- a/Sora/Views/Post/Grid/PostGridView.swift +++ b/Sora/Views/Post/Grid/PostGridView.swift @@ -22,25 +22,19 @@ struct PostGridView: View { } WaterfallGrid(filteredPosts, id: \.id) { post in - Group { - #if os(macOS) - Button { - manager.selectedPost = post - } label: { - PostGridThumbnailView( - post: post, - posts: filteredPosts - ) - } - .buttonStyle(PlainButtonStyle()) - #else - NavigationLink(value: post) { - PostGridThumbnailView( - post: post, - posts: filteredPosts - ) - } - #endif + Button { + manager.selectedPost = post + } label: { + PostGridThumbnailView( + post: post, + posts: filteredPosts + ) + } + .buttonStyle(PlainButtonStyle()) + .contextMenu { + Button(action: { manager.selectedPost = post }) { + Label("Select Post", systemImage: "arrow.right.circle") + } } } .gridStyle(columns: settings.columns) |