Enlarge logos, tricodes, and inline scores on iPhone rows
Game and series rows now lead with a 40pt logo + title3-monospaced tricode + bold inline score + tricode + logo, so the matchup fills the row's vertical space and reads at a glance. For future games the score is replaced by an "@" separator. Right-side metadata (game number, status, kickoff time) stays at subheadline/caption2 so it's secondary. Tricodes and scores get .lineLimit(1).fixedSize() to keep everything on one line on tighter widths.
This commit is contained in:
@@ -10,6 +10,8 @@ import SwiftUI
|
|||||||
struct GameRow: View {
|
struct GameRow: View {
|
||||||
let game: Scoreboard.Game
|
let game: Scoreboard.Game
|
||||||
|
|
||||||
|
private static let logoSize: CGFloat = 40
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Button(action: open) {
|
Button(action: open) {
|
||||||
HStack(spacing: 10) {
|
HStack(spacing: 10) {
|
||||||
@@ -27,27 +29,45 @@ struct GameRow: View {
|
|||||||
rightContent
|
rightContent
|
||||||
}
|
}
|
||||||
.padding(.horizontal, 14)
|
.padding(.horizontal, 14)
|
||||||
.padding(.vertical, 10)
|
.padding(.vertical, 8)
|
||||||
.contentShape(Rectangle())
|
.contentShape(Rectangle())
|
||||||
}
|
}
|
||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var matchupBlock: some View {
|
private var matchupBlock: some View {
|
||||||
HStack(spacing: 6) {
|
let state = game.parsedGameState
|
||||||
TeamLogo(abbrev: game.awayTeam.abbrev)
|
let showScore = !state.isFuture
|
||||||
|
return HStack(spacing: 6) {
|
||||||
|
TeamLogo(abbrev: game.awayTeam.abbrev, size: Self.logoSize)
|
||||||
Text(game.awayTeam.abbrev)
|
Text(game.awayTeam.abbrev)
|
||||||
.font(.body.monospaced())
|
.font(.title3.monospaced())
|
||||||
.fontWeight(.medium)
|
.fontWeight(.semibold)
|
||||||
.foregroundStyle(.primary)
|
.foregroundStyle(.primary)
|
||||||
|
.lineLimit(1)
|
||||||
|
.fixedSize()
|
||||||
|
|
||||||
|
if showScore {
|
||||||
|
Text(scoreText)
|
||||||
|
.font(.title3.monospacedDigit())
|
||||||
|
.fontWeight(.bold)
|
||||||
|
.foregroundStyle(.primary)
|
||||||
|
.lineLimit(1)
|
||||||
|
.fixedSize()
|
||||||
|
.padding(.horizontal, 2)
|
||||||
|
} else {
|
||||||
Text("@")
|
Text("@")
|
||||||
.font(.subheadline)
|
.font(.title3)
|
||||||
.foregroundStyle(.tertiary)
|
.foregroundStyle(.tertiary)
|
||||||
TeamLogo(abbrev: game.homeTeam.abbrev)
|
}
|
||||||
|
|
||||||
Text(game.homeTeam.abbrev)
|
Text(game.homeTeam.abbrev)
|
||||||
.font(.body.monospaced())
|
.font(.title3.monospaced())
|
||||||
.fontWeight(.medium)
|
.fontWeight(.semibold)
|
||||||
.foregroundStyle(.primary)
|
.foregroundStyle(.primary)
|
||||||
|
.lineLimit(1)
|
||||||
|
.fixedSize()
|
||||||
|
TeamLogo(abbrev: game.homeTeam.abbrev, size: Self.logoSize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,35 +75,40 @@ struct GameRow: View {
|
|||||||
private var rightContent: some View {
|
private var rightContent: some View {
|
||||||
let state = game.parsedGameState
|
let state = game.parsedGameState
|
||||||
VStack(alignment: .trailing, spacing: 2) {
|
VStack(alignment: .trailing, spacing: 2) {
|
||||||
if state.isFuture {
|
Text(primaryRightLine)
|
||||||
Text(game.startTimeET.trimmingCharacters(in: .whitespaces))
|
|
||||||
.font(.subheadline.monospacedDigit())
|
.font(.subheadline.monospacedDigit())
|
||||||
.foregroundStyle(.secondary)
|
|
||||||
} else {
|
|
||||||
Text(scoreText)
|
|
||||||
.font(.body.monospacedDigit())
|
|
||||||
.fontWeight(.semibold)
|
|
||||||
.foregroundStyle(.primary)
|
|
||||||
Text(statusLine)
|
|
||||||
.font(.caption2)
|
|
||||||
.foregroundStyle(state.isLive ? .red : .secondary)
|
.foregroundStyle(state.isLive ? .red : .secondary)
|
||||||
|
if let secondary = secondaryRightLine {
|
||||||
|
Text(secondary)
|
||||||
|
.font(.caption2)
|
||||||
|
.foregroundStyle(.tertiary)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var primaryRightLine: String {
|
||||||
|
let state = game.parsedGameState
|
||||||
|
if state.isFuture {
|
||||||
|
return game.startTimeET.trimmingCharacters(in: .whitespaces)
|
||||||
|
}
|
||||||
|
let tag = state.shortTag
|
||||||
|
return tag.isEmpty
|
||||||
|
? game.startTimeET.trimmingCharacters(in: .whitespaces)
|
||||||
|
: tag
|
||||||
|
}
|
||||||
|
|
||||||
|
private var secondaryRightLine: String? {
|
||||||
|
let state = game.parsedGameState
|
||||||
|
guard !state.isFuture, !state.shortTag.isEmpty else { return nil }
|
||||||
|
// For finished games, show kickoff time below FINAL/OFF; for live games, just show tag.
|
||||||
|
if state.isLive { return nil }
|
||||||
|
return game.startTimeET.trimmingCharacters(in: .whitespaces)
|
||||||
|
}
|
||||||
|
|
||||||
private var scoreText: String {
|
private var scoreText: String {
|
||||||
let a = game.awayTeam.score ?? 0
|
let a = game.awayTeam.score ?? 0
|
||||||
let h = game.homeTeam.score ?? 0
|
let h = game.homeTeam.score ?? 0
|
||||||
return "\(a) – \(h)"
|
return "\(a)–\(h)"
|
||||||
}
|
|
||||||
|
|
||||||
private var statusLine: String {
|
|
||||||
let state = game.parsedGameState
|
|
||||||
let tag = state.shortTag
|
|
||||||
let time = game.startTimeET.trimmingCharacters(in: .whitespaces)
|
|
||||||
if tag.isEmpty { return time }
|
|
||||||
if state.isLive { return tag }
|
|
||||||
return tag
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func open() {
|
private func open() {
|
||||||
|
|||||||
@@ -10,14 +10,54 @@ import SwiftUI
|
|||||||
struct SeriesRow: View {
|
struct SeriesRow: View {
|
||||||
let item: MainService.RoundSeriesItem
|
let item: MainService.RoundSeriesItem
|
||||||
|
|
||||||
|
private static let logoSize: CGFloat = 40
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Button(action: open) {
|
Button(action: open) {
|
||||||
HStack(alignment: .center, spacing: 10) {
|
HStack(alignment: .center, spacing: 10) {
|
||||||
matchupBlock
|
matchupBlock
|
||||||
Spacer(minLength: 8)
|
Spacer(minLength: 8)
|
||||||
|
rightContent
|
||||||
|
}
|
||||||
|
.padding(.horizontal, 14)
|
||||||
|
.padding(.vertical, 8)
|
||||||
|
.contentShape(Rectangle())
|
||||||
|
}
|
||||||
|
.buttonStyle(.plain)
|
||||||
|
}
|
||||||
|
|
||||||
|
private var matchupBlock: some View {
|
||||||
|
let bottom = item.series.bottomSeedTeam?.abbrev ?? "TBD"
|
||||||
|
let top = item.series.topSeedTeam?.abbrev ?? "TBD"
|
||||||
|
return HStack(spacing: 6) {
|
||||||
|
TeamLogo(abbrev: bottom, size: Self.logoSize)
|
||||||
|
Text(bottom)
|
||||||
|
.font(.title3.monospaced())
|
||||||
|
.fontWeight(.semibold)
|
||||||
|
.foregroundStyle(.primary)
|
||||||
|
.lineLimit(1)
|
||||||
|
.fixedSize()
|
||||||
|
Text(seriesScore)
|
||||||
|
.font(.title3.monospacedDigit())
|
||||||
|
.fontWeight(.bold)
|
||||||
|
.foregroundStyle(.primary)
|
||||||
|
.lineLimit(1)
|
||||||
|
.fixedSize()
|
||||||
|
.padding(.horizontal, 2)
|
||||||
|
Text(top)
|
||||||
|
.font(.title3.monospaced())
|
||||||
|
.fontWeight(.semibold)
|
||||||
|
.foregroundStyle(.primary)
|
||||||
|
.lineLimit(1)
|
||||||
|
.fixedSize()
|
||||||
|
TeamLogo(abbrev: top, size: Self.logoSize)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private var rightContent: some View {
|
||||||
VStack(alignment: .trailing, spacing: 2) {
|
VStack(alignment: .trailing, spacing: 2) {
|
||||||
Text(statusText)
|
Text(statusText)
|
||||||
.font(.caption)
|
.font(.subheadline)
|
||||||
.fontWeight(.medium)
|
.fontWeight(.medium)
|
||||||
.foregroundStyle(.secondary)
|
.foregroundStyle(.secondary)
|
||||||
if let trailing = trailingText {
|
if let trailing = trailingText {
|
||||||
@@ -27,45 +67,14 @@ struct SeriesRow: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding(.horizontal, 14)
|
|
||||||
.padding(.vertical, 10)
|
|
||||||
.contentShape(Rectangle())
|
|
||||||
}
|
|
||||||
.buttonStyle(.plain)
|
|
||||||
}
|
|
||||||
|
|
||||||
private var matchupBlock: some View {
|
private var seriesScore: String {
|
||||||
let bottom = item.series.bottomSeedTeam?.abbrev ?? "TBD"
|
"\(item.series.bottomSeedWins)–\(item.series.topSeedWins)"
|
||||||
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 {
|
private var statusText: String {
|
||||||
if let winner = item.series.winner {
|
if let winner = item.series.winner {
|
||||||
return "Final · \(winner) wins"
|
return "\(winner) wins"
|
||||||
}
|
}
|
||||||
if let n = item.series.nextGameNumber {
|
if let n = item.series.nextGameNumber {
|
||||||
return "Game \(n)"
|
return "Game \(n)"
|
||||||
@@ -74,7 +83,7 @@ struct SeriesRow: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private var trailingText: String? {
|
private var trailingText: String? {
|
||||||
guard item.series.winner == nil else { return nil }
|
guard item.series.winner == nil else { return "Final" }
|
||||||
return item.nextGame?.nextGameLabel
|
return item.nextGame?.nextGameLabel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user