show classname instead of teacher name in teacher timetable view

This commit is contained in:
2026-08-09 12:19:57 +02:00
parent 39c16bd4ea
commit 889d8f67c5
21 changed files with 292 additions and 81 deletions
@@ -0,0 +1,19 @@
import '../../../../api/marianumconnect/queries/timetable_get_week/timetable_get_week_response.dart';
final RegExp _whitespaceRun = RegExp(r'\s+');
/// Collapses any line-break or whitespace run to a single space and trims.
/// Returns null when input is null or fully whitespace. Webuntis sometimes
/// returns multi-line values like "A30\n4" — this normalizes those so labels
/// render on a single line.
String? collapseWhitespace(String? s) {
if (s == null) return null;
final cleaned = s.replaceAll(_whitespaceRun, ' ').trim();
return cleaned.isEmpty ? null : cleaned;
}
/// "7a, 7b" — shared by the calendar tile factory and the home-widget mapper
/// so both surfaces render identical class labels on teacher plans.
extension LessonClassLabel on McTimetableEntry {
String? get classLabel => collapseWhitespace(classNames.join(', '));
}