Group the existing hardware lessons under year 1 and lock later years.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
pepaskopec-blip 2026-09-25 21:32:40 +02:00
commit 9e072cb8ae
14 changed files with 191 additions and 17 deletions

View file

@ -210,8 +210,9 @@ private fun MaturitaAppBody(vm: AppViewModel) {
}
}
is Route.NetEx -> NetQuizScreen(vm, r.id)
Route.HwYears -> HwYearsScreen(vm)
Route.HwMap -> LessonListScreen(
vm, vm.tr("Technické vybavení"), vm.tr("hw_sub"),
vm, vm.tr("hw_year1"), vm.tr("hw_sub"),
vm.content.hw.map { l ->
val id = l.int("id")
LessonRow(vm.tr(l.str("titleKey")), vm.progress.hwDone(id), Route.HwLesson(id))

View file

@ -13,6 +13,7 @@ sealed class Route(val page: String) {
data object NetMap : Route("netmap")
data class NetLesson(val id: Int) : Route("netunit$id")
data class NetEx(val id: Int) : Route("netex$id")
data object HwYears : Route("hwyears")
data object HwMap : Route("hwmap")
data class HwLesson(val id: Int) : Route("hwunit$id")
data class HwEx(val id: Int) : Route("hwex$id")
@ -45,9 +46,10 @@ sealed class Route(val page: String) {
NetMap -> listOf(Subjects, NetYears, NetMap)
is NetLesson -> listOf(Subjects, NetYears, NetMap, this)
is NetEx -> listOf(Subjects, NetYears, NetMap, NetLesson(id), this)
HwMap -> listOf(Subjects, HwMap)
is HwLesson -> listOf(Subjects, HwMap, this)
is HwEx -> listOf(Subjects, HwMap, HwLesson(id), this)
HwYears -> listOf(Subjects, HwYears)
HwMap -> listOf(Subjects, HwYears, HwMap)
is HwLesson -> listOf(Subjects, HwYears, HwMap, this)
is HwEx -> listOf(Subjects, HwYears, HwMap, HwLesson(id), this)
CzechMap -> listOf(Subjects, CzechMap)
Mluvnice -> listOf(Subjects, CzechMap, Mluvnice)
is MluvEx -> listOf(Subjects, CzechMap, Mluvnice, this)
@ -66,6 +68,7 @@ fun routeFromPage(page: String): Route? = when (page) {
"roadmap" -> Route.Roadmap
"netyears" -> Route.NetYears
"netmap" -> Route.NetMap
"hwyears" -> Route.HwYears
"hwmap" -> Route.HwMap
"czechmap" -> Route.CzechMap
"mluvnice" -> Route.Mluvnice

View file

@ -294,7 +294,7 @@ private fun subjectSum(vm: AppViewModel, s: J): ProgressSum {
sum.totalEx = vm.content.netLessons.size
sum.doneEx = vm.content.netLessons.count { vm.progress.netDone(it.int("id")) }
}
"hwmap" -> {
"hwyears", "hwmap" -> {
sum.totalEx = vm.content.hw.size
sum.doneEx = vm.content.hw.count { vm.progress.hwDone(it.int("id")) }
}
@ -477,6 +477,10 @@ private fun buildSearch(vm: AppViewModel): List<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")
vm.content.hw.forEach { l ->
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")}")
@ -565,6 +569,20 @@ fun NetYearsScreen(vm: AppViewModel) {
}
}
@Composable
fun HwYearsScreen(vm: AppViewModel) {
DetailScaffold(vm, vm.tr("Technické vybavení"), vm.tr("hw_years_sub")) { inner ->
LazyColumn(contentPadding = PaddingValues(top = inner.calculateTopPadding(), bottom = inner.calculateBottomPadding() + 16.dp)) {
item {
NavRow(title = vm.tr("hw_year1"), subtitle = vm.tr("hw_sub"), leading = { Text("1.", style = MaterialTheme.typography.titleMedium) }) { vm.go(Route.HwMap) }
}
items(listOf("hw_year2", "hw_year3", "hw_year4")) { key ->
NavRow(title = vm.tr(key), subtitle = vm.tr("hw_year_locked_sub"), locked = true, onClick = null)
}
}
}
}
@Composable
fun CzechMapScreen(vm: AppViewModel) {
DetailScaffold(vm, vm.tr("Český jazyk a literatura"), vm.tr("czech_sub")) { inner ->