import { Loader2 } from 'lucide-react' import { FeeCard } from './FeeCard' import { firstName } from './format' import { NextClassCard } from './NextClassCard' import { PaymentReviewBanner } from './PaymentReviewBanner' import { useStudentApp } from './StudentAppProvider' import { TeacherNoticeCard } from './TeacherNoticeCard' import { WeekClassesList } from './WeekClassesList' import { useTranslation } from 'react-i18next' export function StudentHomeView() { const { me, student, classes, classesPending, fees } = useStudentApp() const { t } = useTranslation(['student', 'common']) if (!student) return null const allClasses = classes?.classes ?? [] const nextClass = allClasses.find((item) => !item.started) ?? null const weekEnd = classes ? Date.parse(classes.weekEndsAt) : 0 const thisWeek = allClasses.filter((item) => Date.parse(item.startsAt) < weekEnd) return (
{/* The account holder: the student, or the adult in charge of several kids. */}

{t('home.greeting', { name: firstName(me?.account.name ?? student.fullName) })}

{fees ? : null} {classesPending ? (
) : nextClass && classes ? ( ) : null} {fees ? : null} {classes ? : null}
) }