frontend/app/routes/repas.tsx
2025-08-21 11:33:43 +02:00

53 lines
1.5 KiB
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.

This file contains Unicode characters that might be confused with other characters. 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 Error from "~/components/error";
import Loader from "~/components/loader";
import { MainLayout } from "~/layout";
import { AUTH_ERROR, useUser } from "~/lib/api";
import { forceReload } from "~/lib/utils";
import { Button } from "~/components/ui/button";
import { Github } from "lucide-react";
import BottomNavigation from "~/components/bottom-nav";
export default function Repas() {
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>
}
>
{/* Under construction message */}
<div className="text-center mt-10">
<h2 className="text-xl font-semibold">
Cette fonctionnalité nest pas encore implémentée.
</h2>
<p className="mt-4">
Vous pouvez contribuer au développement du projet ici :
</p>
<Button
className="mt-4"
variant="default"
onClick={() => window.open(import.meta.env.VITE_GITHUB_URL, "_blank")}
>
<Github />
Contribuer sur GitHub
</Button>
</div>
<BottomNavigation activeId="repas" />
</MainLayout>
);
}