mirror of
https://github.com/pepaskopec-blip/Graduately.git
synced 2026-10-27 07:04:35 +00:00
Group the existing hardware lessons under year 1 and lock later years.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
f521904656
commit
9e072cb8ae
14 changed files with 191 additions and 17 deletions
|
|
@ -19,6 +19,7 @@ enum Route: Hashable {
|
|||
case netMap
|
||||
case netLesson(Int)
|
||||
case netEx(Int)
|
||||
case hwYears
|
||||
case hwMap
|
||||
case hwLesson(Int)
|
||||
case hwEx(Int)
|
||||
|
|
@ -43,6 +44,7 @@ enum Route: Hashable {
|
|||
case .netMap: return "netmap"
|
||||
case .netLesson(let id): return "netunit\(id)"
|
||||
case .netEx(let id): return "netex\(id)"
|
||||
case .hwYears: return "hwyears"
|
||||
case .hwMap: return "hwmap"
|
||||
case .hwLesson(let id): return "hwunit\(id)"
|
||||
case .hwEx(let id): return "hwex\(id)"
|
||||
|
|
@ -86,12 +88,14 @@ enum Route: Hashable {
|
|||
return [.netYears, .netMap, .netLesson(id)]
|
||||
case .netEx(let id):
|
||||
return [.netYears, .netMap, .netLesson(id), .netEx(id)]
|
||||
case .hwYears:
|
||||
return [.hwYears]
|
||||
case .hwMap:
|
||||
return [.hwMap]
|
||||
return [.hwYears, .hwMap]
|
||||
case .hwLesson(let id):
|
||||
return [.hwMap, .hwLesson(id)]
|
||||
return [.hwYears, .hwMap, .hwLesson(id)]
|
||||
case .hwEx(let id):
|
||||
return [.hwMap, .hwLesson(id), .hwEx(id)]
|
||||
return [.hwYears, .hwMap, .hwLesson(id), .hwEx(id)]
|
||||
case .czechMap:
|
||||
return [.czechMap]
|
||||
case .mluvnice:
|
||||
|
|
@ -118,6 +122,7 @@ func routeFromPage(_ page: String) -> Route? {
|
|||
case "roadmap": return .roadmap
|
||||
case "netyears": return .netYears
|
||||
case "netmap": return .netMap
|
||||
case "hwyears": return .hwYears
|
||||
case "hwmap": return .hwMap
|
||||
case "czechmap": return .czechMap
|
||||
case "mluvnice": return .mluvnice
|
||||
|
|
|
|||
|
|
@ -420,7 +420,7 @@ private func subjectSum(_ vm: AppModel, _ s: J) -> ProgressSum {
|
|||
case "netyears":
|
||||
sum.totalEx = vm.content.netLessons.count
|
||||
sum.doneEx = vm.content.netLessons.filter { vm.progress.netDone($0.int("id")) }.count
|
||||
case "hwmap":
|
||||
case "hwyears", "hwmap":
|
||||
sum.totalEx = vm.content.hw.count
|
||||
sum.doneEx = vm.content.hw.filter { vm.progress.hwDone($0.int("id")) }.count
|
||||
case "czechmap":
|
||||
|
|
@ -553,6 +553,10 @@ private func buildSearch(_ vm: AppModel) -> [Hit] {
|
|||
add(vm.tr(l.str("titleKey")), vm.tr("search_lesson"), "netunit\(l.int("id"))", extra: "site")
|
||||
add(vm.tr(l.str("titleKey")), vm.tr("search_exercise"), "netex\(l.int("id"))")
|
||||
}
|
||||
add(vm.tr("hw_year1"), vm.tr("search_lesson"), "hwmap", extra: "rocnik")
|
||||
add(vm.tr("hw_year2"), vm.tr("search_lesson"), "hwyears", locked: true, extra: "rocnik")
|
||||
add(vm.tr("hw_year3"), vm.tr("search_lesson"), "hwyears", locked: true, extra: "rocnik")
|
||||
add(vm.tr("hw_year4"), vm.tr("search_lesson"), "hwyears", locked: true, extra: "rocnik")
|
||||
for l in vm.content.hw {
|
||||
add(vm.tr(l.str("titleKey")), vm.tr("search_lesson"), "hwunit\(l.int("id"))", extra: "hardware")
|
||||
add(vm.tr(l.str("titleKey")), vm.tr("search_exercise"), "hwex\(l.int("id"))")
|
||||
|
|
@ -750,6 +754,29 @@ struct NetYearsScreen: View {
|
|||
}
|
||||
}
|
||||
|
||||
struct HwYearsScreen: View {
|
||||
@ObservedObject var vm: AppModel
|
||||
|
||||
var body: some View {
|
||||
List {
|
||||
NavigationLink(value: Route.hwMap) {
|
||||
ListRowLabel(title: vm.tr("hw_year1"), subtitle: vm.tr("hw_sub"))
|
||||
}
|
||||
ForEach(["hw_year2", "hw_year3", "hw_year4"], id: \.self) { key in
|
||||
Label {
|
||||
ListRowLabel(title: vm.tr(key), subtitle: vm.tr("hw_year_locked_sub"))
|
||||
} icon: {
|
||||
Image(systemName: "lock.fill")
|
||||
}
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
}
|
||||
.navigationTitle(vm.tr("Technické vybavení"))
|
||||
.navigationSubtitle(vm.tr("hw_years_sub"))
|
||||
.appListStyle()
|
||||
}
|
||||
}
|
||||
|
||||
struct LessonRow: Identifiable {
|
||||
let id: String
|
||||
let title: String
|
||||
|
|
@ -1295,10 +1322,12 @@ struct RouteDestination: View {
|
|||
}
|
||||
case .netEx(let id):
|
||||
NetQuizScreen(vm: vm, id: id)
|
||||
case .hwYears:
|
||||
HwYearsScreen(vm: vm)
|
||||
case .hwMap:
|
||||
LessonListScreen(
|
||||
vm: vm,
|
||||
title: vm.tr("Technické vybavení"),
|
||||
title: vm.tr("hw_year1"),
|
||||
subtitle: vm.tr("hw_sub"),
|
||||
rows: vm.content.hw.map { l in
|
||||
let id = l.int("id")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue