mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Recently opened for sidebar navigation
This commit is contained in:
@@ -3,6 +3,7 @@ import SwiftUI
|
||||
|
||||
struct VideoContextMenuView: View {
|
||||
@EnvironmentObject<NavigationState> private var navigationState
|
||||
@EnvironmentObject<Recents> private var recents
|
||||
@EnvironmentObject<Subscriptions> private var subscriptions
|
||||
|
||||
let video: Video
|
||||
@@ -14,15 +15,11 @@ struct VideoContextMenuView: View {
|
||||
|
||||
var body: some View {
|
||||
Section {
|
||||
if navigationState.showOpenChannel(video.channel.id) {
|
||||
openChannelButton
|
||||
}
|
||||
openChannelButton
|
||||
|
||||
subscriptionButton
|
||||
.opacity(subscribed ? 1 : 1)
|
||||
|
||||
openVideoDetailsButton
|
||||
|
||||
if navigationState.tabSelection == .playlists {
|
||||
removeFromPlaylistButton
|
||||
} else {
|
||||
@@ -33,8 +30,10 @@ struct VideoContextMenuView: View {
|
||||
|
||||
var openChannelButton: some View {
|
||||
Button("\(video.author) Channel") {
|
||||
navigationState.openChannel(video.channel)
|
||||
navigationState.tabSelection = .channel(video.channel.id)
|
||||
let recent = RecentItem(from: video.channel)
|
||||
recents.open(recent)
|
||||
navigationState.tabSelection = .recentlyOpened(recent.tag)
|
||||
navigationState.isChannelOpen = true
|
||||
navigationState.sidebarSectionChanged.toggle()
|
||||
}
|
||||
}
|
||||
@@ -59,12 +58,6 @@ struct VideoContextMenuView: View {
|
||||
}
|
||||
}
|
||||
|
||||
var openVideoDetailsButton: some View {
|
||||
Button("Open video details") {
|
||||
navigationState.openVideoDetails(video)
|
||||
}
|
||||
}
|
||||
|
||||
var addToPlaylistButton: some View {
|
||||
Button("Add to playlist...") {
|
||||
videoIDToAddToPlaylist = video.id
|
||||
|
Reference in New Issue
Block a user