Channels layout improvements, other UI fixes

This commit is contained in:
Arkadiusz Fal
2021-08-31 23:17:50 +02:00
parent 1651110a5d
commit b00b54ad2a
28 changed files with 633 additions and 192 deletions

View File

@@ -8,36 +8,50 @@ struct VideoView: View {
@Environment(\.verticalSizeClass) private var verticalSizeClass
#endif
@Environment(\.inNavigationView) private var inNavigationView
var video: Video
var layout: ListingLayout
var body: some View {
Button(action: { navigationState.playVideo(video) }) {
VStack {
if layout == .cells {
#if os(iOS)
if verticalSizeClass == .compact {
horizontalRow
.padding(.vertical, 4)
} else {
verticalRow
}
#else
verticalRow
#endif
} else {
horizontalRow
Group {
if inNavigationView {
NavigationLink(destination: VideoPlayerView(video)) {
content
}
} else {
Button(action: { navigationState.playVideo(video) }) {
content
}
}
#if os(macOS)
.background()
#endif
}
.modifier(ButtonStyleModifier(layout: layout))
.contentShape(RoundedRectangle(cornerRadius: 12))
.contextMenu { VideoContextMenuView(video: video) }
}
var content: some View {
VStack {
if layout == .cells {
#if os(iOS)
if verticalSizeClass == .compact {
horizontalRow
.padding(.vertical, 4)
} else {
verticalRow
}
#else
verticalRow
#endif
} else {
horizontalRow
}
}
#if os(macOS)
.background()
#endif
}
var horizontalRow: some View {
HStack(alignment: .top, spacing: 2) {
Section {
@@ -228,7 +242,7 @@ struct VideoListRowPreview: PreviewProvider {
VideoView(video: video, layout: .list)
}
}
.listStyle(GroupedListStyle())
.listStyle(.grouped)
HStack {
ForEach(Video.allFixtures) { video in

View File

@@ -24,7 +24,7 @@ struct VideosListView: View {
}
}
}
.listStyle(GroupedListStyle())
.listStyle(.grouped)
}
}
}

View File

@@ -4,8 +4,6 @@ import SwiftUI
struct VideosView: View {
@EnvironmentObject<NavigationState> private var navigationState
@State private var profile = Profile()
#if os(tvOS)
@Default(.layout) private var layout
#endif