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