DFStatusOrb.swift 1.16 KB
//
//  DFStatusOrb.swift
//  hippo-watch-extension
//

import SwiftUI

struct DFStatusOrb: View {
    let status: DFStressStatus
    let value: String

    var body: some View {
        ZStack {
            Circle()
                .fill(status.color.opacity(0.16))
            Circle()
                .stroke(status.color.opacity(0.34), lineWidth: 5)
            Circle()
                .trim(from: 0.12, to: 0.82)
                .stroke(status.color, style: StrokeStyle(lineWidth: 5, lineCap: .round))
                .rotationEffect(.degrees(110))
            if value.isEmpty {
                Image(systemName: "heart.text.square.fill")
                    .font(.system(size: 12, weight: .semibold))
                    .foregroundStyle(status.color)
            } else {
                VStack(spacing: -1) {
                    Text(value)
                        .font(.system(size: 14, weight: .bold, design: .rounded))
                        .foregroundStyle(.white)
                    Text("ms")
                        .font(.system(size: 7, weight: .medium))
                        .foregroundStyle(.white.opacity(0.74))
                }
            }
        }
    }
}