diff options
| author | Fuwn <[email protected]> | 2025-02-26 21:12:05 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-02-26 21:12:05 -0800 |
| commit | 0bfca77163ee472883c848292ce0b0afed26043a (patch) | |
| tree | 0d8c1167231d84e5fdf1798ca9f7b8461469a9fc /Sora/Views | |
| parent | feat: Development commit (diff) | |
| download | sora-testing-0bfca77163ee472883c848292ce0b0afed26043a.tar.xz sora-testing-0bfca77163ee472883c848292ce0b0afed26043a.zip | |
feat: Development commit
Diffstat (limited to 'Sora/Views')
| -rw-r--r-- | Sora/Views/MainView.swift | 8 | ||||
| -rw-r--r-- | Sora/Views/Post/Grid/PostGridView.swift | 29 |
2 files changed, 23 insertions, 14 deletions
diff --git a/Sora/Views/MainView.swift b/Sora/Views/MainView.swift index 3397f15..2e1ab2e 100644 --- a/Sora/Views/MainView.swift +++ b/Sora/Views/MainView.swift @@ -83,3 +83,11 @@ struct MainView: View { } } } + +#Preview { + MainView() + .environmentObject(Settings()) + #if os(macOS) + .frame(width: 736, height: 736) + #endif +} diff --git a/Sora/Views/Post/Grid/PostGridView.swift b/Sora/Views/Post/Grid/PostGridView.swift index eb71ee6..58895c2 100644 --- a/Sora/Views/Post/Grid/PostGridView.swift +++ b/Sora/Views/Post/Grid/PostGridView.swift @@ -22,20 +22,7 @@ struct PostGridView: View { } WaterfallGrid(filteredPosts, id: \.id) { post in - 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") - } - } + waterfallGridContent(post: post) } .gridStyle(columns: settings.columns) .padding(8) @@ -102,4 +89,18 @@ struct PostGridView: View { } } } + + private func waterfallGridContent(post: BooruPost) -> some View { + 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") + } + } + } } |