fix: meal registered status
All checks were successful
Deploy to Netlify / Deploy to Netlify (push) Successful in 1m30s
All checks were successful
Deploy to Netlify / Deploy to Netlify (push) Successful in 1m30s
This commit is contained in:
parent
81d73fd99d
commit
f2c6bbe9ea
1 changed files with 22 additions and 15 deletions
|
|
@ -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...
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue