fix(schedule): hide empty days and lessons, update design and fonts

This commit is contained in:
kilyabin
2026-03-05 12:32:48 +04:00
parent e6ba2e0334
commit a6da1129c9
2 changed files with 8 additions and 26 deletions

View File

@@ -525,6 +525,9 @@ function parseTeacherSchedule(
subject: subject || groupShort || group || roomText,
}
// Если нет предмета и группы, это пустая пара
if (!subject && !groupShort && !group) continue
if (location || roomText) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error — расширяем union тип за счет наличия place
@@ -545,6 +548,9 @@ function parseTeacherSchedule(
})
}
// Фильтруем пустые дни для преподавателей
const filteredDays = days.filter(day => day.lessons.length > 0)
// Извлекаем wk из URL
const currentUrl = url || document.location?.href || ''
const wkMatch = currentUrl.match(/[?&]wk=(\d+)/)
@@ -570,7 +576,7 @@ function parseTeacherSchedule(
}
return {
days,
days: filteredDays,
currentWk,
availableWeeks,
}

View File

@@ -53,31 +53,7 @@ export default function TeacherPage(props: NextSerialized<PageProps>) {
if ('scrollRestoration' in history) {
history.scrollRestoration = 'auto'
}
let attempts = 0
const MAX_ATTEMPTS = 50 // Максимум 5 секунд (50 * 100ms)
const interval = setInterval(() => {
attempts++
const today = getDayOfWeek(new Date())
const todayBlock = document.getElementById(today)
if (todayBlock) {
const GAP = 48
const HEADER_HEIGHT = 64
window.scrollTo({ top: todayBlock.offsetTop - GAP - HEADER_HEIGHT, behavior: 'smooth' })
clearInterval(interval)
} else if (attempts >= MAX_ATTEMPTS) {
// Прекращаем попытки после максимального количества
clearInterval(interval)
}
}, 100)
// Cleanup функция для очистки интервала при размонтировании
return () => {
clearInterval(interval)
}
}, [schedule, error])
}, [error])
return (
<>