diff options
| author | Dustin Mierau <dustin@mierau.me> | 2024-05-14 18:12:56 -0700 |
|---|---|---|
| committer | Dustin Mierau <dustin@mierau.me> | 2024-05-14 18:12:56 -0700 |
| commit | ac3c8f540751e4138319d9e4e7ffb92a9b2236e2 (patch) | |
| tree | 53df968f49e74223153c61e7a287f0d99faeece3 /Hotline/macOS/NewsView.swift | |
| parent | ec78dfa6c0a407cb9160e913886887a764f8e1d3 (diff) | |
Some contextual menus in files and newsgroups. Added functional delete file context menu.
Diffstat (limited to 'Hotline/macOS/NewsView.swift')
| -rw-r--r-- | Hotline/macOS/NewsView.swift | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Hotline/macOS/NewsView.swift b/Hotline/macOS/NewsView.swift index ed5d969..6f24193 100644 --- a/Hotline/macOS/NewsView.swift +++ b/Hotline/macOS/NewsView.swift @@ -121,16 +121,15 @@ struct NewsView: View { ToolbarItem(placement: .primaryAction) { Button { + loading = true if let selectionPath = selection?.path { Task { - loading = true await model.getNewsList(at: selectionPath) loading = false } } else { Task { - loading = true await model.getNewsList() loading = false } @@ -153,7 +152,17 @@ struct NewsView: View { .listStyle(.inset) .alternatingRowBackgrounds(.enabled) .contextMenu(forSelectionType: NewsInfo.self) { items in - // ... + let selectedItem = items.first + + Button { + if selectedItem?.type == .article { + replyOpen = true + } + } label: { + Label("Reply to \(selectedItem?.articleUsername ?? "Post")", systemImage: "arrowshape.turn.up.left") + } + .disabled(selectedItem == nil || selectedItem?.type != .article) + } primaryAction: { items in guard let clickedNews = items.first else { return |