Add iOS/iPad target with platform-adaptive UI
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ struct StreamOptionsSheet: View {
|
||||
let game: Game
|
||||
var onWatch: ((BroadcastSelection) -> Void)?
|
||||
@Environment(GamesViewModel.self) private var viewModel
|
||||
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
|
||||
private var awayColor: Color { TeamAssets.color(for: game.awayTeam.code) }
|
||||
@@ -17,6 +18,22 @@ struct StreamOptionsSheet: View {
|
||||
viewModel.activeStreams.count < 4
|
||||
}
|
||||
|
||||
private var usesStackedLayout: Bool {
|
||||
#if os(iOS)
|
||||
horizontalSizeClass == .compact
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
}
|
||||
|
||||
private var horizontalPadding: CGFloat {
|
||||
usesStackedLayout ? 20 : 56
|
||||
}
|
||||
|
||||
private var verticalPadding: CGFloat {
|
||||
usesStackedLayout ? 24 : 42
|
||||
}
|
||||
|
||||
private var awayPitcherName: String? {
|
||||
guard let pitchers = game.pitchers else { return nil }
|
||||
let parts = pitchers.components(separatedBy: " vs ")
|
||||
@@ -32,12 +49,20 @@ struct StreamOptionsSheet: View {
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
VStack(spacing: 28) {
|
||||
HStack(alignment: .top, spacing: 28) {
|
||||
matchupColumn
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
ViewThatFits {
|
||||
HStack(alignment: .top, spacing: 28) {
|
||||
matchupColumn
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
actionRail
|
||||
.frame(width: 520, alignment: .leading)
|
||||
actionRail
|
||||
.frame(width: 520, alignment: .leading)
|
||||
}
|
||||
|
||||
VStack(alignment: .leading, spacing: 24) {
|
||||
matchupColumn
|
||||
actionRail
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
}
|
||||
|
||||
if !canAddMoreStreams {
|
||||
@@ -53,8 +78,8 @@ struct StreamOptionsSheet: View {
|
||||
.background(panelBackground)
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 56)
|
||||
.padding(.vertical, 42)
|
||||
.padding(.horizontal, horizontalPadding)
|
||||
.padding(.vertical, verticalPadding)
|
||||
}
|
||||
.background(sheetBackground.ignoresSafeArea())
|
||||
}
|
||||
@@ -470,7 +495,7 @@ struct StreamOptionsSheet: View {
|
||||
.fill(fill)
|
||||
)
|
||||
}
|
||||
.buttonStyle(.card)
|
||||
.platformCardStyle()
|
||||
.disabled(disabled)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user