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:
Trey t
2026-03-30 21:30:28 -05:00
parent 127125ae1b
commit fda809fd2f
21 changed files with 851 additions and 129 deletions

View File

@@ -2,14 +2,28 @@ import SwiftUI
struct LeagueCenterView: View {
@Environment(GamesViewModel.self) private var gamesViewModel
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
@State private var viewModel = LeagueCenterViewModel()
@State private var selectedGame: Game?
private let rosterColumns = [
GridItem(.flexible(), spacing: 14),
GridItem(.flexible(), spacing: 14),
GridItem(.flexible(), spacing: 14),
]
private var rosterColumns: [GridItem] {
let columnCount: Int
#if os(iOS)
columnCount = horizontalSizeClass == .compact ? 1 : 2
#else
columnCount = 3
#endif
return Array(repeating: GridItem(.flexible(), spacing: 14), count: columnCount)
}
private var horizontalPadding: CGFloat {
#if os(iOS)
horizontalSizeClass == .compact ? 20 : 32
#else
56
#endif
}
var body: some View {
ScrollView {
@@ -40,7 +54,7 @@ struct LeagueCenterView: View {
messagePanel(playerErrorMessage, tint: .orange)
}
}
.padding(.horizontal, 56)
.padding(.horizontal, horizontalPadding)
.padding(.vertical, 40)
}
.background(screenBackground.ignoresSafeArea())
@@ -158,7 +172,7 @@ struct LeagueCenterView: View {
.padding(22)
.background(sectionPanel)
}
.buttonStyle(.card)
.platformCardStyle()
.disabled(linkedGame == nil)
}
@@ -218,7 +232,7 @@ struct LeagueCenterView: View {
}
.padding(.vertical, 4)
}
.focusSection()
.platformFocusSection()
.scrollClipDisabled()
}
}
@@ -306,12 +320,12 @@ struct LeagueCenterView: View {
.stroke(.white.opacity(0.08), lineWidth: 1)
)
}
.buttonStyle(.card)
.platformCardStyle()
}
}
.padding(.vertical, 4)
}
.focusSection()
.platformFocusSection()
.scrollClipDisabled()
}
}
@@ -356,7 +370,7 @@ struct LeagueCenterView: View {
.padding(24)
.background(sectionPanel)
.contentShape(RoundedRectangle(cornerRadius: 24, style: .continuous))
.focusable(true)
.platformFocusable()
}
}
}
@@ -391,7 +405,7 @@ struct LeagueCenterView: View {
.padding(16)
.background(sectionPanel)
}
.buttonStyle(.card)
.platformCardStyle()
}
}
}
@@ -482,7 +496,7 @@ struct LeagueCenterView: View {
.padding(24)
.background(sectionPanel)
.contentShape(RoundedRectangle(cornerRadius: 24, style: .continuous))
.focusable(true)
.platformFocusable()
}
}
}
@@ -580,7 +594,7 @@ struct LeagueCenterView: View {
.background(.white.opacity(0.08))
.clipShape(Capsule())
}
.buttonStyle(.card)
.platformCardStyle()
}
private func loadingPanel(title: String) -> some View {