Minor layout fixes

This commit is contained in:
Arkadiusz Fal 2021-08-17 00:46:18 +02:00
parent 09c3947fef
commit 2dff68200d
3 changed files with 15 additions and 4 deletions

View File

@ -44,7 +44,6 @@
373CFADD269663F1003CB2C6 /* Thumbnail.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFADA269663F1003CB2C6 /* Thumbnail.swift */; }; 373CFADD269663F1003CB2C6 /* Thumbnail.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFADA269663F1003CB2C6 /* Thumbnail.swift */; };
373CFAEB26975CBF003CB2C6 /* PlaylistFormView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFAEA26975CBF003CB2C6 /* PlaylistFormView.swift */; }; 373CFAEB26975CBF003CB2C6 /* PlaylistFormView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFAEA26975CBF003CB2C6 /* PlaylistFormView.swift */; };
373CFAEC26975CBF003CB2C6 /* PlaylistFormView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFAEA26975CBF003CB2C6 /* PlaylistFormView.swift */; }; 373CFAEC26975CBF003CB2C6 /* PlaylistFormView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFAEA26975CBF003CB2C6 /* PlaylistFormView.swift */; };
373CFAED26975CBF003CB2C6 /* PlaylistFormView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFAEA26975CBF003CB2C6 /* PlaylistFormView.swift */; };
373CFAEF2697A78B003CB2C6 /* AddToPlaylistView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFAEE2697A78B003CB2C6 /* AddToPlaylistView.swift */; }; 373CFAEF2697A78B003CB2C6 /* AddToPlaylistView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFAEE2697A78B003CB2C6 /* AddToPlaylistView.swift */; };
373CFAF02697A78B003CB2C6 /* AddToPlaylistView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFAEE2697A78B003CB2C6 /* AddToPlaylistView.swift */; }; 373CFAF02697A78B003CB2C6 /* AddToPlaylistView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFAEE2697A78B003CB2C6 /* AddToPlaylistView.swift */; };
373CFAF12697A78B003CB2C6 /* AddToPlaylistView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFAEE2697A78B003CB2C6 /* AddToPlaylistView.swift */; }; 373CFAF12697A78B003CB2C6 /* AddToPlaylistView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFAEE2697A78B003CB2C6 /* AddToPlaylistView.swift */; };
@ -177,6 +176,7 @@
37F49BA326CAA59B00304AC0 /* Playlist+Fixtures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37F49BA226CAA59B00304AC0 /* Playlist+Fixtures.swift */; }; 37F49BA326CAA59B00304AC0 /* Playlist+Fixtures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37F49BA226CAA59B00304AC0 /* Playlist+Fixtures.swift */; };
37F49BA426CAA59B00304AC0 /* Playlist+Fixtures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37F49BA226CAA59B00304AC0 /* Playlist+Fixtures.swift */; }; 37F49BA426CAA59B00304AC0 /* Playlist+Fixtures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37F49BA226CAA59B00304AC0 /* Playlist+Fixtures.swift */; };
37F49BA526CAA59B00304AC0 /* Playlist+Fixtures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37F49BA226CAA59B00304AC0 /* Playlist+Fixtures.swift */; }; 37F49BA526CAA59B00304AC0 /* Playlist+Fixtures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37F49BA226CAA59B00304AC0 /* Playlist+Fixtures.swift */; };
37F49BA826CB0FCE00304AC0 /* PlaylistFormView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFAEA26975CBF003CB2C6 /* PlaylistFormView.swift */; };
37F4AE7226828F0900BD60EA /* VideosCellsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37F4AE7126828F0900BD60EA /* VideosCellsView.swift */; }; 37F4AE7226828F0900BD60EA /* VideosCellsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37F4AE7126828F0900BD60EA /* VideosCellsView.swift */; };
37F4AE7326828F0900BD60EA /* VideosCellsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37F4AE7126828F0900BD60EA /* VideosCellsView.swift */; }; 37F4AE7326828F0900BD60EA /* VideosCellsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37F4AE7126828F0900BD60EA /* VideosCellsView.swift */; };
37F4AE7426828F0900BD60EA /* VideosCellsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37F4AE7126828F0900BD60EA /* VideosCellsView.swift */; }; 37F4AE7426828F0900BD60EA /* VideosCellsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37F4AE7126828F0900BD60EA /* VideosCellsView.swift */; };
@ -920,9 +920,9 @@
3705B180267B4DFB00704544 /* TrendingCountrySelection.swift in Sources */, 3705B180267B4DFB00704544 /* TrendingCountrySelection.swift in Sources */,
373CFACD26966264003CB2C6 /* SearchQuery.swift in Sources */, 373CFACD26966264003CB2C6 /* SearchQuery.swift in Sources */,
37141675267A8E10006CA35D /* Country.swift in Sources */, 37141675267A8E10006CA35D /* Country.swift in Sources */,
37F49BA826CB0FCE00304AC0 /* PlaylistFormView.swift in Sources */,
373CFAC42696616C003CB2C6 /* CoverSectionRowView.swift in Sources */, 373CFAC42696616C003CB2C6 /* CoverSectionRowView.swift in Sources */,
37D4B19926717E1500C925CA /* Video.swift in Sources */, 37D4B19926717E1500C925CA /* Video.swift in Sources */,
373CFAED26975CBF003CB2C6 /* PlaylistFormView.swift in Sources */,
3705B184267B4E4900704544 /* TrendingCategory.swift in Sources */, 3705B184267B4E4900704544 /* TrendingCategory.swift in Sources */,
37AAF2A226741C97007FC770 /* SubscriptionsView.swift in Sources */, 37AAF2A226741C97007FC770 /* SubscriptionsView.swift in Sources */,
372915E82687E3B900F5A35B /* Defaults.swift in Sources */, 372915E82687E3B900F5A35B /* Defaults.swift in Sources */,

