Add login form on pages where login is needed

This commit is contained in:
pikiou
2023-05-22 09:41:18 +02:00
parent 9338748b31
commit ef4d1e40ba
16 changed files with 115 additions and 38 deletions

View File

@@ -4,6 +4,7 @@ import { fetchVolunteerAsksSet } from "../../store/volunteerAsksSet"
import { useAskTools, addAsk, answerLaterOnProfileBefore } from "./utils"
import MealsForm, { fetchFor as fetchForMealsForm } from "../VolunteerBoard/MealsForm/MealsForm"
import { useUserMeals } from "../VolunteerBoard/meals.utils"
import { useUserDayWishes } from "../VolunteerBoard/daysWishes.utils"
export function AskMeals(asks: JSX.Element[], id: number): void {
const { dispatch, jwtToken, volunteerAsks } = useAskTools()
@@ -17,8 +18,11 @@ export function AskMeals(asks: JSX.Element[], id: number): void {
}, [dispatch, id, jwtToken, volunteerAsks?.hiddenAsks])
const [userMeals] = useUserMeals()
const [userWishes] = useUserDayWishes()
const participation = get(userWishes, "active", "inconnu") as string
const meals = get(userMeals, "meals", [])
const needToShow = meals.length === 0
const needToShow =
(participation === "oui" || participation === "peut-etre") && meals.length === 0
addAsk(
asks,

View File

@@ -6,6 +6,7 @@ import ParticipationDetailsForm, {
fetchFor as fetchForParticipationDetailsForm,
} from "../VolunteerBoard/ParticipationDetailsForm/ParticipationDetailsForm"
import { useUserParticipationDetails } from "../VolunteerBoard/participationDetails.utils"
import { useUserDayWishes } from "../VolunteerBoard/daysWishes.utils"
export function AskParticipationDetails(asks: JSX.Element[], id: number): void {
const { dispatch, jwtToken, volunteerAsks } = useAskTools()
@@ -19,9 +20,12 @@ export function AskParticipationDetails(asks: JSX.Element[], id: number): void {
}, [dispatch, id, jwtToken, volunteerAsks?.hiddenAsks])
const [participationDetails] = useUserParticipationDetails()
const [userWishes] = useUserDayWishes()
const participation = get(userWishes, "active", "inconnu") as string
const tshirtSize = get(participationDetails, "tshirtSize", "")
const food = get(participationDetails, "food", "")
const needToShow = !tshirtSize || !food
const needToShow =
(participation === "oui" || participation === "peut-etre") && (!tshirtSize || !food)
addAsk(
asks,

View File

@@ -46,7 +46,7 @@ const Asks = (): JSX.Element | null => {
dans <a href="/profil">Mon profil</a> :)
<br />
Tu as fait le tour des dernières infos ou questions importantes,
merci ! :)
merci !
<br />
Nous te préviendrons quand il y en aura de nouvelles.
<br />