mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-02-03 12:27:32 +01:00
Made Sidebar context menu code simpler
This commit is contained in:
parent
5d43635780
commit
3f7401994d
@ -17,7 +17,7 @@ public enum SidebarItemIdentifier: Hashable, Equatable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum RepresentedType {
|
public enum RepresentedType {
|
||||||
case feed, pseudoFeed, account, unknown
|
case webFeed, folder, pseudoFeed, account, unknown
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SidebarItem: Identifiable {
|
struct SidebarItem: Identifiable {
|
||||||
@ -48,7 +48,9 @@ struct SidebarItem: Identifiable {
|
|||||||
case is UnreadFeed.Type:
|
case is UnreadFeed.Type:
|
||||||
return .pseudoFeed
|
return .pseudoFeed
|
||||||
case is WebFeed.Type:
|
case is WebFeed.Type:
|
||||||
return .feed
|
return .webFeed
|
||||||
|
case is Folder.Type:
|
||||||
|
return .folder
|
||||||
case is Account.Type:
|
case is Account.Type:
|
||||||
return .account
|
return .account
|
||||||
default:
|
default:
|
||||||
|
@ -38,75 +38,63 @@ struct SidebarItemView: View {
|
|||||||
@ViewBuilder var menuItems: some View {
|
@ViewBuilder var menuItems: some View {
|
||||||
if sidebarItem.representedType == .account {
|
if sidebarItem.representedType == .account {
|
||||||
Button(action: {}) {
|
Button(action: {}) {
|
||||||
HStack {
|
Text("Mark All As Read")
|
||||||
Text("Mark All As Read in \(sidebarItem.nameForDisplay)")
|
AppAssets.markAllAsReadImage
|
||||||
Spacer()
|
|
||||||
AppAssets.markAllAsReadImage
|
|
||||||
.resizable()
|
|
||||||
.aspectRatio(contentMode: .fit)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if sidebarItem.representedType == .feed {
|
|
||||||
|
if sidebarItem.representedType == .pseudoFeed {
|
||||||
Button(action: {}) {
|
Button(action: {}) {
|
||||||
HStack {
|
Text("Mark All As Read")
|
||||||
Text("Mark All as Read")
|
AppAssets.markAllAsReadImage
|
||||||
Spacer()
|
}
|
||||||
AppAssets.markAllAsReadImage
|
}
|
||||||
.resizable()
|
|
||||||
.aspectRatio(contentMode: .fit)
|
if sidebarItem.representedType == .webFeed {
|
||||||
}
|
Button(action: {}) {
|
||||||
|
Text("Mark All As Read")
|
||||||
|
AppAssets.markAllAsReadImage
|
||||||
}
|
}
|
||||||
Divider()
|
Divider()
|
||||||
Button(action: {
|
Button(action: {
|
||||||
|
|
||||||
}) {
|
}) {
|
||||||
HStack {
|
Text("Open Home Page")
|
||||||
Text("Open Home Page")
|
AppAssets.openInBrowserImage
|
||||||
Spacer()
|
|
||||||
AppAssets.openInBrowserImage
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Divider()
|
Divider()
|
||||||
Button(action: {}) {
|
Button(action: {}) {
|
||||||
HStack {
|
Text("Copy Feed URL")
|
||||||
Text("Copy Feed URL")
|
AppAssets.copyImage
|
||||||
Spacer()
|
|
||||||
AppAssets.copyImage
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Button(action: {}) {
|
Button(action: {}) {
|
||||||
HStack {
|
Text("Copy Home Page URL")
|
||||||
Text("Copy Home Page URL")
|
AppAssets.copyImage
|
||||||
Spacer()
|
|
||||||
AppAssets.copyImage
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Divider()
|
Divider()
|
||||||
Button(action: {}) {
|
Button(action: {}) {
|
||||||
HStack {
|
Text("Rename")
|
||||||
Text("Rename")
|
AppAssets.renameImage
|
||||||
Spacer()
|
|
||||||
AppAssets.renameImage
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Button(action: {}) {
|
Button(action: {}) {
|
||||||
HStack {
|
Text("Delete")
|
||||||
Text("Delete").foregroundColor(.red)
|
AppAssets.deleteImage
|
||||||
Spacer()
|
|
||||||
AppAssets.deleteImage.foregroundColor(.red)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if sidebarItem.representedType == .pseudoFeed {
|
|
||||||
|
if sidebarItem.representedType == .folder {
|
||||||
Button(action: {}) {
|
Button(action: {}) {
|
||||||
HStack {
|
Text("Mark All As Read")
|
||||||
Text("Mark All as Read")
|
AppAssets.markAllAsReadImage
|
||||||
Spacer()
|
}
|
||||||
AppAssets.markAllAsReadImage
|
Divider()
|
||||||
.resizable()
|
Button(action: {}) {
|
||||||
.aspectRatio(contentMode: .fit)
|
Text("Rename")
|
||||||
}
|
AppAssets.renameImage
|
||||||
|
}
|
||||||
|
Button(action: {}) {
|
||||||
|
Text("Delete")
|
||||||
|
AppAssets.deleteImage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user