fix: meal registered status
All checks were successful
Deploy to Netlify / Deploy to Netlify (push) Successful in 1m30s

This commit is contained in:
Nathan Lamy 2025-08-26 00:44:19 +02:00
parent 81d73fd99d
commit f2c6bbe9ea

View file

@ -6,9 +6,7 @@ import {
CookingPot, CookingPot,
Icon, Icon,
Carrot, Carrot,
LogIn,
CalendarCheck, CalendarCheck,
Check,
CheckCheck, CheckCheck,
Loader2, Loader2,
} from "lucide-react"; } from "lucide-react";
@ -30,7 +28,13 @@ const getCourseIcon = (courseName: string) => {
return <Utensils className="h-6 w-6" />; return <Utensils className="h-6 w-6" />;
}; };
export function DailyMenu({ meals, refetchMeals }: { meals: Meal[]; refetchMeals: () => Promise<any> }) { export function DailyMenu({
meals,
refetchMeals,
}: {
meals: Meal[];
refetchMeals: () => Promise<any>;
}) {
if (meals.length === 0) { if (meals.length === 0) {
return ( return (
<div className="flex items-center justify-center p-4"> <div className="flex items-center justify-center p-4">
@ -103,18 +107,21 @@ export function DailyMenu({ meals, refetchMeals }: { meals: Meal[]; refetchMeals
))} ))}
</div> </div>
{meal.submittable && {meal.isRegistered && (
(meal.isRegistered ? ( <Button
<Button variant="outline"
variant="outline" className="w-full bg-green-600 hover:bg-green-700 text-white mt-4 mb-1"
className="w-full bg-green-600 hover:bg-green-700 text-white mt-4 mb-1" // onClick={handleUnregister}
// onClick={handleUnregister} disabled
disabled >
> <CheckCheck className="h-5 w-5 mr-2" />
<CheckCheck className="h-5 w-5 mr-2" /> Vous êtes inscrit(e) à ce repas
Vous êtes inscrit(e) à ce repas </Button>
</Button> )}
) : isLoading ? ( {credentials &&
!meal.isRegistered &&
meal.submittable &&
(isLoading ? (
<Button variant="default" className="w-full mt-4 mb-1" disabled> <Button variant="default" className="w-full mt-4 mb-1" disabled>
<Loader2 className="h-5 w-5 mr-2 animate-spin" /> <Loader2 className="h-5 w-5 mr-2 animate-spin" />
Inscription en cours... Inscription en cours...