1
0
mirror of https://github.com/yattee/yattee.git synced 2025-04-28 16:00:33 +05:30

Add to playlist menu

This commit is contained in:
Arkadiusz Fal 2022-12-15 22:51:06 +01:00
parent a5e5604d84
commit f090fc9fea

View File

@ -19,7 +19,6 @@ struct AddToPlaylistView: View {
Group { Group {
VStack { VStack {
header header
Spacer()
if model.isEmpty { if model.isEmpty {
emptyPlaylistsMessage emptyPlaylistsMessage
} else { } else {
@ -92,18 +91,23 @@ struct AddToPlaylistView: View {
#if os(tvOS) #if os(tvOS)
selectPlaylistButton selectPlaylistButton
#else #else
HStack {
Text("Playlist")
Menu {
Picker("Playlist", selection: $selectedPlaylistID) { Picker("Playlist", selection: $selectedPlaylistID) {
ForEach(editablePlaylists) { playlist in ForEach(editablePlaylists) { playlist in
Text(playlist.title).tag(playlist.id) Text(playlist.title).tag(playlist.id)
} }
} }
.frame(maxWidth: 500) } label: {
#if os(iOS) Text(selectedPlaylist?.title ?? "Select Playlist")
.pickerStyle(.inline) }
#elseif os(macOS) .transaction { t in t.animation = nil }
.frame(maxWidth: 500, alignment: .trailing)
#if os(macOS)
.labelsHidden() .labelsHidden()
#endif #endif
}
#endif #endif
} }
} }
@ -176,6 +180,8 @@ struct AddToPlaylistView: View {
struct AddToPlaylistView_Previews: PreviewProvider { struct AddToPlaylistView_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
AddToPlaylistView(video: Video.fixture) AddToPlaylistView(video: Video.fixture)
.injectFixtureEnvironmentObjects() .onAppear {
PlaylistsModel.shared.playlists = [.fixture]
}
} }
} }