From 398eff7fbcda4145421f8e6adc7c789ec181f00e Mon Sep 17 00:00:00 2001 From: Fuwn Date: Tue, 25 Feb 2025 17:17:40 -0800 Subject: feat: Development commit --- Sora/Views/ContentView.swift | 10 ++++++++++ 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) -- cgit v1.2.3