Recently opened for sidebar navigation

This commit is contained in:
Arkadiusz Fal
2021-09-19 13:06:54 +02:00
parent 8571822f23
commit ee1cb924c9
16 changed files with 291 additions and 291 deletions

View File

@@ -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