wip
This commit is contained in:
47
Workouts Watch App/Views/Exercises/ExerciseStateView.swift
Normal file
47
Workouts Watch App/Views/Exercises/ExerciseStateView.swift
Normal file
@ -0,0 +1,47 @@
|
||||
//
|
||||
// ExerciseStateView 2.swift
|
||||
// Workouts
|
||||
//
|
||||
// Created by rzen on 7/23/25 at 9:15 AM.
|
||||
//
|
||||
// Copyright 2025 Rouslan Zenetl. All Rights Reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ExerciseStateView: View {
|
||||
let title: String
|
||||
let isRest: Bool
|
||||
let isDone: Bool
|
||||
let elapsedSeconds: Int
|
||||
let onComplete: () -> Void
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 20) {
|
||||
Text(title)
|
||||
.font(.title)
|
||||
|
||||
Text(timeFormatted)
|
||||
.font(.system(size: 48, weight: .semibold, design: .monospaced))
|
||||
.foregroundStyle(isRest ? .orange : .accentColor)
|
||||
|
||||
if isDone {
|
||||
Button(action: onComplete) {
|
||||
Text("Done in \(10 - elapsedSeconds)s")
|
||||
.font(.headline)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.buttonStyle(.borderedProminent)
|
||||
.tint(.green)
|
||||
.padding(.horizontal)
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
|
||||
private var timeFormatted: String {
|
||||
let minutes = elapsedSeconds / 60
|
||||
let seconds = elapsedSeconds % 60
|
||||
return String(format: "%02d:%02d", minutes, seconds)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user