import { FC, memo, useCallback } from "react" import get from "lodash/get" import styles from "./styles.module.scss" import { getDayLabel, useUserDayWishes } from "../daysWishes.utils" import useAction from "../../../utils/useAction" import { displayModal, MODAL_IDS } from "../../../store/ui" const DayWishes: FC = (): JSX.Element | null => { const [userWishes] = useUserDayWishes() const charter = get(userWishes, "charter", false) const participation = get(userWishes, "active", "inconnu") const dayWishesString = get(userWishes, "dayWishes", []).map(getDayLabel).join(", ") const comment = get(userWishes, "dayWishesComment", "") const execDisplayModal = useAction(displayModal) const onEdit = useCallback(() => execDisplayModal(MODAL_IDS.DAYWISHES), [execDisplayModal]) return (
Mon engagement
{!charter && (
Je n'ai pas encore accepté la charte du bénévole :(
)} {participation === "non" && (
Je ne participerai pas à PeL 2023 :(
)} {participation === "oui" && (
Je participerai à PeL 2023 !
)} {participation === "peut-etre" && (
Je ne sais pas encore si je participerai à PeL 2023
)} {participation === "à distance" && (
Je participerai à PeL 2023 ! Sans y être pendant le weekend.
)} {participation === "inconnu" && (
Participation à PeL 2023{" "} non renseignées
)} {participation !== "non" && (
Mes jours : {dayWishesString && {dayWishesString}} {!dayWishesString && Non renseignés}
)} {comment && (
Mon commentaire : {comment}
)}
) } export default memo(DayWishes)