aboutsummaryrefslogtreecommitdiff
path: root/Hotline/macOS/NewsView.swift
diff options
context:
space:
mode:
authorDustin Mierau <dustin@mierau.me>2024-05-14 18:12:56 -0700
committerDustin Mierau <dustin@mierau.me>2024-05-14 18:12:56 -0700
commitac3c8f540751e4138319d9e4e7ffb92a9b2236e2 (patch)
tree53df968f49e74223153c61e7a287f0d99faeece3 /Hotline/macOS/NewsView.swift
parentec78dfa6c0a407cb9160e913886887a764f8e1d3 (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.swift15
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