six-card-golf/Shared/UI/CompactView.swift
Lukas Schaefer e01acce354
Add standalone app for playing outside of messages
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
2026-08-09 14:47:31 -04:00

50 lines
1.8 KiB
Swift

import SwiftUI
struct CompactView: View {
@ObservedObject var controller: GameController
var body: some View {
HStack(spacing: 16) {
VStack(alignment: .leading, spacing: 2) {
Text("Six Card Golf")
.font(.system(.headline, design: .rounded).weight(.bold))
Text(statusLine)
.font(.caption)
.foregroundStyle(.secondary)
}
Spacer()
VStack(alignment: .trailing, spacing: 6) {
if controller.gameID != nil {
Button { controller.tapOpenGame() } label: {
Text("Continue Game")
.font(.subheadline.weight(.semibold))
.padding(.horizontal, 14)
.padding(.vertical, 8)
}
.buttonStyle(.bordered)
}
Button { controller.tapNewGame() } label: {
Text("New Game")
.font(.subheadline.weight(.semibold))
.padding(.horizontal, 14)
.padding(.vertical, 8)
}
.buttonStyle(.borderedProminent)
}
}
.padding(.horizontal, 16)
.padding(.vertical, 10)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color(uiColor: .systemBackground))
}
private var statusLine: String {
if !controller.isLoggedIn { return "Sign in to play" }
if let id = controller.gameID {
if controller.isMyTurn { return "Game #\(id) — your turn" }
if controller.isWaitingForPlayers { return "Game #\(id) — waiting" }
return "Game #\(id)"
}
return "Start a game in this chat"
}
}