Skip to content

Commit

Permalink
ajout menu + jumbo finale
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtyMaury committed Oct 13, 2024
1 parent f03ef4e commit d06838f
Show file tree
Hide file tree
Showing 9 changed files with 700 additions and 30 deletions.
449 changes: 449 additions & 0 deletions data/menu/menu-traiteur.json

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion json_schemas/schema_menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@
"allergenes": {
"type": "array",
"items": { "$ref": "#/definitions/allergene" }
},
"vege": {
"type": "boolean"
},
"vegan": {
"type": "boolean"
}
},
"required": ["titreFR", "titreEN", "allergenes"]
Expand All @@ -46,7 +52,6 @@
"enum": [
"gluten",
"crustaces",
"vegetarien",
"oeufs",
"poissons",
"arachides",
Expand Down
1 change: 1 addition & 0 deletions locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
"gluten": "Gluten",
"crustaces": "Shellfish",
"vegetarien": "Vegetarian",
"vegan": "Vegan",
"oeufs": "Eggs",
"poissons": "Fish",
"arachides": "Peanuts",
Expand Down
3 changes: 2 additions & 1 deletion locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"previous": "Édition 2022",
"schedule": "Programme",
"generate-ticket": "Générer mon billet",
"bring-ecocup": "N'oubliez pas vos propres eco-cups et sac !",
"bring-ecocup": "N'oubliez pas de prendre vos propres eco-cups et sac !",
"resend-tickets": "Renvoyer mes billets",
"get-app": "Appli mobile",
"offers": "Offres d'emploi"
Expand Down Expand Up @@ -85,6 +85,7 @@
"gluten": "Gluten",
"crustaces": "Crustacés",
"vegetarien": "Végétariens",
"vegan": "Vegan",
"oeufs": "Oeufs",
"poissons": "Poissons",
"arachides": "Arachides",
Expand Down
49 changes: 25 additions & 24 deletions src/components/home/jumbo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PhotoSharp, YouTube } from "@mui/icons-material";
import { Button, Stack, Typography } from "@mui/material";
import {Android, Apple, PhotoSharp, YouTube} from "@mui/icons-material";
import {Box, Button, Modal, Paper, Stack, Typography} from "@mui/material";
import React from "react";
import { useTranslation } from "react-i18next";

