Add to playlist from video player, state fixes

This commit is contained in:
Arkadiusz Fal
2021-10-25 23:29:06 +02:00
parent 47ad6a4410
commit b50d915d8e
10 changed files with 129 additions and 27 deletions

View File

@@ -11,6 +11,7 @@ struct VideoDetails: View {
@State private var subscribed = false
@State private var confirmationShown = false
@State private var presentingAddToPlaylist = false
@State private var currentPage = Page.details
@@ -18,6 +19,7 @@ struct VideoDetails: View {
@EnvironmentObject<AccountsModel> private var accounts
@EnvironmentObject<PlayerModel> private var player
@EnvironmentObject<PlaylistsModel> private var playlists
@EnvironmentObject<SubscriptionsModel> private var subscriptions
init(
@@ -266,11 +268,25 @@ struct VideoDetails: View {
}
Spacer()
Button {
presentingAddToPlaylist = true
} label: {
Label("Add to Playlist", systemImage: "text.badge.plus")
.labelStyle(.iconOnly)
.help("Add to Playlist...")
}
.buttonStyle(.plain)
}
.frame(maxHeight: 35)
.foregroundColor(.secondary)
}
}
.sheet(isPresented: $presentingAddToPlaylist) {
if let video = video {
AddToPlaylistView(video: video)
}
}
}
var detailsPage: some View {
@@ -351,7 +367,7 @@ struct VideoDetails: View {
struct VideoDetails_Previews: PreviewProvider {
static var previews: some View {
VideoDetails(sidebarQueue: .constant(false))
VideoDetails(sidebarQueue: .constant(true))
.injectFixtureEnvironmentObjects()
}
}