mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Inspector View
Inspector Views for macOS and iOS
This commit is contained in:
@@ -10,12 +10,15 @@ import SwiftUI
|
||||
|
||||
struct SidebarContextMenu: View {
|
||||
|
||||
@Binding var showInspector: Bool
|
||||
var sidebarItem: SidebarItem
|
||||
|
||||
|
||||
@ViewBuilder var body: some View {
|
||||
|
||||
if sidebarItem.representedType == .account {
|
||||
Button {
|
||||
showInspector = true
|
||||
} label: {
|
||||
Text("Get Info")
|
||||
#if os(iOS)
|
||||
@@ -43,6 +46,7 @@ struct SidebarContextMenu: View {
|
||||
|
||||
if sidebarItem.representedType == .webFeed {
|
||||
Button {
|
||||
showInspector = true
|
||||
} label: {
|
||||
Text("Get Info")
|
||||
#if os(iOS)
|
||||
@@ -106,6 +110,7 @@ struct SidebarContextMenu: View {
|
||||
}
|
||||
Divider()
|
||||
Button {
|
||||
showInspector = true
|
||||
} label: {
|
||||
Text("Rename")
|
||||
#if os(iOS)
|
||||
|
||||
@@ -12,13 +12,14 @@ import Account
|
||||
struct SidebarItemView: View {
|
||||
|
||||
@StateObject var feedIconImageLoader = FeedIconImageLoader()
|
||||
@State private var showInspector: Bool = false
|
||||
var sidebarItem: SidebarItem
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
if let image = feedIconImageLoader.image {
|
||||
IconImageView(iconImage: image)
|
||||
.frame(width: 20, height: 20, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/)
|
||||
.frame(width: 20, height: 20, alignment: .center)
|
||||
}
|
||||
Text(verbatim: sidebarItem.nameForDisplay)
|
||||
Spacer()
|
||||
@@ -37,7 +38,10 @@ struct SidebarItemView: View {
|
||||
feedIconImageLoader.loadImage(for: feed)
|
||||
}
|
||||
}.contextMenu {
|
||||
SidebarContextMenu(sidebarItem: sidebarItem)
|
||||
SidebarContextMenu(showInspector: $showInspector, sidebarItem: sidebarItem)
|
||||
}
|
||||
.sheet(isPresented: $showInspector, onDismiss: { showInspector = false}) {
|
||||
InspectorView(sidebarItem: sidebarItem)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -190,7 +190,8 @@ struct SidebarView: View {
|
||||
|
||||
@ViewBuilder var body: some View {
|
||||
#if os(macOS)
|
||||
SidebarItemView(sidebarItem: sidebarItem).tag(sidebarItem.feed!.feedID!)
|
||||
SidebarItemView(sidebarItem: sidebarItem)
|
||||
.tag(sidebarItem.feed!.feedID!)
|
||||
#else
|
||||
ZStack {
|
||||
SidebarItemView(sidebarItem: sidebarItem)
|
||||
|
||||
Reference in New Issue
Block a user