-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSessionMarkers.swift
41 lines (35 loc) · 1.09 KB
/
SessionMarkers.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//
// SessionMarkers.swift
// Focal
//
// Created by Niek van de Pas on 08/04/2024.
//
import SwiftUI
struct SessionMarkers: View {
let goal: Int
let completedSessions: Int
let timerState: TimerState
let isRunning: Bool
var body: some View {
let currentCircleColor = isRunning ? timerState.color : .offWhite
HStack {
ForEach(0..<completedSessions, id: \.self) { index in
Circle()
.foregroundStyle(.workBlue)
.frame(width: 5, height: 5)
}
Circle()
.foregroundStyle(currentCircleColor)
.frame(width: 7, height: 7)
// If there are uncompleted sessions, render an empty circle for those
if completedSessions < goal {
ForEach(completedSessions+1..<goal, id: \.self) { index in
Circle()
.stroke(.white, lineWidth: 1)
.foregroundStyle(.appRed)
.frame(width: 5, height: 5)
}
}
}
}
}