Files
WerkoutIOS/iphone/Werkout_ios/WerkoutTheme.swift
Trey t 5d39dcb66f
Some checks failed
Apple Platform CI / smoke-and-tests (push) Has been cancelled
Fix 28 issues from deep audit and UI audit + redesign changes
Deep audit (issues 2-14):
- Add missing WCSession handlers for applicationContext and userInfo
- Fix BoundedFIFOQueue race condition with serial dispatch queue
- Fix timer race condition with main thread guarantee
- Fix watch pause state divergence — phone is now source of truth
- Fix wrong notification posted on logout (createdNewWorkout → userLoggedOut)
- Fix POST status check to accept any 2xx (was exact match)
- Fix @StateObject → @ObservedObject for injected viewModel
- Add pull-to-refresh to CompletedWorkoutsView
- Fix typos: RefreshUserInfoFetcable, defualtPackageModle
- Replace string concatenation with interpolation
- Replace 6 @StateObject with @ObservedObject for BridgeModule.shared
- Replace 7 hardcoded AVPlayer URLs with BaseURLs.currentBaseURL

UI audit (issues 1-15):
- Fix GeometryReader eating VStack space — replaced with .overlay
- Fix refreshable continuation resuming before fetch completes
- Remove duplicate @State workouts — derive from DataStore
- Decouple leaf views from BridgeModule (pass discrete values)
- Convert selectedIds from Array to Set for O(1) lookups
- Extract .sorted() from var body into computed properties
- Move search filter out of ForEach render loop
- Replace import SwiftUI with import Combine in non-UI classes
- Mark all @State properties private
- Extract L/R exercise auto-add logic to WorkoutViewModel
- Use enumerated() instead of .indices in ForEach
- Make AddSupersetView frame flexible instead of fixed 300pt
- Hoist Set construction out of per-exercise filter loop
- Move ViewModel network fetch from init to load()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 10:24:52 -06:00

128 lines
4.2 KiB
Swift

//
// WerkoutTheme.swift
// Werkout_ios
//
// Design system: iOS 26 Liquid Glass + Industrial Gym Aesthetic
//
import SwiftUI
// MARK: - Design Tokens
enum WerkoutTheme {
// MARK: Colors
static let background = Color.black
static let surfaceCard = Color(white: 0.09)
static let surfaceElevated = Color(white: 0.12)
static let accent = Color("appColor")
static let accentNeon = Color(red: 0.75, green: 0.35, blue: 1.0)
static let success = Color(red: 0.0, green: 0.9, blue: 0.5)
static let danger = Color(red: 1.0, green: 0.25, blue: 0.3)
static let warning = Color(red: 1.0, green: 0.75, blue: 0.0)
static let textPrimary = Color.white
static let textSecondary = Color(white: 0.55)
static let textMuted = Color(white: 0.35)
static let divider = Color(white: 0.15)
// MARK: Typography
static let heroTitle = Font.system(size: 34, weight: .black, design: .rounded)
static let sectionTitle = Font.system(size: 20, weight: .heavy, design: .rounded)
static let cardTitle = Font.system(size: 17, weight: .bold)
static let bodyText = Font.system(size: 15, weight: .medium)
static let caption = Font.system(size: 12, weight: .semibold)
static let stat = Font.system(size: 48, weight: .black, design: .monospaced)
// MARK: Spacing
static let xs: CGFloat = 4
static let sm: CGFloat = 8
static let md: CGFloat = 16
static let lg: CGFloat = 24
static let xl: CGFloat = 32
// MARK: Corner Radius
static let cardRadius: CGFloat = 16
static let buttonRadius: CGFloat = 12
static let badgeRadius: CGFloat = 8
static let pillRadius: CGFloat = 20
}
// MARK: - Reusable View Modifiers
struct WerkoutCardModifier: ViewModifier {
func body(content: Content) -> some View {
content
.padding(WerkoutTheme.md)
.background(WerkoutTheme.surfaceCard)
.clipShape(RoundedRectangle(cornerRadius: WerkoutTheme.cardRadius, style: .continuous))
.overlay(
RoundedRectangle(cornerRadius: WerkoutTheme.cardRadius, style: .continuous)
.strokeBorder(WerkoutTheme.divider, lineWidth: 0.5)
)
}
}
struct WerkoutButtonModifier: ViewModifier {
var color: Color = WerkoutTheme.accent
func body(content: Content) -> some View {
content
.font(.system(size: 16, weight: .bold))
.foregroundStyle(.white)
.padding(.horizontal, WerkoutTheme.lg)
.padding(.vertical, WerkoutTheme.sm + 4)
.background(color)
.clipShape(RoundedRectangle(cornerRadius: WerkoutTheme.buttonRadius, style: .continuous))
}
}
struct WerkoutTextFieldModifier: ViewModifier {
func body(content: Content) -> some View {
content
.padding(12)
.background(WerkoutTheme.surfaceCard)
.clipShape(RoundedRectangle(cornerRadius: WerkoutTheme.buttonRadius, style: .continuous))
.overlay(
RoundedRectangle(cornerRadius: WerkoutTheme.buttonRadius, style: .continuous)
.strokeBorder(WerkoutTheme.accent.opacity(0.3), lineWidth: 1)
)
.foregroundStyle(WerkoutTheme.textPrimary)
}
}
extension View {
func werkoutCard() -> some View {
modifier(WerkoutCardModifier())
}
func werkoutButton(color: Color = WerkoutTheme.accent) -> some View {
modifier(WerkoutButtonModifier(color: color))
}
func werkoutTextField() -> some View {
modifier(WerkoutTextFieldModifier())
}
}
// MARK: - Button Style
struct WerkoutActionButtonStyle: ButtonStyle {
var color: Color = WerkoutTheme.accent
func makeBody(configuration: Configuration) -> some View {
configuration.label
.font(.system(size: 16, weight: .bold))
.foregroundStyle(.white)
.padding(.horizontal, WerkoutTheme.lg)
.padding(.vertical, WerkoutTheme.sm + 4)
.background(color)
.clipShape(RoundedRectangle(cornerRadius: WerkoutTheme.buttonRadius, style: .continuous))
.scaleEffect(configuration.isPressed ? 0.95 : 1.0)
.animation(.easeInOut(duration: 0.15), value: configuration.isPressed)
}
}