mirror of
https://github.com/yattee/yattee.git
synced 2025-08-05 02:04:07 +00:00
Channels layout improvements, other UI fixes
This commit is contained in:
@@ -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
|
||||
|
@@ -24,7 +24,7 @@ struct VideosListView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.listStyle(GroupedListStyle())
|
||||
.listStyle(.grouped)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user