541aa3d52c
Playoffs: - List every round played so far (Round 1 → current) instead of only the current round, on both macOS menu and iPhone - Strike through the eliminated team's tricode in a finished series and drop the now-redundant "(Final … wins)" tag on completed earlier rounds - Refetch the bracket when a finished game implies more completed games than the cached bracket records, so the series score and round no longer get stuck on stale data after cold launch or the NHL bracket endpoint's lag API robustness: - Tolerate optional gameCenterLink/startTimeUTC on TBD playoff matchups so the scoreboard decode no longer aborts - Reject API state regressions via a monotonic FUT→…→OFF progression rank so a brief glitch can't downgrade a finished game back to "-:-"
87 lines
2.9 KiB
Swift
87 lines
2.9 KiB
Swift
//
|
|
// MainView.swift
|
|
// IceGlass-iOS
|
|
//
|
|
// Copyright 2026 Rouslan Zenetl. All Rights Reserved.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct MainView: View {
|
|
@Environment(ScoreboardViewModel.self) private var viewModel
|
|
@State private var showingSettings = false
|
|
|
|
var body: some View {
|
|
NavigationStack {
|
|
ScrollView {
|
|
LazyVStack(alignment: .leading, spacing: 16, pinnedViews: []) {
|
|
UpdatedHeader(
|
|
lastUpdated: viewModel.lastUpdated,
|
|
isRefreshing: viewModel.isRefreshing
|
|
)
|
|
.padding(.horizontal)
|
|
|
|
let roundGroups = viewModel.roundSeriesGroups
|
|
let latestRound = roundGroups.last?.round
|
|
ForEach(roundGroups, id: \.round) { group in
|
|
if !group.items.isEmpty {
|
|
PlayoffRoundSection(
|
|
round: group.round,
|
|
items: group.items,
|
|
showStatus: group.round == latestRound
|
|
)
|
|
.padding(.horizontal)
|
|
}
|
|
}
|
|
|
|
let gameDays = viewModel.gamesByDate
|
|
if gameDays.isEmpty && roundGroups.isEmpty {
|
|
emptyState
|
|
.padding(.horizontal)
|
|
.padding(.top, 40)
|
|
} else {
|
|
ForEach(gameDays, id: \.date) { gameDay in
|
|
GameDaySection(gameDay: gameDay)
|
|
.padding(.horizontal)
|
|
}
|
|
}
|
|
}
|
|
.padding(.vertical)
|
|
}
|
|
.refreshable {
|
|
await viewModel.refreshNow()
|
|
}
|
|
.navigationTitle("IceGlass")
|
|
.navigationBarTitleDisplayMode(.inline)
|
|
.toolbar {
|
|
ToolbarItem(placement: .topBarTrailing) {
|
|
Button {
|
|
showingSettings = true
|
|
} label: {
|
|
Image(systemName: "gearshape")
|
|
}
|
|
.accessibilityLabel("Settings")
|
|
}
|
|
}
|
|
.sheet(isPresented: $showingSettings) {
|
|
SettingsSheet()
|
|
}
|
|
}
|
|
}
|
|
|
|
private var emptyState: some View {
|
|
VStack(spacing: 8) {
|
|
Image(systemName: "hockey.puck")
|
|
.font(.system(size: 40))
|
|
.foregroundStyle(.tertiary)
|
|
Text("No games scheduled")
|
|
.font(.headline)
|
|
.foregroundStyle(.secondary)
|
|
Text("Pull down to refresh")
|
|
.font(.subheadline)
|
|
.foregroundStyle(.tertiary)
|
|
}
|
|
.frame(maxWidth: .infinity)
|
|
}
|
|
}
|