Expand Down Expand Up @@ -37,7 +37,7 @@ export const HomeJumbo = () => {
{/* <Button*/}
{/* color="secondary"*/}
{/* variant="contained"*/}
{/* href="https://devfest2022.gdgnantes.com"*/}
{/* href="https://devfest2023.gdgnantes.com"*/}
{/* aria-label={t("previous")}*/}
{/* >*/}
{/* {t("previous")}*/}
Expand All @@ -63,42 +63,41 @@ export const HomeJumbo = () => {
<Button
color="secondary"
variant="contained"
aria-label="Billetterie"
aria-label={t('schedule')}
href="/schedule"
>
{t('schedule')}
</Button>
<Button
color="secondary"
variant="contained"
aria-label={t("offers")}
href="https://billetterie.gdgnantes.com"
aria-label={t('resend-tickets')}
target={"_blank"}
href="https://nantes.francedigitaljobs.fr/search-list-jobs?id=&titre=&city=&categorie=&niveau=&type=&teletravail="
>
{t('offers')}
{t('resend-tickets')}
</Button>
</Stack>
<Stack direction="row" spacing={3} justifyContent={"center"}>

{/*
<Button
color="secondary"
variant="contained"
href="https://billetterie.gdgnantes.com"
aria-label="Send tickets"
target={"_blank"}
>
{t('resend-tickets')}
</Button>
<Button
color="secondary"
variant="outlined"
onClick={() => setModalOpen(true)}
aria-label="Send tickets"
aria-label={t('get-app')}
>
{t('get-app')}
</Button> */}
</Button>
<Button
color="secondary"
variant="contained"
aria-label={t("offers")}
target={"_blank"}
href="https://nantes.francedigitaljobs.fr/search-list-jobs?id=&titre=&city=&categorie=&niveau=&type=&teletravail="
>
{t('offers')}
</Button>
{/*<Button
color="secondary"
startIcon={<YouTube />}
variant="contained"
Expand All @@ -117,15 +116,15 @@ export const HomeJumbo = () => {
target={"_blank"}
>
Photos
</Button>
</Button>*/}
</Stack>
{/* <Stack direction="row" spacing={3} justifyContent={"center"}>
<Stack direction="row" spacing={3} justifyContent={"center"}>
<Button href="/our-values" color="secondary">{t('bring-ecocup')}</Button>
</Stack> */}
</Stack>
</Stack>
</div>

{/* <Modal open={modalOpen} onClose={() => setModalOpen(false)} className={"modal-apps"}>
<Modal open={modalOpen} onClose={() => setModalOpen(false)} className={"modal-apps"}>
<Paper className={"modal-content"}>
<Box className={"modal-body"}>
<Stack spacing={[5,5]} direction={["column", "row"]}>
Expand All @@ -134,6 +133,7 @@ export const HomeJumbo = () => {
variant="contained"
href="https://apps.apple.com/fr/app/devfest-nantes/id6443489706"
aria-label="iOS app"
target={"_blank"}
startIcon={<Apple/>}
>
iOS
Expand All @@ -143,14 +143,15 @@ export const HomeJumbo = () => {
variant="contained"
href="https://play.google.com/store/apps/details?id=com.gdgnantes.devfest.androidapp&pli=1"
aria-label="Android app"
target={"_blank"}
startIcon={<Android/>}
>
Android
</Button>
</Stack>
</Box>
</Paper>
</Modal> */}
</Modal>
</>
);
};
177 changes: 177 additions & 0 deletions src/components/menu-traiteur/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
import {Check, Close, ExpandMore} from "@mui/icons-material";
import {
Accordion,
AccordionDetails,
AccordionSummary,
Box,
Divider,
Stack,
Typography,
} from "@mui/material";
import classNames from "classnames";
import {StaticImage} from "gatsby-plugin-image";
import {useLocalization} from "gatsby-theme-i18n";
import React from "react";
import {useTranslation} from "react-i18next";
import MenuFR from "../../../data/menu/menu-traiteur.json";
import {Allergene} from "../../../json_schemas/interfaces/schema_menu";
import {MyLink} from "../../helpers/links";
import {DefaultSection, TertiarySection} from "../commun/section/section";
import "./styles.scss";

const ALLERGENES: Allergene[] = [
"gluten",
"crustaces",
"oeufs",
"poissons",
"arachides",
"soja",
"lactose",
"fruits-a-coques",
"celeri",
"moutarde",
"sesame",
"sulfites",
"lupin",
"mollusques",
];

export const MenuTraiteur: React.FC = () => {
const refVendredi = React.useRef<HTMLElement | null>(null);
React.useEffect(() => {
if (
refVendredi.current &&
new Date().toLocaleDateString("fr") === "21/10/2022"
) {
refVendredi.current.scrollIntoView();
}
}, [refVendredi]);
return (
<>
{Object.entries(MenuFR).map(([jour, sectionsJour], i) => (
<DefaultSection padding="none" key={jour} variant="primary">
{i !== 0 && <Divider/>}
<Typography
variant="h2"
ref={jour == "Vendredi" ? refVendredi : null}
>
{jour}
</Typography>
{sectionsJour.map((section) => (
<SectionMenu key={section.titreFR} section={section}/>
))}
</DefaultSection>
))}
<TertiarySection padding="none">
<MyLink
to="https://lamaisonhebel.fr/"
style={{width: "100%", display: "flex", justifyContent: "center"}}
>
<StaticImage
alt="La Maison Hebel"
src="https://lamaisonhebel.fr/wp-content/themes/hebel/hebel_img/logo.png"
objectFit="contain"
style={{width: "90%", height: "250px", maxWidth: "500px"}}
layout="constrained"
/>
</MyLink>
</TertiarySection>
</>
);
};

type TypeSectionMenu = typeof MenuFR["Jeudi"][0];

