Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Messages improvements + places helper #50

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion web/components/Campaign/CampaignHelper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ const CampaignHelper = ({
>
<Text flex={4}>
<Text as="span" fontWeight="bold" marginRight={1}>
{campaign ? campaign?.title : t('solidarity.helper_title')}
{campaign
? t('campaign.helper_title', { title: campaign?.title })
: t('solidarity.helper_title')}
</Text>
{campaign ? campaign.description : t('solidarity.helper')}
</Text>
Expand Down
3 changes: 1 addition & 2 deletions web/components/Campaign/CampaignProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ const CampaignProvider = ({ children }: ICampaignProvider) => {
useEffect(() => {
if (Boolean(campaigns?.length)) {
const activeCampaigns = campaigns?.map((campaign) => {
//const mode = getCampaignMode(campaign)
const mode = 'applications'
const mode = getCampaignMode(campaign)
const limitDate = getLimitDate(campaign, mode)
return { ...campaign, mode, limitDate }
})
Expand Down
39 changes: 39 additions & 0 deletions web/components/Campaign/PlaceAdmin/PlacesCampaignHelper.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { Box, HStack, Text } from '@chakra-ui/react'
import { useTranslation } from 'next-i18next'
import Pin from 'public/assets/img/pin-helper.svg'
import useCampaignContext from '~components/Campaign/useCampaignContext'
import { format } from '~utils/date'

const PlacesCampaignHelper = () => {
const { t } = useTranslation('place')
const { currentCampaign } = useCampaignContext()

if (
!currentCampaign ||
!['disponibilities', 'applications']?.includes(currentCampaign?.mode)
) {
return null
}

return (
<Box paddingY={4}>
<HStack backgroundColor="grayBackground" paddingX={6} paddingY={4}>
<Box>
<Pin stroke="black" height="26px" width="26px" />
</Box>
<Text>
<Text as="span" fontWeight="bold" marginRight={1}>
{t(`campaign.helpers.${currentCampaign.mode}.title`, {
title: currentCampaign?.title,
})}
</Text>
{t(`campaign.helpers.${currentCampaign.mode}.description`, {
date: format(currentCampaign?.limitDate, 'dd/MM/yyyy'),
})}
</Text>
</HStack>
</Box>
)
}

export default PlacesCampaignHelper
2 changes: 0 additions & 2 deletions web/components/Home/HomeActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ import useCampaignContext from '~components/Campaign/useCampaignContext'
import { Box, Stack } from '@chakra-ui/react'
import HomeSearch from '~components/Home/HomeSearch'
import HomeCampaignInsert from '~components/Campaign/HomeInsert/HomeCampaignInsert'
import { useRouter } from 'next/router'
import { format } from '~utils/date'

const HomeActions = () => {
const router = useRouter()
const { currentCampaign } = useCampaignContext()
const { mode, limitDate, title } = currentCampaign ?? {}
const hasActiveCampaign = Boolean(mode && limitDate)
Expand Down
4 changes: 3 additions & 1 deletion web/components/Home/HomePlaces.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ const HomePlaces = ({ campaign }: Props) => {
<Arrow />
</Box>
<Text textStyle="h2" mb={4} pl={3} lineHeight={1}>
{campaign ? campaign?.title : t('places.title')}
{campaign
? t('campaign.title', { title: campaign?.title })
: t('places.title')}
</Text>
{campaign && (
<Tag status="campaign">
Expand Down
2 changes: 2 additions & 0 deletions web/pages/compte/espaces/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { UsersPermissionsUser } from '~typings/api'
import { requireAuth } from '~utils/auth'
import { NextSeo } from 'next-seo'
import { useTranslation } from 'next-i18next'
import PlacesCampaignHelper from '~components/Campaign/PlaceAdmin/PlacesCampaignHelper'
interface Props {
user: UsersPermissionsUser
}
Expand All @@ -21,6 +22,7 @@ const AccountPlace = ({ user }: Props) => {
return (
<Loading isLoading={isLoading} isCentered>
<NextSeo title={t('title.places')} />
<PlacesCampaignHelper />
{!places || places?.length === 0 ? (
<InfoPlace />
) : (
Expand Down
9 changes: 9 additions & 0 deletions web/public/assets/img/pin-helper.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions web/public/locales/fr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,12 @@
"title": "Créneaux solidaires",
"tag": "Créneaux solidaires",
"helper_title": "Les créneaux solidaires ",
"helper": " sont proposés par les lieux inscrits sur la plateforme et sont réservables toute l'année selon les disponibilités proposées. La réservation est ouverte à toute compagnie inscrite sur Studio D"
"helper": "sont proposés par les lieux inscrits sur la plateforme et sont réservables toute l'année selon les disponibilités proposées. La réservation est ouverte à toute compagnie inscrite sur Studio D"
},
"campaign": {
"open": "Ouvert jusqu'au {{date}}",
"partner": "Partenaire {{title}}"
"partner": "Participe au dispositif {{title}}",
"helper_title": "Le dispositif {{title}}"
},
"show": "Découvrir"
}
4 changes: 2 additions & 2 deletions web/public/locales/fr/home.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
"btn": "Parcourir tous les espaces",
"campaign": {
"title": "Dispositif {{title}} ",
"cta": "Parcourir tous les espaces partenaires {{title}}"
"cta": "Parcourir tous les espaces partenaires du dispositif {{title}}"
}
},
"news": {
"title": "Les actus de la communauté",
"btn": "Toutes les actus"
},
"campaign": {
"tag": "Dispositif {{title}}",
"title": "Dispositif {{title}}",
"insert": {
"disponibilities": {
"title": "Inscrivez vos espaces !",
Expand Down
Loading
Loading