Skip to content

Commit

Permalink
Add nav links
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucieo committed Feb 23, 2024
1 parent cf42fe4 commit e0128b3
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
8 changes: 8 additions & 0 deletions web/components/FooterMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { Box, Flex, Text, Link as ChakraLink, Divider } from '@chakra-ui/react'
import { useTranslation } from 'next-i18next'
import SigninModal from '~components/Signin/SigninModal'
import { useSession } from 'next-auth/client'
import useCampaignContext from '~components/Campaign/useCampaignContext'

const MenuItem = ({ href, text }) => {
return (
Expand All @@ -26,6 +27,7 @@ const MenuItem = ({ href, text }) => {
const FooterMenu = () => {
const [session, loading] = useSession()
const { t } = useTranslation()
const { currentCampaign } = useCampaignContext()
return (
<Box>
<Flex pr={12}>
Expand Down Expand Up @@ -54,6 +56,12 @@ const FooterMenu = () => {
<Box>
<MenuItem href={ROUTE_CGU} text={t('nav.cgu')} />
<MenuItem href={ROUTE_USE_POLICY} text={t('nav.policy')} />
{currentCampaign && currentCampaign?.chart_url && (
<MenuItem
href={currentCampaign?.chart_url}
text={t('nav.campaign_chart', { title: currentCampaign?.title })}
/>
)}
</Box>
</Box>
)
Expand Down
10 changes: 9 additions & 1 deletion web/components/MobileMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,22 @@ const MobileMenu = ({ colorMode }: Props) => {
/>
<MenuItem
href={`${ROUTE_PLACES}?tab=1`}
text={t('nav.places_emergence')}
text={t('nav.places_emergence', {
title: currentCampaign?.title,
})}
/>
</>
) : (
<MenuItem href={ROUTE_PLACES} text={t('nav.places')} />
)}

<MenuItem href={ROUTE_PROJECT} text={t('nav.project')} />
{currentCampaign && currentCampaign?.article_link && (
<MenuItem
href={currentCampaign?.article_link}
text={t('nav.campaign', { title: currentCampaign?.title })}
/>
)}
<MenuItem href={ROUTE_ACTU} text={t('nav.news')} />
<MenuItem href={ROUTE_FAQ} text={t('nav.faq')} />
<MenuItem href={ROUTE_CONTACT} text={t('nav.contact')} />
Expand Down
10 changes: 9 additions & 1 deletion web/components/Navigation/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ const Header = ({ colorMode }: Props) => {
{t('nav.places_regular')}
</DropdownNavButton>
<DropdownNavButton href={`${ROUTE_PLACES}?tab=1`}>
{t('nav.places_emergence')}
{t('nav.places_emergence', {
title: currentCampaign?.title,
})}
</DropdownNavButton>
</MenuList>
</Portal>
Expand All @@ -108,6 +110,12 @@ const Header = ({ colorMode }: Props) => {
}}
/>
<NavButton href={ROUTE_PROJECT} text={t('nav.project')} />
{currentCampaign && currentCampaign?.article_link && (
<NavButton
href={currentCampaign?.article_link}
text={t('nav.campaign', { title: currentCampaign?.title })}
/>
)}
<NavButton href={ROUTE_ACTU} text={t('nav.news')} />
<NavButton href={ROUTE_FAQ} text={t('nav.faq')} />
<NavButton href={ROUTE_CONTACT} text={t('nav.contact')} />
Expand Down
6 changes: 4 additions & 2 deletions web/public/locales/fr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
"signin": "Connexion",
"cgu": "Conditions générales d'utilisation",
"policy": "Chartes StudioD",
"places_emergence": "Dispositif émergence",
"places_regular": "Créneaux solidaires"
"places_emergence": "Créneaux {{title}}",
"places_regular": "Créneaux solidaires",
"campaign": "Dispositif {{title}}",
"campaign_chart": "Charte StudioD – {{title}}"
},
"error": "Une erreur est survenue",
"success": "Enregistrement réussi",
Expand Down

0 comments on commit e0128b3

Please sign in to comment.