const SectionMenu: React.FC<{ section: TypeSectionMenu }> = ({section}) => {
const {locale} = useLocalization();

const keyTitre = locale === "fr" ? "titreFR" : "titreEN";
return (
<Box key={section.titreFR}>
<Typography
variant="h3"
style={{marginTop: "20px", marginBottom: "5px"}}
>
{section[keyTitre]}
</Typography>
{section.plats.map((plat) => (
<Accordion key={plat.titreFR}>
<AccordionSummary
expandIcon={<ExpandMore sx={{color: "white"}}/>}
aria-controls="voir les allergenes"
style={{
backgroundColor: "var(--secondary)",
}}
>
<Typography variant="h4">{plat[keyTitre]}</Typography>
</AccordionSummary>
<AccordionDetails
sx={{
backgroundColor: "var(--primary)",
}}
>
<AllergenesPlat plat={plat}/>
</AccordionDetails>
</Accordion>
))}
</Box>
);
};

type TypePlat = TypeSectionMenu["plats"][0];
const AllergenesPlat: React.FC<{ plat: TypePlat }> = ({plat}) => {
const {t} = useTranslation("translation", {
keyPrefix: "pages.menu.allergenes",
});

return (
<Stack direction="row" justifyContent="center" flexWrap="wrap">
{plat.vege && <IndicateurAllergenes allergene="vegetarien" isKO={false} isVege={true}/>}
{plat.vegan && <IndicateurAllergenes allergene="vegan" isKO={false} isVege={true}/>}
{ALLERGENES
.filter((allergene) => plat.allergenes.includes(allergene))
.map(allergene => <IndicateurAllergenes allergene={allergene} isKO={true} key={allergene} isVege={false}/>)
}
{!plat.vege && <IndicateurAllergenes allergene="vegetarien" isKO={true} isVege={true}/>}
{!plat.vegan && <IndicateurAllergenes allergene="vegan" isKO={true} isVege={true}/>}
{ALLERGENES
.filter((allergene) => !plat.allergenes.includes(allergene))
.map(allergene => <IndicateurAllergenes allergene={allergene} isKO={false} key={allergene} isVege={false}/>)
}
</Stack>
);
};

const IndicateurAllergenes: React.FC<{allergene: Allergene, isKO: boolean, isVege: boolean}> = ({allergene, isKO, isVege}) => {
const {t} = useTranslation("translation", {
keyPrefix: "pages.menu.allergenes",
});
return (
<Box
key={allergene}
className={classNames(
"allergene",
isKO && !isVege && "allergeneKO",
isVege && !isKO && "allergeneVege"
)}
>
<Stack
alignItems="center"
width="75px"
height="100%"
justifyContent="space-between"
>
<Typography
variant="subtitle1"
textAlign="center"
style={{
lineHeight: "1",
fontSize: "0.8rem"
}}
>
{t(allergene)}
</Typography>
{isKO ? <Close/> : <Check/>}
</Stack>
</Box>)
}
18 changes: 18 additions & 0 deletions src/components/menu-traiteur/styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.allergene {
border: 1px solid var(--primary-dark);
border-radius: 10px;
height: 70px;
padding: 5px 2px;
margin: 5px 2px;

&.allergeneKO {
border: 2px solid var(--secondary);
}
&.allergeneVege {
border: 2px solid #36ae5c;
}
}

.MuiAccordionDetails-root {
padding: 8px 8px 16px;
}
8 changes: 4 additions & 4 deletions src/navbar-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ export const MENU: Array<MenuItem> = [
label: "blog",
link: "/blog",
},
// {
// label: "menu",
// link: "/menu",
// },
{
label: "menu",
link: "/menu",
},
{
label: "jobs",
link: "https://nantes.francedigitaljobs.fr/search-list-jobs?id=&titre=&city=&categorie=&niveau=&type=&teletravail=",
Expand Down
18 changes: 18 additions & 0 deletions src/pages/menu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from "react";
import { useTranslation } from "react-i18next";
import { DefaultPage } from "../components/commun/page";
import { MenuTraiteur } from "../components/menu-traiteur";
import Layout from "../layout";

const MenuTraiteurPage = () => {
const { t } = useTranslation("translation", { keyPrefix: "pages.menu" });
return (
<Layout>
<DefaultPage title={t("name")} noHero>
<MenuTraiteur />
</DefaultPage>
</Layout>
);
};

export default MenuTraiteurPage;

0 comments on commit d06838f

Please sign in to comment.