DayByDay/Parent/ChildProgressView.swift
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}