Fix tvOS memory crash: cap highlights to 50, replace blurs with gradients

The app was crashing from memory pressure on tvOS. Three causes fixed:

1. Feed was rendering all 418 highlights at once — capped to 50 items.

2. FeaturedGameCard had 3 blur effects (radius 80-120) on large circles
   for team color glow — replaced with a single LinearGradient. Same
   visual effect, fraction of the GPU memory.

3. BroadcastBackground had 3 blurred circles (radius 120-140, 680-900px)
   rendering on every screen — replaced with RadialGradients which are
   composited by the GPU natively without offscreen render passes.

Also fixed iOS build: replaced tvOS-only font refs (tvSectionTitle,
tvBody) with cross-platform equivalents in DashboardView fallback state.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-04-12 16:44:25 -05:00
parent 870fbcb844
commit 588b42ffed
12 changed files with 2004 additions and 744 deletions

View File

@@ -34,6 +34,8 @@ struct LeagueCenterView: View {
messagePanel(overviewErrorMessage, tint: .orange)
}
scheduleSection
#if os(tvOS)
// Side-by-side: standings left, leaders right
HStack(alignment: .top, spacing: 24) {
@@ -86,11 +88,11 @@ struct LeagueCenterView: View {
private var header: some View {
HStack(alignment: .top, spacing: 24) {
VStack(alignment: .leading, spacing: 8) {
Text("Around MLB")
Text("League Center")
.font(.system(size: 42, weight: .bold, design: .rounded))
.foregroundStyle(DS.Colors.textPrimary)
Text("Standings, league leaders, team context, roster access, and player snapshots in one control room.")
Text("Schedule navigation, standings, league leaders, roster access, and player snapshots in one board.")
.font(.system(size: 16, weight: .medium))
.foregroundStyle(DS.Colors.textTertiary)
}
@@ -100,7 +102,7 @@ struct LeagueCenterView: View {
HStack(spacing: 12) {
infoPill(title: "\(viewModel.leagueLeaders.count)", label: "Leaders", color: .blue)
infoPill(title: "\(viewModel.teams.count)", label: "Teams", color: .green)
infoPill(title: "\(viewModel.standings.count)", label: "Divisions", color: .orange)
infoPill(title: "\(viewModel.scheduleGames.count)", label: "Games", color: .orange)
}
}
}
@@ -737,15 +739,24 @@ struct LeagueCenterView: View {
private var sectionPanel: some View {
RoundedRectangle(cornerRadius: 24, style: .continuous)
.fill(DS.Colors.panelFill)
.fill(
LinearGradient(
colors: [
DS.Colors.panelFill,
DS.Colors.panelFillMuted,
],
startPoint: .topLeading,
endPoint: .bottomTrailing
)
)
.shadow(color: DS.Shadows.card, radius: DS.Shadows.cardRadius, y: DS.Shadows.cardY)
.overlay {
RoundedRectangle(cornerRadius: 24, style: .continuous)
.strokeBorder(DS.Colors.panelStroke, lineWidth: 0.5)
.strokeBorder(DS.Colors.panelStroke, lineWidth: 1)
}
}
private var screenBackground: some View {
DS.Colors.background
BroadcastBackground()
}
}