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
excluded:
- Vendor
- Tests Apple TV
- Tests iOS
- Tests macOS

View File

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

View File

@ -74,25 +74,6 @@ struct PlaylistsView: View {
)
#endif
.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)
ToolbarItemGroup(placement: .bottomBar) {
Group {
@ -101,7 +82,7 @@ struct PlaylistsView: View {
.foregroundColor(.secondary)
} else {
selectPlaylistButton
.frame(maxWidth: 140)
.transaction { t in t.animation = .none }
}
Spacer()
@ -230,7 +211,7 @@ struct PlaylistsView: View {
Button("Cancel", role: .cancel) {}
}
#else
Menu(currentPlaylist?.title ?? "Select playlist") {
Menu {
ForEach(model.all) { playlist in
Button(action: { selectedPlaylistID = playlist.id }) {
if playlist == currentPlaylist {
@ -240,6 +221,9 @@ struct PlaylistsView: View {
}
}
}
} label: {
Text(currentPlaylist?.title ?? "Select playlist")
.frame(maxWidth: 140, alignment: .leading)
}
#endif
}