diff --git a/src/components/Asks/AskHosting.tsx b/src/components/Asks/AskHosting.tsx index b04bf81..11b3f25 100644 --- a/src/components/Asks/AskHosting.tsx +++ b/src/components/Asks/AskHosting.tsx @@ -19,12 +19,8 @@ export function AskHosting(asks: JSX.Element[], id: number): void { }, [dispatch, id, jwtToken, volunteerAsks?.hiddenAsks]) const [hosting] = useUserHosting() - const needsHosting = get(hosting, "needsHosting", false) - const canHostCount = get(hosting, "canHostCount", 0) - const distanceToFestival = get(hosting, "distanceToFestival", 0) - const hostingComment = get(hosting, "hostingComment", "") - const needToShow = - !needsHosting && canHostCount === 0 && distanceToFestival === 0 && hostingComment === "" + const hostingType = get(hosting, "hostingType", false) + const needToShow = hostingType === "" addAsk( asks, diff --git a/src/components/Asks/AskMeals.tsx b/src/components/Asks/AskMeals.tsx index 65ba699..f40b90d 100644 --- a/src/components/Asks/AskMeals.tsx +++ b/src/components/Asks/AskMeals.tsx @@ -1,7 +1,7 @@ import { get } from "lodash" import { useCallback } from "react" import { fetchVolunteerAsksSet } from "../../store/volunteerAsksSet" -import { useAskTools, addAsk, answerLaterOnProfile } from "./utils" +import { useAskTools, addAsk, answerLaterOnProfileBefore } from "./utils" import MealsForm, { fetchFor as fetchForMealsForm } from "../VolunteerBoard/MealsForm/MealsForm" import { useUserMeals } from "../VolunteerBoard/meals.utils" @@ -16,13 +16,9 @@ export function AskMeals(asks: JSX.Element[], id: number): void { ) }, [dispatch, id, jwtToken, volunteerAsks?.hiddenAsks]) - const [meals] = useUserMeals() - const needsMeals = get(meals, "needsMeals", false) - const canHostCount = get(meals, "canHostCount", 0) - const distanceToFestival = get(meals, "distanceToFestival", 0) - const mealsComment = get(meals, "mealsComment", "") - const needToShow = - !needsMeals && canHostCount === 0 && distanceToFestival === 0 && mealsComment === "" + const [userMeals] = useUserMeals() + const meals = get(userMeals, "meals", []) + const needToShow = meals.length === 0 addAsk( asks, @@ -30,7 +26,9 @@ export function AskMeals(asks: JSX.Element[], id: number): void { volunteerAsks, false, needToShow, - {answerLaterOnProfile} + + {answerLaterOnProfileBefore("31 mai à minuit pour commander les repas !")} + ) } diff --git a/src/components/Asks/index.tsx b/src/components/Asks/index.tsx index 7e28a9c..d08ce1d 100644 --- a/src/components/Asks/index.tsx +++ b/src/components/Asks/index.tsx @@ -7,14 +7,14 @@ import { AskWelcome } from "./AskWelcome" // import { AskRetex, fetchFor as fetchForRetex } from "./AskRetex" import { AskDiscord, fetchFor as fetchForDiscord } from "./AskDiscord" import { AskDayWishes, fetchFor as fetchForDayWishes } from "./AskDayWishes" -// import { AskHosting, fetchFor as fetchForHosting } from "./AskHosting" -// import { AskMeals, fetchFor as fetchForMeals } from "./AskMeals" +import { AskHosting, fetchFor as fetchForHosting } from "./AskHosting" +import { AskMeals, fetchFor as fetchForMeals } from "./AskMeals" // import { AskPersonalInfo, fetchFor as fetchForPersonalInfo } from "./AskPersonalInfo" import { AskTeamWishes, fetchFor as fetchForTeamWishes } from "./AskTeamWishes" -// import { -// AskParticipationDetails, -// fetchFor as fetchForParticipationDetails, -// } from "./AskParticipationDetails" +import { + AskParticipationDetails, + fetchFor as fetchForParticipationDetails, +} from "./AskParticipationDetails" // import { AskPushNotif } from "./AskPushNotif" const Asks = (): JSX.Element | null => { @@ -28,10 +28,10 @@ const Asks = (): JSX.Element | null => { AskDayWishes(asks, 10) AskTeamWishes(asks, 11) - // AskParticipationDetails(asks, 12) - // AskPersonalInfo(asks, 15) - // AskHosting(asks, 20) - // AskMeals(asks, 22) + AskMeals(asks, 15) + // AskPersonalInfo(asks, 16) + AskHosting(asks, 20) + AskParticipationDetails(asks, 22) // AskPushNotif(asks, 99) @@ -42,6 +42,9 @@ const Asks = (): JSX.Element | null => {