mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Add Periphery configuration, remove unused code
This commit is contained in:
@@ -90,7 +90,6 @@ struct AddToPlaylistView: View {
|
||||
|
||||
VStack(alignment: formAlignment) {
|
||||
#if os(tvOS)
|
||||
|
||||
selectPlaylistButton
|
||||
#else
|
||||
Picker("Playlist", selection: $model.selectedPlaylistID) {
|
||||
@@ -132,14 +131,6 @@ struct AddToPlaylistView: View {
|
||||
.padding(.horizontal)
|
||||
}
|
||||
|
||||
private var footerAlignment: HorizontalAlignment {
|
||||
#if os(tvOS)
|
||||
.trailing
|
||||
#else
|
||||
.leading
|
||||
#endif
|
||||
}
|
||||
|
||||
private var selectPlaylistButton: some View {
|
||||
Button(model.currentPlaylist?.title ?? "Select playlist") {
|
||||
guard model.currentPlaylist != nil else {
|
||||
|
@@ -42,12 +42,8 @@ struct PlaylistFormView: View {
|
||||
.padding(.leading, 10)
|
||||
.focused($focused)
|
||||
|
||||
Picker("Visibility", selection: $visibility) {
|
||||
ForEach(Playlist.Visibility.allCases, id: \.self) { visibility in
|
||||
Text(visibility.name)
|
||||
}
|
||||
}
|
||||
.pickerStyle(.segmented)
|
||||
visibilityFormItem
|
||||
.pickerStyle(.segmented)
|
||||
}
|
||||
|
||||
HStack {
|
||||
@@ -126,7 +122,7 @@ struct PlaylistFormView: View {
|
||||
Text("Visibility")
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
visibilityButton
|
||||
visibilityFormItem
|
||||
}
|
||||
.padding(.top, 10)
|
||||
|
||||
@@ -189,7 +185,7 @@ struct PlaylistFormView: View {
|
||||
editing ? api.playlist(playlist.id) : api.playlists
|
||||
}
|
||||
|
||||
var visibilityButton: some View {
|
||||
var visibilityFormItem: some View {
|
||||
#if os(macOS)
|
||||
Picker("Visibility", selection: $visibility) {
|
||||
ForEach(Playlist.Visibility.allCases) { visibility in
|
||||
|
@@ -5,18 +5,12 @@ import SwiftUI
|
||||
struct PlaylistsView: View {
|
||||
@EnvironmentObject<PlaylistsModel> private var model
|
||||
|
||||
@EnvironmentObject<InvidiousAPI> private var api
|
||||
@EnvironmentObject<NavigationModel> private var navigation
|
||||
|
||||
@State private var showingNewPlaylist = false
|
||||
@State private var createdPlaylist: Playlist?
|
||||
|
||||
@State private var showingEditPlaylist = false
|
||||
@State private var editedPlaylist: Playlist?
|
||||
|
||||
@State private var showingAddToPlaylist = false
|
||||
@State private var videoIDToAddToPlaylist = ""
|
||||
|
||||
@Namespace private var focusNamespace
|
||||
|
||||
var videos: [Video] {
|
||||
@@ -98,34 +92,38 @@ struct PlaylistsView: View {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
.focusScope(focusNamespace)
|
||||
#if os(tvOS)
|
||||
.focusScope(focusNamespace)
|
||||
#endif
|
||||
.onAppear {
|
||||
model.load()
|
||||
}
|
||||
}
|
||||
|
||||
var toolbar: some View {
|
||||
HStack {
|
||||
if model.isEmpty {
|
||||
Text("No Playlists")
|
||||
.foregroundColor(.secondary)
|
||||
} else {
|
||||
Text("Current Playlist")
|
||||
.foregroundColor(.secondary)
|
||||
#if os(tvOS)
|
||||
var toolbar: some View {
|
||||
HStack {
|
||||
if model.isEmpty {
|
||||
Text("No Playlists")
|
||||
.foregroundColor(.secondary)
|
||||
} else {
|
||||
Text("Current Playlist")
|
||||
.foregroundColor(.secondary)
|
||||
|
||||
selectPlaylistButton
|
||||
selectPlaylistButton
|
||||
}
|
||||
|
||||
if model.currentPlaylist != nil {
|
||||
editPlaylistButton
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
newPlaylistButton
|
||||
.padding(.leading, 40)
|
||||
}
|
||||
|
||||
if model.currentPlaylist != nil {
|
||||
editPlaylistButton
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
newPlaylistButton
|
||||
.padding(.leading, 40)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
func hintText(_ text: String) -> some View {
|
||||
VStack {
|
||||
|
Reference in New Issue
Block a user