mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 04:04:07 +00:00
Minor improvements
This commit is contained in:
@@ -23,7 +23,6 @@ struct VideoDetails: View {
|
||||
|
||||
@EnvironmentObject<AccountsModel> private var accounts
|
||||
@EnvironmentObject<PlayerModel> private var player
|
||||
@EnvironmentObject<PlaylistsModel> private var playlists
|
||||
@EnvironmentObject<SubscriptionsModel> private var subscriptions
|
||||
|
||||
@Default(.showKeywords) private var showKeywords
|
||||
@@ -263,7 +262,7 @@ struct VideoDetails: View {
|
||||
if let video = player.currentVideo {
|
||||
HStack {
|
||||
ShareButton(
|
||||
contentItem: ContentItem(video: video),
|
||||
contentItem: contentItem,
|
||||
presentingShareSheet: $presentingShareSheet,
|
||||
shareURL: $shareURL
|
||||
)
|
||||
|
@@ -126,24 +126,26 @@ struct AddToPlaylistView: View {
|
||||
.padding(.horizontal)
|
||||
}
|
||||
|
||||
private var selectPlaylistButton: some View {
|
||||
Button(selectedPlaylist?.title ?? "Select playlist") {
|
||||
guard selectedPlaylist != nil else {
|
||||
return
|
||||
}
|
||||
|
||||
selectedPlaylistID = model.all.next(after: selectedPlaylist!)!.id
|
||||
}
|
||||
.contextMenu {
|
||||
ForEach(model.all) { playlist in
|
||||
Button(playlist.title) {
|
||||
selectedPlaylistID = playlist.id
|
||||
#if os(tvOS)
|
||||
private var selectPlaylistButton: some View {
|
||||
Button(selectedPlaylist?.title ?? "Select playlist") {
|
||||
guard selectedPlaylist != nil else {
|
||||
return // swiftlint:disable:this implicit_return
|
||||
}
|
||||
}
|
||||
|
||||
Button("Cancel", role: .cancel) {}
|
||||
selectedPlaylistID = model.all.next(after: selectedPlaylist!)!.id
|
||||
}
|
||||
.contextMenu {
|
||||
ForEach(model.all) { playlist in
|
||||
Button(playlist.title) {
|
||||
selectedPlaylistID = playlist.id
|
||||
}
|
||||
}
|
||||
|
||||
Button("Cancel", role: .cancel) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
private func addToPlaylist() {
|
||||
guard let id = selectedPlaylist?.id else {
|
||||
|
@@ -95,59 +95,61 @@ struct PlaylistFormView: View {
|
||||
#endif
|
||||
}
|
||||
|
||||
var header: some View {
|
||||
HStack(alignment: .center) {
|
||||
Text(editing ? "Edit Playlist" : "Create Playlist")
|
||||
.font(.title2.bold())
|
||||
#if os(tvOS)
|
||||
var header: some View {
|
||||
HStack(alignment: .center) {
|
||||
Text(editing ? "Edit Playlist" : "Create Playlist")
|
||||
.font(.title2.bold())
|
||||
|
||||
Spacer()
|
||||
|
||||
#if !os(tvOS)
|
||||
Button("Cancel") {
|
||||
dismiss()
|
||||
}
|
||||
.keyboardShortcut(.cancelAction)
|
||||
#endif
|
||||
}
|
||||
.padding(.horizontal)
|
||||
}
|
||||
|
||||
var form: some View {
|
||||
VStack(alignment: .trailing) {
|
||||
VStack {
|
||||
Text("Name")
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
TextField("Playlist Name", text: $name, onCommit: validate)
|
||||
}
|
||||
|
||||
HStack {
|
||||
Text("Visibility")
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
visibilityFormItem
|
||||
}
|
||||
.padding(.top, 10)
|
||||
|
||||
HStack {
|
||||
Spacer()
|
||||
|
||||
Button("Save", action: submitForm).disabled(!valid)
|
||||
#if !os(tvOS)
|
||||
Button("Cancel") {
|
||||
dismiss()
|
||||
}
|
||||
.keyboardShortcut(.cancelAction)
|
||||
#endif
|
||||
}
|
||||
.padding(.top, 40)
|
||||
.padding(.horizontal)
|
||||
}
|
||||
|
||||
var form: some View {
|
||||
VStack(alignment: .trailing) {
|
||||
VStack {
|
||||
Text("Name")
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
TextField("Playlist Name", text: $name, onCommit: validate)
|
||||
}
|
||||
|
||||
HStack {
|
||||
Text("Visibility")
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
visibilityFormItem
|
||||
}
|
||||
.padding(.top, 10)
|
||||
|
||||
if editing {
|
||||
Divider()
|
||||
HStack {
|
||||
Text("Delete playlist")
|
||||
.font(.title2.bold())
|
||||
Spacer()
|
||||
deletePlaylistButton
|
||||
|
||||
Button("Save", action: submitForm).disabled(!valid)
|
||||
}
|
||||
.padding(.top, 40)
|
||||
|
||||
if editing {
|
||||
Divider()
|
||||
HStack {
|
||||
Text("Delete playlist")
|
||||
.font(.title2.bold())
|
||||
Spacer()
|
||||
deletePlaylistButton
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.horizontal)
|
||||
}
|
||||
.padding(.horizontal)
|
||||
}
|
||||
#endif
|
||||
|
||||
func initializeForm() {
|
||||
focused = true
|
||||
|
@@ -17,8 +17,6 @@ struct AccountForm: View {
|
||||
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
|
||||
@EnvironmentObject<InstancesModel> private var instances
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
Group {
|
||||
|
@@ -124,37 +124,39 @@ struct TrendingView: View {
|
||||
}
|
||||
}
|
||||
|
||||
private var toolbar: some View {
|
||||
HStack {
|
||||
if accounts.app.supportsTrendingCategories {
|
||||
#if os(tvOS)
|
||||
private var toolbar: some View {
|
||||
HStack {
|
||||
if accounts.app.supportsTrendingCategories {
|
||||
HStack {
|
||||
Text("Category")
|
||||
.foregroundColor(.secondary)
|
||||
|
||||
categoryButton
|
||||
}
|
||||
}
|
||||
|
||||
#if os(iOS)
|
||||
Spacer()
|
||||
#endif
|
||||
|
||||
HStack {
|
||||
Text("Category")
|
||||
Text("Country")
|
||||
.foregroundColor(.secondary)
|
||||
|
||||
categoryButton
|
||||
countryButton
|
||||
}
|
||||
|
||||
#if os(tvOS)
|
||||
if let favoriteItem = favoriteItem {
|
||||
FavoriteButton(item: favoriteItem)
|
||||
.id(favoriteItem.id)
|
||||
.labelStyle(.iconOnly)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if os(iOS)
|
||||
Spacer()
|
||||
#endif
|
||||
|
||||
HStack {
|
||||
Text("Country")
|
||||
.foregroundColor(.secondary)
|
||||
|
||||
countryButton
|
||||
}
|
||||
|
||||
#if os(tvOS)
|
||||
if let favoriteItem = favoriteItem {
|
||||
FavoriteButton(item: favoriteItem)
|
||||
.id(favoriteItem.id)
|
||||
.labelStyle(.iconOnly)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
private var categoryButton: some View {
|
||||
#if os(tvOS)
|
||||
|
@@ -4,7 +4,6 @@ import SwiftUI
|
||||
|
||||
struct VideoCell: View {
|
||||
var video: Video
|
||||
@State private var mediumQualityThumbnail = false
|
||||
|
||||
@Environment(\.inNavigationView) private var inNavigationView
|
||||
|
||||
|
@@ -8,8 +8,9 @@ struct ChannelPlaylistView: View {
|
||||
|
||||
@StateObject private var store = Store<ChannelPlaylist>()
|
||||
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
@Environment(\.inNavigationView) private var inNavigationView
|
||||
#if os(iOS)
|
||||
@Environment(\.inNavigationView) private var inNavigationView
|
||||
#endif
|
||||
|
||||
@EnvironmentObject<AccountsModel> private var accounts
|
||||
|
||||
|
@@ -2,7 +2,10 @@ import SwiftUI
|
||||
|
||||
struct OpenSettingsButton: View {
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
@EnvironmentObject<NavigationModel> private var navigation
|
||||
|
||||
#if !os(macOS)
|
||||
@EnvironmentObject<NavigationModel> private var navigation
|
||||
#endif
|
||||
|
||||
var body: some View {
|
||||
Button {
|
||||
|
Reference in New Issue
Block a user