Minor layout improvements

This commit is contained in:
Arkadiusz Fal 2022-01-05 18:51:19 +01:00
parent 3e8ac15c66
commit 7317aec1ed
3 changed files with 16 additions and 30 deletions

View File

@ -7,6 +7,7 @@ disabled_rules:
- multiline_arguments - multiline_arguments
excluded: excluded:
- Vendor
- Tests Apple TV - Tests Apple TV
- Tests iOS - Tests iOS
- Tests macOS - Tests macOS

View File

@ -100,7 +100,7 @@ struct VideoDetails: View {
if player.isLoadingVideo { if player.isLoadingVideo {
PlaceholderProgressView() PlaceholderProgressView()
} else { } else {
ScrollView(.vertical) { ScrollView(.vertical, showsIndicators: false) {
detailsPage detailsPage
} }
} }
@ -112,7 +112,7 @@ struct VideoDetails: View {
RelatedView() RelatedView()
.edgesIgnoringSafeArea(.horizontal) .edgesIgnoringSafeArea(.horizontal)
case .comments: case .comments:
CommentsView() CommentsView(embedInScrollView: true)
.edgesIgnoringSafeArea(.horizontal) .edgesIgnoringSafeArea(.horizontal)
} }
} }
@ -137,7 +137,7 @@ struct VideoDetails: View {
} }
} }
.edgesIgnoringSafeArea(.horizontal) .edgesIgnoringSafeArea(.horizontal)
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading) .frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity, alignment: .topLeading)
} }
var title: some View { var title: some View {
@ -288,8 +288,7 @@ struct VideoDetails: View {
if !video.isNil { if !video.isNil {
Text("Info").tag(Page.info) Text("Info").tag(Page.info)
if CommentsModel.enabled, CommentsModel.placement == .separate { if CommentsModel.enabled, CommentsModel.placement == .separate {
Text("Comments") Text("Comments").tag(Page.comments)
.tag(Page.comments)
} }
if !sidebarQueue { if !sidebarQueue {
Text("Related").tag(Page.related) Text("Related").tag(Page.related)
@ -357,12 +356,14 @@ struct VideoDetails: View {
if let likes = video.likesCount { if let likes = video.likesCount {
Divider() Divider()
.frame(minHeight: 35)
videoDetail(label: "Likes", value: likes, symbol: "hand.thumbsup") videoDetail(label: "Likes", value: likes, symbol: "hand.thumbsup")
} }
if let dislikes = video.dislikesCount { if let dislikes = video.dislikesCount {
Divider() Divider()
.frame(minHeight: 35)
videoDetail(label: "Dislikes", value: dislikes, symbol: "hand.thumbsdown") videoDetail(label: "Dislikes", value: dislikes, symbol: "hand.thumbsdown")
} }
@ -428,7 +429,7 @@ struct VideoDetails: View {
Group { Group {
Group { Group {
if let video = player.currentVideo { if let video = player.currentVideo {
Group { VStack(spacing: 6) {
HStack { HStack {
publishedDateSection publishedDateSection
Spacer() Spacer()
@ -437,9 +438,9 @@ struct VideoDetails: View {
Divider() Divider()
countsSection countsSection
}
Divider() Divider()
}
VStack(alignment: .leading, spacing: 10) { VStack(alignment: .leading, spacing: 10) {
if let description = video.description { if let description = video.description {
@ -495,7 +496,7 @@ struct VideoDetails: View {
} }
.padding(.horizontal) .padding(.horizontal)
Group { LazyVStack {
if !video.isNil, CommentsModel.placement == .info { if !video.isNil, CommentsModel.placement == .info {
CommentsView() CommentsView()
} }

View File

@ -74,25 +74,6 @@ struct PlaylistsView: View {
) )
#endif #endif
.toolbar { .toolbar {
ToolbarItemGroup {
#if !os(iOS)
if !model.isEmpty {
if #available(macOS 12.0, *) {
selectPlaylistButton
.prefersDefaultFocus(in: focusNamespace)
} else {
selectPlaylistButton
}
}
if currentPlaylist != nil {
editPlaylistButton
}
#endif
FavoriteButton(item: FavoriteItem(section: .playlist(selectedPlaylistID)))
}
#if os(iOS) #if os(iOS)
ToolbarItemGroup(placement: .bottomBar) { ToolbarItemGroup(placement: .bottomBar) {
Group { Group {
@ -101,7 +82,7 @@ struct PlaylistsView: View {
.foregroundColor(.secondary) .foregroundColor(.secondary)
} else { } else {
selectPlaylistButton selectPlaylistButton
.frame(maxWidth: 140) .transaction { t in t.animation = .none }
} }
Spacer() Spacer()
@ -230,7 +211,7 @@ struct PlaylistsView: View {
Button("Cancel", role: .cancel) {} Button("Cancel", role: .cancel) {}
} }
#else #else
Menu(currentPlaylist?.title ?? "Select playlist") { Menu {
ForEach(model.all) { playlist in ForEach(model.all) { playlist in
Button(action: { selectedPlaylistID = playlist.id }) { Button(action: { selectedPlaylistID = playlist.id }) {
if playlist == currentPlaylist { if playlist == currentPlaylist {
@ -240,6 +221,9 @@ struct PlaylistsView: View {
} }
} }
} }
} label: {
Text(currentPlaylist?.title ?? "Select playlist")
.frame(maxWidth: 140, alignment: .leading)
} }
#endif #endif
} }