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>
This commit is contained in:
69
mlbTVOS/Views/Components/DataPanel.swift
Normal file
69
mlbTVOS/Views/Components/DataPanel.swift
Normal file
@@ -0,0 +1,69 @@
|
||||
import SwiftUI
|
||||
|
||||
enum DataPanelDensity {
|
||||
case compact
|
||||
case standard
|
||||
case featured
|
||||
|
||||
var padding: CGFloat {
|
||||
switch self {
|
||||
case .compact: DS.Spacing.panelPadCompact
|
||||
case .standard: DS.Spacing.panelPadStandard
|
||||
case .featured: DS.Spacing.panelPadFeatured
|
||||
}
|
||||
}
|
||||
|
||||
var cornerRadius: CGFloat {
|
||||
switch self {
|
||||
case .compact: DS.Radii.compact
|
||||
case .standard: DS.Radii.standard
|
||||
case .featured: DS.Radii.featured
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct DataPanel<Content: View>: View {
|
||||
let density: DataPanelDensity
|
||||
var teamAccentCode: String? = nil
|
||||
@ViewBuilder let content: () -> Content
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: 0) {
|
||||
if let code = teamAccentCode {
|
||||
RoundedRectangle(cornerRadius: 1.5)
|
||||
.fill(TeamAssets.color(for: code))
|
||||
.frame(width: 3)
|
||||
.padding(.vertical, 6)
|
||||
.padding(.leading, 4)
|
||||
}
|
||||
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
content()
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.padding(density.padding)
|
||||
}
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: density.cornerRadius)
|
||||
.fill(DS.Colors.panelFill)
|
||||
)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: density.cornerRadius)
|
||||
.strokeBorder(DS.Colors.panelStroke, lineWidth: 0.5)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Convenience initializers
|
||||
|
||||
extension DataPanel {
|
||||
init(
|
||||
_ density: DataPanelDensity = .standard,
|
||||
teamAccent: String? = nil,
|
||||
@ViewBuilder content: @escaping () -> Content
|
||||
) {
|
||||
self.density = density
|
||||
self.teamAccentCode = teamAccent
|
||||
self.content = content
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user