Files
MLBApp/mlbTVOS/Views/Components/DesignSystem.swift
Trey t b5daddefd3 Add UI redesign: design system, dashboard density, game intelligence, feed tab, league leaders
Phase 1 - Design System: DesignSystem.swift (typography, colors, spacing
constants) and DataPanel.swift (reusable panel container with 3 densities
and optional team accent bar).

Phase 2 - Dashboard Density: LiveSituationBar (compact strip of all live
games with scores/innings/outs), MiniLinescoreView (R-H-E footer for game
cards), DiamondView (visual baseball diamond with runners and count).
Dashboard shows live situation bar when games are active. Game cards now
display mini linescore for live/final games.

Phase 3 - Game Center Intelligence: WinProbabilityChartView (full-game
line chart using Swift Charts with area fills), PitchArsenalView (pitch
type distribution with velocity bars). GameCenterViewModel now stores
full WP history array instead of just latest values.

Phase 4 - Feed Tab: MLBWebDataService (fetches league leaders from Stats
API, news headlines, transactions), FeedViewModel, FeedView with
reverse-chronological feed items. FeedItemView with colored edge bars
by category. Added 5th "Feed" tab to both tvOS and iOS.

Phase 5 - Intel Tab: LeaderboardView (top-5 stat cards with headshots),
integrated into LeagueCenterView. Renamed tabs: Games->Today,
League->Intel. LeagueCenterViewModel now fetches league leaders.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 13:12:09 -05:00

102 lines
3.9 KiB
Swift

import SwiftUI
// MARK: - The Dugout Design System
enum DS {
// MARK: - Colors
enum Colors {
static let background = Color(red: 0.02, green: 0.03, blue: 0.05)
static let panelFill = Color.white.opacity(0.04)
static let panelStroke = Color.white.opacity(0.06)
static let live = Color(red: 0.95, green: 0.22, blue: 0.22)
static let positive = Color(red: 0.20, green: 0.78, blue: 0.35)
static let warning = Color(red: 0.95, green: 0.55, blue: 0.15)
static let interactive = Color(red: 0.25, green: 0.52, blue: 0.95)
static let media = Color(red: 0.55, green: 0.35, blue: 0.85)
static let textPrimary = Color.white
static let textSecondary = Color.white.opacity(0.7)
static let textTertiary = Color.white.opacity(0.45)
static let textQuaternary = Color.white.opacity(0.2)
}
// MARK: - Typography
enum Fonts {
static let heroScore = Font.system(size: 72, weight: .black, design: .rounded).monospacedDigit()
static let largeScore = Font.system(size: 42, weight: .black, design: .rounded).monospacedDigit()
static let score = Font.system(size: 28, weight: .black, design: .rounded).monospacedDigit()
static let scoreCompact = Font.system(size: 22, weight: .bold, design: .rounded).monospacedDigit()
static let sectionTitle = Font.system(size: 28, weight: .bold, design: .rounded)
static let cardTitle = Font.system(size: 20, weight: .bold, design: .rounded)
static let cardTitleCompact = Font.system(size: 17, weight: .bold, design: .rounded)
static let dataValue = Font.system(size: 18, weight: .bold, design: .rounded).monospacedDigit()
static let dataValueCompact = Font.system(size: 15, weight: .semibold, design: .rounded).monospacedDigit()
static let body = Font.system(size: 15, weight: .medium)
static let bodySmall = Font.system(size: 13, weight: .medium)
static let caption = Font.system(size: 11, weight: .bold, design: .rounded)
// tvOS scaled variants
#if os(tvOS)
static let tvSectionTitle = Font.system(size: 36, weight: .bold, design: .rounded)
static let tvCardTitle = Font.system(size: 26, weight: .bold, design: .rounded)
static let tvScore = Font.system(size: 34, weight: .black, design: .rounded).monospacedDigit()
static let tvDataValue = Font.system(size: 22, weight: .bold, design: .rounded).monospacedDigit()
static let tvBody = Font.system(size: 20, weight: .medium)
static let tvCaption = Font.system(size: 15, weight: .bold, design: .rounded)
#endif
}
// MARK: - Spacing
enum Spacing {
#if os(tvOS)
static let panelPadCompact: CGFloat = 18
static let panelPadStandard: CGFloat = 24
static let panelPadFeatured: CGFloat = 32
static let sectionGap: CGFloat = 40
static let cardGap: CGFloat = 20
static let itemGap: CGFloat = 12
static let edgeInset: CGFloat = 50
#else
static let panelPadCompact: CGFloat = 12
static let panelPadStandard: CGFloat = 16
static let panelPadFeatured: CGFloat = 24
static let sectionGap: CGFloat = 28
static let cardGap: CGFloat = 14
static let itemGap: CGFloat = 8
static let edgeInset: CGFloat = 20
#endif
}
// MARK: - Radii
enum Radii {
static let compact: CGFloat = 14
static let standard: CGFloat = 18
static let featured: CGFloat = 22
}
}
// MARK: - Data Label Style
struct DataLabelStyle: ViewModifier {
func body(content: Content) -> some View {
content
.font(DS.Fonts.caption)
.foregroundStyle(DS.Colors.textQuaternary)
.textCase(.uppercase)
.kerning(1.5)
}
}
extension View {
func dataLabelStyle() -> some View {
modifier(DataLabelStyle())
}
}