krz/daybyday

iOS learning games for young children: days, months, seasons, numbers, letters, animals and more. education ios kids swift https://krz.sh/apps/daybyday/

DayByDay/Parent/ChildProgressView.swift

062549ad26607ce9e973ed2a9a7ef6f853885f83
daybyday/DayByDay/Parent/ChildProgressView.swift history · blame · raw

44 lines · 1629 bytes

1 symbol in this file
 1//
 2//  ChildProgressView.swift
 3//  DayByDay
 4//
 5
 6import SwiftUI
 7
 8/// For grown-ups: what one child knows and is still mixing up, per topic.
 9struct ChildProgressView: View {
10    let profile: Profile
11
12    @Environment(ProfileSession.self) private var session
13
14    var body: some View {
15        List(DayByDay.Category.gridCases) { category in
16            let summary = ProgressSummary(category: category, progress: session.store.progress(for: profile, category: category))
17            HStack(alignment: .top, spacing: 14) {
18                // A fixed box, so wide symbols such as "abc" stay inside the circle.
19                Image(systemName: category.symbol)
20                    .resizable()
21                    .scaledToFit()
22                    .fontWeight(.semibold)
23                    .frame(width: 24, height: 24)
24                    .foregroundStyle(.white)
25                    .frame(width: 44, height: 44)
26                    .background(Circle().fill(category.color))
27                VStack(alignment: .leading, spacing: 4) {
28                    Text(category.label)
29                        .font(.system(.title3, design: .rounded, weight: .semibold))
30                    if let known = summary.known {
31                        Text(known)
32                    }
33                    if let missing = summary.missing {
34                        Text(missing)
35                            .fontWeight(.semibold)
36                    }
37                }
38            }
39            .padding(.vertical, 4)
40            .accessibilityElement(children: .combine)
41        }
42        .navigationTitle("\(profile.name)'s progress")
43    }
44}