From e58afcbf3fa1c97ad3459acbe865c135660a6cdd Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Sun, 13 Nov 2022 21:52:29 +0100 Subject: [PATCH] Inspector and other layouts fixes --- Shared/Player/RelatedView.swift | 2 + .../Player/Video Details/ChaptersView.swift | 2 + .../Player/Video Details/CommentsView.swift | 1 + .../Player/Video Details/InspectorView.swift | 46 ++++++++++++------- .../Video Details/PlayerQueueView.swift | 2 + 5 files changed, 36 insertions(+), 17 deletions(-) diff --git a/Shared/Player/RelatedView.swift b/Shared/Player/RelatedView.swift index 18f1c0d3..ba1bf044 100644 --- a/Shared/Player/RelatedView.swift +++ b/Shared/Player/RelatedView.swift @@ -18,6 +18,8 @@ struct RelatedView: View { VideoContextMenuView(video: video) } } + Color.clear.padding(.bottom, 50) + .listRowBackground(Color.clear) } } } diff --git a/Shared/Player/Video Details/ChaptersView.swift b/Shared/Player/Video Details/ChaptersView.swift index 2a92c746..85cd5e0d 100644 --- a/Shared/Player/Video Details/ChaptersView.swift +++ b/Shared/Player/Video Details/ChaptersView.swift @@ -12,6 +12,8 @@ struct ChaptersView: View { ForEach(chapters) { chapter in ChapterView(chapter: chapter) } + Color.clear.frame(height: 50) + .listRowBackground(Color.clear) } .listRowBackground(Color.clear) } diff --git a/Shared/Player/Video Details/CommentsView.swift b/Shared/Player/Video Details/CommentsView.swift index 96fb0f17..e77f2fc4 100644 --- a/Shared/Player/Video Details/CommentsView.swift +++ b/Shared/Player/Video Details/CommentsView.swift @@ -29,6 +29,7 @@ struct CommentsView: View { if embedInScrollView { ScrollView(.vertical, showsIndicators: false) { commentsStack + Color.clear.frame(height: 50) } } else { commentsStack diff --git a/Shared/Player/Video Details/InspectorView.swift b/Shared/Player/Video Details/InspectorView.swift index 12788354..fc9c53cf 100644 --- a/Shared/Player/Video Details/InspectorView.swift +++ b/Shared/Player/Video Details/InspectorView.swift @@ -7,11 +7,11 @@ struct InspectorView: View { var body: some View { ScrollView { - VStack(spacing: 4) { + VStack(alignment: .leading, spacing: 12) { if let video { - Group { + VStack(spacing: 4) { if player.activeBackend == .mpv, player.mpvBackend.videoFormat != "unknown" { - videoDetailGroupHeading("Video") + videoDetailGroupHeading("Video", image: "film") videoDetailRow("Format", value: player.mpvBackend.videoFormat) videoDetailRow("Codec", value: player.mpvBackend.videoCodec) @@ -26,8 +26,8 @@ struct InspectorView: View { } if player.activeBackend == .mpv, player.mpvBackend.audioFormat != "unknown" { - Group { - videoDetailGroupHeading("Audio") + VStack(spacing: 4) { + videoDetailGroupHeading("Audio", image: "music.note") videoDetailRow("Format", value: player.mpvBackend.audioFormat) videoDetailRow("Codec", value: player.mpvBackend.audioCodec) videoDetailRow("Driver", value: player.mpvBackend.currentAo) @@ -36,27 +36,38 @@ struct InspectorView: View { } } - if video.localStream != nil || video.localStreamFileExtension != nil { - videoDetailGroupHeading("File") - } + VStack(spacing: 4) { + if video.localStream != nil || video.localStreamFileExtension != nil { + videoDetailGroupHeading("File", image: "doc") + } - if let fileExtension = video.localStreamFileExtension { - videoDetailRow("File Extension", value: fileExtension) - } + if let fileExtension = video.localStreamFileExtension { + videoDetailRow("File Extension", value: fileExtension) + } - if let url = video.localStream?.localURL, video.localStreamIsRemoteURL { - videoDetailRow("URL", value: url.absoluteString) + if let url = video.localStream?.localURL, video.localStreamIsRemoteURL { + videoDetailRow("URL", value: url.absoluteString) + } } + } else { + NoCommentsView(text: "Not playing", systemImage: "stop.circle.fill") } } + .padding(.top, 10) + .padding(.bottom, 50) } .padding(.horizontal) } - @ViewBuilder func videoDetailGroupHeading(_ heading: String) -> some View { - Text(heading.uppercased()) - .font(.footnote) - .foregroundColor(.secondary) + @ViewBuilder func videoDetailGroupHeading(_ heading: String, image systemName: String? = nil) -> some View { + HStack { + if let systemName { + Image(systemName: systemName) + } + Text(heading.uppercased()) + .font(.footnote) + } + .foregroundColor(.secondary) } @ViewBuilder func videoDetailRow(_ detail: String, value: String) -> some View { @@ -81,5 +92,6 @@ struct InspectorView: View { struct InspectorView_Previews: PreviewProvider { static var previews: some View { InspectorView(video: .fixture) + .injectFixtureEnvironmentObjects() } } diff --git a/Shared/Player/Video Details/PlayerQueueView.swift b/Shared/Player/Video Details/PlayerQueueView.swift index fdd57666..7ef6fe4a 100644 --- a/Shared/Player/Video Details/PlayerQueueView.swift +++ b/Shared/Player/Video Details/PlayerQueueView.swift @@ -32,6 +32,8 @@ struct PlayerQueueView: View { .padding(.vertical, 5) .listRowInsets(EdgeInsets()) #endif + Color.clear.padding(.bottom, 50) + .listRowBackground(Color.clear) } #if os(macOS) .listStyle(.inset)