frontend/app/routes/grades.tsx
2025-08-20 16:09:06 +02:00

35 lines
931 B
TypeScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { Navigate } from "react-router";
import BottomNavigation from "~/components/bottom-nav";
import Error from "~/components/error";
import GradesPage from "~/components/grades";
import Loader from "~/components/loader";
import { MainLayout } from "~/layout";
import { AUTH_ERROR, useUser } from "~/lib/api";
import { forceReload } from "~/lib/utils";
export default function Grade() {
const { user, isLoading, error } = useUser();
if (isLoading) {
return <Loader />;
}
if (error?.message === AUTH_ERROR) {
return <Navigate to="/login" replace />;
}
if (error) {
return <Error message={error.message} />;
}
return (
<MainLayout
header={
<h1 className="text-2xl font-bold" onClick={forceReload}>
Khollis&eacute; - {user.className}
</h1>
}
>
<GradesPage user={user} />
<BottomNavigation activeId="grades" />
</MainLayout>
);
}