View File

@ -8,6 +8,8 @@ struct PlaylistFormView: View {
@State private var valid = false @State private var valid = false
@State private var showingDeleteConfirmation = false @State private var showingDeleteConfirmation = false
@FocusState private var focused: Bool
@Binding var playlist: Playlist! @Binding var playlist: Playlist!
@Environment(\.dismiss) private var dismiss @Environment(\.dismiss) private var dismiss
@ -33,6 +35,7 @@ struct PlaylistFormView: View {
TextField("Name", text: $name, onCommit: validate) TextField("Name", text: $name, onCommit: validate)
.frame(maxWidth: 450) .frame(maxWidth: 450)
.padding(.leading, 10) .padding(.leading, 10)
.focused($focused)
Picker("Visibility", selection: $visibility) { Picker("Visibility", selection: $visibility) {
ForEach(Playlist.Visibility.allCases, id: \.self) { visibility in ForEach(Playlist.Visibility.allCases, id: \.self) { visibility in
@ -55,7 +58,7 @@ struct PlaylistFormView: View {
} }
} }
.onChange(of: name) { _ in validate() } .onChange(of: name) { _ in validate() }
.onAppear(perform: setFieldsFromPlaylist) .onAppear(perform: initializeForm)
.padding(.horizontal) .padding(.horizontal)
#if !os(iOS) #if !os(iOS)
.frame(width: 400, height: 150) .frame(width: 400, height: 150)
@ -106,7 +109,8 @@ struct PlaylistFormView: View {
#endif #endif
} }
func setFieldsFromPlaylist() { func initializeForm() {
focused = true
guard editing else { guard editing else {
return return
} }

View File

@ -7,6 +7,8 @@ struct VideoPlayerView: View {
@ObservedObject private var store = Store<Video>() @ObservedObject private var store = Store<Video>()
@Environment(\.dismiss) private var dismiss
var resource: Resource { var resource: Resource {
InvidiousAPI.shared.video(video.id) InvidiousAPI.shared.video(video.id)
} }
@ -28,6 +30,11 @@ struct VideoPlayerView: View {
VStack(alignment: .leading) { VStack(alignment: .leading) {
Text(video.title) Text(video.title)
Text(video.author) Text(video.author)
Button("Done") {
dismiss()
}
.keyboardShortcut(.cancelAction)
} }
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading) .frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
} }