Add global variables for meeting dates

This commit is contained in:
pikiou
2022-04-29 01:52:08 +02:00
parent 514cf1b833
commit 18c6f75511
16 changed files with 311 additions and 25 deletions

View File

@@ -8,10 +8,15 @@ import {
fetchVolunteerDiscordIdIfNeed,
selectVolunteerDiscordId,
} from "../../store/volunteerDiscordId"
import {
fetchMiscDiscordInvitationIfNeed,
selectMiscDiscordInvitation,
} from "../../store/miscDiscordInvitation"
export function AskDiscord(asks: JSX.Element[], id: number): void {
const { dispatch, jwtToken, volunteerAsks } = useAskTools()
const discordId: string | undefined = useSelector(selectVolunteerDiscordId)
const discordInvitation = useSelector(selectMiscDiscordInvitation)
const onSubmit = useCallback((): void => {
dispatch(
@@ -38,8 +43,8 @@ export function AskDiscord(asks: JSX.Element[], id: number): void {
totalement via la gestion des notifications.
<br />
Pour rejoindre le serveur PeL, voici le lien d'invitation à cliquer :{" "}
<a href="https://discord.gg/eXhjKxSBB4" onClick={onSubmit}>
https://discord.gg/eXhjKxSBB4
<a href={discordInvitation} onClick={onSubmit}>
{discordInvitation}
</a>{" "}
!
</p>
@@ -64,4 +69,4 @@ export function AskDiscord(asks: JSX.Element[], id: number): void {
}
// Fetch server-side data here
export const fetchFor = [fetchVolunteerDiscordIdIfNeed]
export const fetchFor = [fetchVolunteerDiscordIdIfNeed, fetchMiscDiscordInvitationIfNeed]

View File

@@ -11,6 +11,10 @@ import { fetchVolunteerPartialAdd } from "../../store/volunteerPartialAdd"
import FormButton from "../Form/FormButton/FormButton"
import { validEmail } from "../../utils/standardization"
import { toastError } from "../../store/utils"
import {
fetchMiscMeetingDateListIfNeed,
selectMiscMeetingDateList,
} from "../../store/miscMeetingDateList"
interface Props {
dispatch: AppDispatch
@@ -43,6 +47,8 @@ const RegisterForm = ({ dispatch }: Props): JSX.Element => {
const [sending, setSending] = useState(false)
const [changingBackground, setChangingBackground] = useState(0)
const meetingDateList = useSelector(selectMiscMeetingDateList)
useEffect(() => {
const timer = setInterval(() => {
setChangingBackground((changingBackground + 1) % animations.length)
@@ -456,6 +462,14 @@ const RegisterForm = ({ dispatch }: Props): JSX.Element => {
>
Street Food Market
</a>
, ou à une soirée festive à 2 pas du lieu du festival, aux{" "}
<a
href="https://www.captainturtle.fr/aperos-petanque-paris/"
target="_blank"
rel="noreferrer"
>
apéros de la pétanque
</a>
.
</p>
</dd>
@@ -469,13 +483,13 @@ const RegisterForm = ({ dispatch }: Props): JSX.Element => {
</div>
<div className={styles.rightCol}>
<div className={styles.rightColContainer}>
{[
{ value: "13mai", desc: "Vendredi 13 mai" },
{ value: "24mai", desc: "Mardi 24 mai" },
{ value: "1juin", desc: "Mercredi 1er juin" },
{ value: "9juin", desc: "Jeudi 9 juin" },
{ value: "", desc: "Aucune date possible" },
].map((option) => (
{_.concat(
meetingDateList.map((meetingDetails) => ({
value: meetingDetails.meetingId,
desc: meetingDetails.meetingTitle,
})),
{ value: "", desc: "Aucune date possible" }
).map((option) => (
<label className={styles.longAnswerLabel} key={option.value}>
<input
type="radio"
@@ -793,3 +807,6 @@ const RegisterForm = ({ dispatch }: Props): JSX.Element => {
}
export default memo(RegisterForm)
// Fetch server-side data here
export const fetchFor = [fetchMiscMeetingDateListIfNeed]

View File

@@ -1,4 +1,5 @@
import { FC, memo, ReactNode, useCallback, useEffect, useRef, useState } from "react"
import { useSelector } from "react-redux"
import classnames from "classnames"
import get from "lodash/get"
import set from "lodash/set"
@@ -12,6 +13,10 @@ import {
import FormButton from "../../Form/FormButton/FormButton"
import { fetchVolunteerDayWishesSetIfNeed } from "../../../store/volunteerDayWishesSet"
import IgnoreButton from "../../Form/IgnoreButton/IgnoreButton"
import {
fetchMiscDiscordInvitationIfNeed,
selectMiscDiscordInvitation,
} from "../../../store/miscDiscordInvitation"
type Props = {
children?: ReactNode | undefined
@@ -23,6 +28,7 @@ const DayWishesForm: FC<Props> = ({ children, afterSubmit }): JSX.Element => {
const [selection, setSelection] = useState(daysChoiceSelectionDefaultState)
const commentRef = useRef<HTMLTextAreaElement | null>(null)
const [userWishes, saveWishes] = useUserDayWishes()
const discordInvitation = useSelector(selectMiscDiscordInvitation)
const onParticipationChange = (e: React.ChangeEvent<HTMLInputElement>) =>
setParticipation(e.target.value)
@@ -107,11 +113,7 @@ const DayWishesForm: FC<Props> = ({ children, afterSubmit }): JSX.Element => {
<br />
Si tu as besoin d&apos;infos, viens nous en parler sur le serveur Discord ! Pour
le rejoindre,{" "}
<a
href="https://discord.com/invite/eXhjKxSBB4"
target="_blank"
rel="noreferrer"
>
<a href={discordInvitation} target="_blank" rel="noreferrer">
clique ici{" "}
</a>
.
@@ -179,4 +181,4 @@ DayWishesForm.defaultProps = {
export default memo(DayWishesForm)
// Fetch server-side data here
export const fetchFor = [fetchVolunteerDayWishesSetIfNeed]
export const fetchFor = [fetchVolunteerDayWishesSetIfNeed, fetchMiscDiscordInvitationIfNeed]

View File

@@ -12,7 +12,7 @@ import ParticipationDetailsForm, {
fetchFor as fetchForParticipationDetailsForm,
} from "./VolunteerBoard/ParticipationDetailsForm/ParticipationDetailsForm"
import TeamAssignment, { fetchFor as fetchForTeamAssignment } from "./TeamAssignment/TeamAssignment"
import RegisterForm from "./RegisterForm"
import RegisterForm, { fetchFor as fetchForRegisterForm } from "./RegisterForm"
import TeamWishesForm, {
fetchFor as fetchForTeamWishesForm,
} from "./VolunteerBoard/TeamWishesForm/TeamWishesForm"
@@ -38,6 +38,7 @@ export {
TeamAssignment,
fetchForTeamAssignment,
RegisterForm,
fetchForRegisterForm,
TeamWishesForm,
fetchForTeamWishesForm,
VolunteerInfo,