Files
iceglass/IceGlass-iOS/Views/SeriesRow.swift
T
rzen 506bea04cc Add team logos and monospaced tricodes to iPhone game/series rows
New TeamLogo view loads bundled TeamLogos/{abbrev}.png with a UIImage
cache so scrolling doesn't repeatedly re-decode. GameRow and SeriesRow
now render [logo] TRI @ [logo] TRI with tricodes in a monospaced font
so columns line up regardless of which letters are present. SF Symbol
fallback when an abbrev has no bundled logo (e.g. "TBD" for unfilled
playoff slots).
2026-04-25 15:14:20 -04:00

87 lines
2.6 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//
// SeriesRow.swift
// IceGlass-iOS
//
// Copyright 2026 Rouslan Zenetl. All Rights Reserved.
//
import SwiftUI
struct SeriesRow: View {
let item: MainService.RoundSeriesItem
var body: some View {
Button(action: open) {
HStack(alignment: .center, spacing: 10) {
matchupBlock
Spacer(minLength: 8)
VStack(alignment: .trailing, spacing: 2) {
Text(statusText)
.font(.caption)
.fontWeight(.medium)
.foregroundStyle(.secondary)
if let trailing = trailingText {
Text(trailing)
.font(.caption2)
.foregroundStyle(.tertiary)
}
}
}
.padding(.horizontal, 14)
.padding(.vertical, 10)
.contentShape(Rectangle())
}
.buttonStyle(.plain)
}
private var matchupBlock: some View {
let bottom = item.series.bottomSeedTeam?.abbrev ?? "TBD"
let top = item.series.topSeedTeam?.abbrev ?? "TBD"
return VStack(alignment: .leading, spacing: 4) {
HStack(spacing: 6) {
TeamLogo(abbrev: bottom)
Text(bottom)
.font(.body.monospaced())
.fontWeight(.medium)
.foregroundStyle(.primary)
Text("@")
.font(.subheadline)
.foregroundStyle(.tertiary)
TeamLogo(abbrev: top)
Text(top)
.font(.body.monospaced())
.fontWeight(.medium)
.foregroundStyle(.primary)
}
Text(scoreText)
.font(.caption.monospacedDigit())
.foregroundStyle(.secondary)
}
}
private var scoreText: String {
"\(item.series.bottomSeedWins) \(item.series.topSeedWins)"
}
private var statusText: String {
if let winner = item.series.winner {
return "Final · \(winner) wins"
}
if let n = item.series.nextGameNumber {
return "Game \(n)"
}
return ""
}
private var trailingText: String? {
guard item.series.winner == nil else { return nil }
return item.nextGame?.nextGameLabel
}
private func open() {
guard let urlString = item.series.fullSeriesUrl,
let url = URL(string: urlString) else { return }
UIApplication.shared.open(url)
}
}