Update meals, tee-shirt and hosting forms

This commit is contained in:
pikiou
2023-05-22 08:26:15 +02:00
parent d58c4ed3ea
commit 459ef4a85d
21 changed files with 991 additions and 384 deletions

View File

@@ -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,

View File

@@ -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,
<MealsForm afterSubmit={onSubmit}>{answerLaterOnProfile}</MealsForm>
<MealsForm afterSubmit={onSubmit}>
{answerLaterOnProfileBefore("31 mai à minuit pour commander les repas !")}
</MealsForm>
)
}

View File

@@ -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 => {
<div className={styles.notificationsContent}>
<div className={styles.formLine}>
<label>
Si tu veux changer la réponse à l'une des questions posées ici, va
dans <a href="/profil">Mon profil</a> :)
<br />
Tu as fait le tour des dernières infos ou questions importantes,
merci ! :)
<br />
@@ -70,9 +73,9 @@ export const fetchFor = [
// ...fetchForRetex,
...fetchForDiscord,
...fetchForDayWishes,
// ...fetchForHosting,
// ...fetchForMeals,
...fetchForHosting,
...fetchForMeals,
...fetchForTeamWishes,
// ...fetchForParticipationDetails,
...fetchForParticipationDetails,
// ...fetchForPersonalInfo,
]

View File

@@ -61,3 +61,12 @@ export const answerLaterOnProfile = (
Tu pourras y répondre plus tard sur la page <a href="/profil">Mon profil</a>.
</>
)
export function answerLaterOnProfileBefore(textDate: string): JSX.Element {
return (
<>
Tu pourras y répondre plus tard sur la page <a href="/profil">Mon profil</a>.<br />
Il nous fait une réponse avant le {textDate}
</>
)
}