Add the full school maturita reading list of 82 books.

Keep full quizzes for 1984 and Spalovač mrtvol; other titles get catalog metadata stubs across Swift, GTK, and content.json.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
pepaskopec-blip 2026-09-22 11:01:32 +02:00
commit f813595bba
10 changed files with 949 additions and 45 deletions

View file

@ -50,7 +50,10 @@ enum Route: Hashable {
case .mluvnice: return "mluvnice"
case .mluvEx(let n): return "mluve\(n)"
case .readingList: return "readinglist"
case .book(let id): return id == "1984" ? "cetba1984" : "cetbaFuks"
case .book(let id):
if id == "1984" { return "cetba1984" }
if id == "fuks" { return "cetbaFuks" }
return "cetba_" + id.replacingOccurrences(of: "-", with: "_")
case .bookQuiz(let id): return id == "1984" ? "cetba1984quiz" : "cetbaFuksQuiz"
case .bookPlot(let id): return id == "1984" ? "cetba1984dej" : "cetbaFuksDej"
}
@ -120,6 +123,10 @@ func routeFromPage(_ page: String) -> Route? {
case "cetbaFuksQuiz": return .bookQuiz("fuks")
case "cetbaFuksDej": return .bookPlot("fuks")
default:
if page.hasPrefix("cetba_") {
let slug = String(page.dropFirst(6)).replacingOccurrences(of: "_", with: "-")
return .book(slug)
}
if let m = page.wholeMatch(of: /unit(\d+)/), let n = Int(m.1) {
return .unitMap(n - 1)
}

View file

@ -887,7 +887,10 @@ struct BookListScreen: View {
Label {
VStack(alignment: .leading) {
Text(b.str("title"))
Text(vm.tr(b.str("subKey"))).font(.caption).foregroundStyle(.secondary)
let genre = b.str("genre")
Text(genre.isEmpty ? vm.tr(b.str("subKey")) : genre)
.font(.caption)
.foregroundStyle(.secondary)
}
} icon: {
Image(systemName: "book.fill")
@ -907,25 +910,31 @@ struct BookScreen: View {
var body: some View {
if let b = vm.content.book(id) {
let hasQuiz = !b.arr("quiz").isEmpty
let hasPlot = !b.arr("plot").isEmpty
List {
NavigationLink(value: Route.bookQuiz(id)) {
Label {
VStack(alignment: .leading) {
Text(vm.tr(b.str("quizTitle")))
Text(vm.tr(b.str("quizSub"))).font(.caption).foregroundStyle(.secondary)
if hasQuiz {
NavigationLink(value: Route.bookQuiz(id)) {
Label {
VStack(alignment: .leading) {
Text(vm.tr(b.str("quizTitle")))
Text(vm.tr(b.str("quizSub"))).font(.caption).foregroundStyle(.secondary)
}
} icon: {
Image(systemName: "questionmark.circle")
}
} icon: {
Image(systemName: "questionmark.circle")
}
}
NavigationLink(value: Route.bookPlot(id)) {
Label {
VStack(alignment: .leading) {
Text(vm.tr(b.str("plotTitle")))
Text(vm.tr(b.str("plotSub"))).font(.caption).foregroundStyle(.secondary)
if hasPlot {
NavigationLink(value: Route.bookPlot(id)) {
Label {
VStack(alignment: .leading) {
Text(vm.tr(b.str("plotTitle")))
Text(vm.tr(b.str("plotSub"))).font(.caption).foregroundStyle(.secondary)
}
} icon: {
Image(systemName: "list.number")
}
} icon: {
Image(systemName: "list.number")
}
}
ForEach(Array(b.arr("notes").enumerated()), id: \.offset) { _, note in