From 774d5cb991c075e95fcc81f305eb527013a7e9c3 Mon Sep 17 00:00:00 2001 From: lucieo Date: Tue, 27 Feb 2024 18:38:31 +0100 Subject: [PATCH] Fix messages and listings --- web/components/Campaign/CampaignTag.tsx | 28 +++-- .../Home/ApplicationsCampaignInsert.tsx | 78 ++++++++++++ .../Home/DisponibilitiesCampaignInsert.tsx | 70 +++++++++++ .../Campaign/Home/HomeCampaignInsert.tsx | 73 ----------- .../Campaign/HomeHelperCampaign.tsx | 50 ++++++++ .../Campaign/HomeHelperSolidarity.tsx | 51 ++++++++ .../Places/PlacesListCampaignHelper.tsx | 57 ++------- web/components/Home/HomeActions.tsx | 17 ++- web/components/Home/HomePlaces.tsx | 113 ------------------ web/components/Home/HomePlacesCampaign.tsx | 101 ++++++++++++++++ web/components/Home/HomePlacesSolidarity.tsx | 74 ++++++++++++ web/components/InputCity.tsx | 1 + web/components/InputDateRange.tsx | 2 +- web/components/Place/PlaceGrid.tsx | 6 +- web/components/Place/PlaceGridCard.tsx | 39 +++--- web/components/Place/PlaceList.tsx | 4 +- web/components/Place/PlaceListCard.tsx | 13 +- web/components/Place/PlacesPage.tsx | 38 ++++-- web/components/Place/PlacesTab.tsx | 2 +- web/pages/index.tsx | 8 +- 20 files changed, 537 insertions(+), 288 deletions(-) create mode 100644 web/components/Campaign/Home/ApplicationsCampaignInsert.tsx create mode 100644 web/components/Campaign/Home/DisponibilitiesCampaignInsert.tsx delete mode 100644 web/components/Campaign/Home/HomeCampaignInsert.tsx create mode 100644 web/components/Campaign/HomeHelperCampaign.tsx create mode 100644 web/components/Campaign/HomeHelperSolidarity.tsx delete mode 100644 web/components/Home/HomePlaces.tsx create mode 100644 web/components/Home/HomePlacesCampaign.tsx create mode 100644 web/components/Home/HomePlacesSolidarity.tsx diff --git a/web/components/Campaign/CampaignTag.tsx b/web/components/Campaign/CampaignTag.tsx index 036adac8..6c577820 100644 --- a/web/components/Campaign/CampaignTag.tsx +++ b/web/components/Campaign/CampaignTag.tsx @@ -7,23 +7,25 @@ import ApplicationCheck from 'public/assets/img/applicationCheck.svg' const CampaignTag = ({ isGrid, - isCampaignTab, + mode, disponibilitiesIds, hasCampaignDispo, }: { isGrid?: boolean - isCampaignTab?: boolean + mode?: 'solidarity' | 'campaign' disponibilitiesIds?: string[] hasCampaignDispo?: boolean }) => { const { applications } = useCurrentUser() - const { currentCampaign } = useCampaignContext() + const { currentCampaign, hasActiveCampaign } = useCampaignContext() const { t } = useTranslation('common') if ( applications ?.map((el) => el?.disponibility) - .some((el) => disponibilitiesIds?.includes(el)) + .some((el) => disponibilitiesIds?.includes(el)) && + hasActiveCampaign && + mode === 'campaign' ) { return ( @@ -44,7 +46,7 @@ const CampaignTag = ({ ) } - if (hasCampaignDispo && !isCampaignTab) { + if (hasCampaignDispo && mode === 'solidarity') { return ( - {t('campaign.partner', { - title: currentCampaign?.title, - })} + + {t('campaign.partner', { + title: currentCampaign?.title, + })} + ) diff --git a/web/components/Campaign/Home/ApplicationsCampaignInsert.tsx b/web/components/Campaign/Home/ApplicationsCampaignInsert.tsx new file mode 100644 index 00000000..d02a37e2 --- /dev/null +++ b/web/components/Campaign/Home/ApplicationsCampaignInsert.tsx @@ -0,0 +1,78 @@ +import { VStack, Text, Box, Button, HStack, Stack } from '@chakra-ui/react' +import Hands from 'public/assets/img/hands-outline.svg' +import theme from '~theme' +import { useTranslation } from 'next-i18next' +import { ROUTE_PLACES } from '~constants' +import Tag from '~components/Tag' +import Link from '~components/Link' +import useCampaignContext from '~components/Campaign/useCampaignContext' +import { format } from '~utils/date' +import ApplicationCounter from '~components/Campaign/ApplicationCounter' + +const ApplicationsCampaignInsert = () => { + const { currentCampaign } = useCampaignContext() + const { title, limitDate } = currentCampaign || {} + const { t } = useTranslation('home') + + return ( + + + {title} + + + + + + + + + {t(`campaign.insert.applications.title`)} + + + {t(`campaign.insert.applications.subtitle`, { + date: format(new Date(limitDate), 'd MMMM'), + })} + + + + + + + + + + + + + + ) +} + +export default ApplicationsCampaignInsert diff --git a/web/components/Campaign/Home/DisponibilitiesCampaignInsert.tsx b/web/components/Campaign/Home/DisponibilitiesCampaignInsert.tsx new file mode 100644 index 00000000..2d783b40 --- /dev/null +++ b/web/components/Campaign/Home/DisponibilitiesCampaignInsert.tsx @@ -0,0 +1,70 @@ +import { VStack, Text, Box, Button, HStack, Stack } from '@chakra-ui/react' +import Hands from 'public/assets/img/hands-outline.svg' +import theme from '~theme' +import { useTranslation } from 'next-i18next' +import { ROUTE_ACCOUNT_PLACES } from '~constants' +import Tag from '~components/Tag' +import Link from '~components/Link' +import useCampaignContext from '~components/Campaign/useCampaignContext' +import { format } from '~utils/date' + +const DisponibilitiesCampaingInsert = () => { + const { currentCampaign } = useCampaignContext() + const { title, limitDate } = currentCampaign || {} + const { t } = useTranslation('home') + + return ( + + + {title} + + + + + + + + + {t(`campaign.insert.disponibilities.title`)} + + + {t(`campaign.insert.disponibilities.subtitle`, { + date: format(new Date(limitDate), 'd MMMM'), + })} + + + + + + + + + + + ) +} + +export default DisponibilitiesCampaingInsert diff --git a/web/components/Campaign/Home/HomeCampaignInsert.tsx b/web/components/Campaign/Home/HomeCampaignInsert.tsx deleted file mode 100644 index 57679809..00000000 --- a/web/components/Campaign/Home/HomeCampaignInsert.tsx +++ /dev/null @@ -1,73 +0,0 @@ -import { VStack, Text, Box, Button, HStack } from '@chakra-ui/react' -import Hands from 'public/assets/img/hands-outline.svg' -import theme from '~theme' -import { useTranslation } from 'next-i18next' -import { ROUTE_ACCOUNT_PLACES, ROUTE_PLACES } from '~constants' -import Tag from '~components/Tag' -import Link from '~components/Link' -import useCampaignContext from '~components/Campaign/useCampaignContext' -import { format } from '~utils/date' -import ApplicationCounter from '~components/Campaign/ApplicationCounter' - -const HomeCampaignInsert = () => { - const { currentCampaign } = useCampaignContext() - const { title, mode, limitDate } = currentCampaign || {} - const { t } = useTranslation('home') - - return ( - - - {title} - - - - - - - {t(`campaign.insert.${mode}.title`)} - - - {t(`campaign.insert.${mode}.subtitle`, { - date: format(new Date(limitDate), 'd MMMM'), - })} - - - - - - - - - - - - ) -} - -export default HomeCampaignInsert diff --git a/web/components/Campaign/HomeHelperCampaign.tsx b/web/components/Campaign/HomeHelperCampaign.tsx new file mode 100644 index 00000000..5dab3b88 --- /dev/null +++ b/web/components/Campaign/HomeHelperCampaign.tsx @@ -0,0 +1,50 @@ +import { Text, Flex, Button, StackProps, VStack, Stack } from '@chakra-ui/react' +import { useTranslation } from 'next-i18next' +import useCampaignContext from '~components/Campaign/useCampaignContext' +import Link from '~components/Link' +import { ROUTE_PLACES } from '~constants' + +const HomeHelperCampaign = (props: StackProps) => { + const { t } = useTranslation('common') + const { currentCampaign } = useCampaignContext() + + return ( + + + + + {t('campaign.helper_title', { title: currentCampaign?.title })} + + + {currentCampaign.description} + + + + + + + + ) +} + +export default HomeHelperCampaign diff --git a/web/components/Campaign/HomeHelperSolidarity.tsx b/web/components/Campaign/HomeHelperSolidarity.tsx new file mode 100644 index 00000000..cb22ff4c --- /dev/null +++ b/web/components/Campaign/HomeHelperSolidarity.tsx @@ -0,0 +1,51 @@ +import { Text, Flex, Button, StackProps, VStack, Stack } from '@chakra-ui/react' +import { useTranslation } from 'next-i18next' +import Link from '~components/Link' +import { ROUTE_PROJECT } from '~constants' + +const HomeHelperSolidarity = ({ + limitLines, + isHome, + ...props +}: { + limitLines?: boolean + isHome?: boolean +} & StackProps) => { + const { t } = useTranslation('common') + + return ( + + + + + {t('solidarity.helper_title')} + + + {t('solidarity.helper')} + + + + + + + + ) +} + +export default HomeHelperSolidarity diff --git a/web/components/Campaign/Places/PlacesListCampaignHelper.tsx b/web/components/Campaign/Places/PlacesListCampaignHelper.tsx index a59d40a1..26c51f40 100644 --- a/web/components/Campaign/Places/PlacesListCampaignHelper.tsx +++ b/web/components/Campaign/Places/PlacesListCampaignHelper.tsx @@ -1,69 +1,38 @@ import { Text, Flex, Button, StackProps, VStack, Stack } from '@chakra-ui/react' import { useTranslation } from 'next-i18next' import ApplicationCounter from '~components/Campaign/ApplicationCounter' -import { CampaignDetailed } from '~components/Campaign/CampaignContext' +import useCampaignContext from '~components/Campaign/useCampaignContext' import Link from '~components/Link' -import { ROUTE_PLACES } from '~constants' -const PlacesListCampaignHelper = ({ - campaign, - limitLines, - isHome, - ...props -}: { - campaign?: CampaignDetailed - limitLines?: boolean - isHome?: boolean -} & StackProps) => { +const PlacesListCampaignHelper = (props: StackProps) => { const { t } = useTranslation('common') + const { currentCampaign } = useCampaignContext() return ( - {campaign && !isHome && ( - - )} - + + - {campaign - ? t('campaign.helper_title', { title: campaign?.title }) - : t('solidarity.helper_title')} - - - {campaign ? campaign.description : t('solidarity.helper')} + {t('campaign.helper_title', { title: currentCampaign?.title })} + {currentCampaign.description} - + diff --git a/web/components/Home/HomeActions.tsx b/web/components/Home/HomeActions.tsx index b13083be..3cc43380 100644 --- a/web/components/Home/HomeActions.tsx +++ b/web/components/Home/HomeActions.tsx @@ -1,10 +1,15 @@ import useCampaignContext from '~components/Campaign/useCampaignContext' import { Box, Stack } from '@chakra-ui/react' import HomeSearch from '~components/Home/HomeSearch' -import HomeCampaignInsert from '~components/Campaign/Home/HomeCampaignInsert' +import ApplicationsCampaignInsert from '~components/Campaign/Home/ApplicationsCampaignInsert' +import DisponibilitiesCampaingInsert from '~components/Campaign/Home/DisponibilitiesCampaignInsert' const HomeActions = () => { - const { hasActiveCampaign } = useCampaignContext() + const { + hasActiveCampaign, + currentCampaign, + isCampaignPlace, + } = useCampaignContext() return ( { {hasActiveCampaign && ( - + {currentCampaign?.mode === 'applications' && ( + + )} + {currentCampaign?.mode === 'disponibilities' && isCampaignPlace && ( + + )} )} diff --git a/web/components/Home/HomePlaces.tsx b/web/components/Home/HomePlaces.tsx deleted file mode 100644 index 19ec784e..00000000 --- a/web/components/Home/HomePlaces.tsx +++ /dev/null @@ -1,113 +0,0 @@ -import React from 'react' -import { - Flex, - Box, - Text, - Button, - useBreakpointValue, - HStack, - Stack, -} from '@chakra-ui/react' -import { useTranslation } from 'next-i18next' -import Arrow from 'public/assets/img/arrow-bottom.svg' -import { usePlaces } from '~hooks/usePlaces' -import PlaceGrid from '~components/Place/PlaceGrid' -import { CampaignDetailed } from '~components/Campaign/CampaignContext' -import { format } from '~utils/date' -import Link from '~components/Link' -import { ROUTE_PLACES } from '~constants' -import PlacesListCampaignHelper from '~components/Campaign/Places/PlacesListCampaignHelper' -import Tag from '~components/Tag' - -interface Props { - campaign?: CampaignDetailed -} - -const HomePlaces = ({ campaign }: Props) => { - const isLgOrSm = useBreakpointValue({ - base: false, - sm: true, - md: false, - lg: true, - }) - const { t } = useTranslation('home') - const { t: tCommon } = useTranslation('common') - const filters = campaign - ? { - 'disponibilities.campaign': campaign?.id, - } - : {} - const { data: places } = usePlaces( - { - published_eq: true, - _limit: 20, - _sort: 'dispoAsc', - ...filters, - }, - campaign && 'campaignPlaces', - ) - - if (!places || places.length === 0) return null - - return ( - - - - - - - - {campaign - ? t('campaign.title', { title: campaign?.title }) - : t('places.title')} - - {campaign && ( - - {tCommon('campaign.open', { - date: format(new Date(campaign?.limitDate), 'd MMMM yyyy'), - })} - - )} - - - - - - - - {campaign?.mode === 'applications' ? ( - - ) : ( - - )} - - - ) -} - -export default HomePlaces diff --git a/web/components/Home/HomePlacesCampaign.tsx b/web/components/Home/HomePlacesCampaign.tsx new file mode 100644 index 00000000..140ea242 --- /dev/null +++ b/web/components/Home/HomePlacesCampaign.tsx @@ -0,0 +1,101 @@ +import React from 'react' +import { + Flex, + Box, + Text, + Button, + useBreakpointValue, + HStack, + Stack, +} from '@chakra-ui/react' +import { useTranslation } from 'next-i18next' +import Arrow from 'public/assets/img/arrow-bottom.svg' +import { usePlaces } from '~hooks/usePlaces' +import PlaceGrid from '~components/Place/PlaceGrid' +import { format } from '~utils/date' +import Link from '~components/Link' +import { ROUTE_PLACES } from '~constants' +import Tag from '~components/Tag' +import useCampaignContext from '~components/Campaign/useCampaignContext' +import HomeHelperCampaign from '~components/Campaign/HomeHelperCampaign' + +interface Props { + isCampaignListing?: boolean +} + +const HomePlacesCampaign = ({ isCampaignListing }: Props) => { + const isLgOrSm = useBreakpointValue({ + base: false, + sm: true, + md: false, + lg: true, + }) + const { currentCampaign } = useCampaignContext() + const { t } = useTranslation('home') + const { t: tCommon } = useTranslation('common') + const filters = { + 'disponibilities.campaign': currentCampaign?.id, + } + + const { data: places } = usePlaces( + { + published_eq: true, + _limit: 20, + _sort: 'dispoAsc', + ...filters, + }, + 'campaignPlaces', + ) + + if (!places || places.length === 0) return null + + return ( + + + + + + + + {t('campaign.title', { title: currentCampaign?.title })} + + + + {tCommon('campaign.open', { + date: format(new Date(currentCampaign?.limitDate), 'd MMMM yyyy'), + })} + + + + + + + + + + + + ) +} + +export default HomePlacesCampaign diff --git a/web/components/Home/HomePlacesSolidarity.tsx b/web/components/Home/HomePlacesSolidarity.tsx new file mode 100644 index 00000000..83be8ef1 --- /dev/null +++ b/web/components/Home/HomePlacesSolidarity.tsx @@ -0,0 +1,74 @@ +import React from 'react' +import { + Flex, + Box, + Text, + Button, + useBreakpointValue, + HStack, + Stack, +} from '@chakra-ui/react' +import { useTranslation } from 'next-i18next' +import Arrow from 'public/assets/img/arrow-bottom.svg' +import { usePlaces } from '~hooks/usePlaces' +import PlaceGrid from '~components/Place/PlaceGrid' +import Link from '~components/Link' +import { ROUTE_PLACES } from '~constants' +import useCampaignContext from '~components/Campaign/useCampaignContext' +import HomeHelperSolidarity from '~components/Campaign/HomeHelperSolidarity' + +const HomePlacesSolidarity = () => { + const isLgOrSm = useBreakpointValue({ + base: false, + sm: true, + md: false, + lg: true, + }) + const { currentCampaign } = useCampaignContext() + const { t } = useTranslation('home') + + const { data: places } = usePlaces({ + published_eq: true, + _limit: 20, + _sort: 'dispoAsc', + }) + + if (!places || places.length === 0) return null + + return ( + + + + + + + + {t('places.title')} + + + + + {currentCampaign?.mode === 'applications' && } + + + + + + + ) +} + +export default HomePlacesSolidarity diff --git a/web/components/InputCity.tsx b/web/components/InputCity.tsx index 7bfe95c1..fee57636 100644 --- a/web/components/InputCity.tsx +++ b/web/components/InputCity.tsx @@ -18,6 +18,7 @@ const getStyle = (theme) => { height: '26px', flexWrap: 'wrap', alignItems: 'center', + cursor: 'pointer', ...(state.isFocused && { border: `1px solid ${theme.colors.blue['500']}!important`, boxShadow: '0 0 0 2px rgb(95 105 162 / 27%)', diff --git a/web/components/InputDateRange.tsx b/web/components/InputDateRange.tsx index 7cee86fb..c5e0578e 100644 --- a/web/components/InputDateRange.tsx +++ b/web/components/InputDateRange.tsx @@ -75,7 +75,7 @@ const InputDateRange = ({ control, placeholder, label }: Props) => { )} ) : ( - + {placeholder} )} diff --git a/web/components/Place/PlaceGrid.tsx b/web/components/Place/PlaceGrid.tsx index 5b256d76..8ab94bd3 100644 --- a/web/components/Place/PlaceGrid.tsx +++ b/web/components/Place/PlaceGrid.tsx @@ -13,7 +13,7 @@ interface Props { isFetching?: boolean isLoading?: boolean searchParams?: SearchQuery - isCampaignTab?: boolean + gridMode?: 'solidarity' | 'campaign' } const PlaceGrid = ({ @@ -22,7 +22,7 @@ const PlaceGrid = ({ isFetching = false, gridRef = null, searchParams = null, - isCampaignTab = false, + gridMode, }: Props) => { return ( @@ -38,7 +38,7 @@ const PlaceGrid = ({ place={place} key={place.id} searchParams={searchParams} - isCampaignTab={isCampaignTab} + gridMode={gridMode} /> ))} diff --git a/web/components/Place/PlaceGridCard.tsx b/web/components/Place/PlaceGridCard.tsx index 18d5d347..9d64cb96 100644 --- a/web/components/Place/PlaceGridCard.tsx +++ b/web/components/Place/PlaceGridCard.tsx @@ -27,10 +27,10 @@ import useCampaignDispo from '~hooks/useCampaignDispo' interface Props { place: Espace searchParams?: SearchQuery - isCampaignTab?: boolean + gridMode?: 'solidarity' | 'campaign' | null } -const PlaceGridCard = ({ place, searchParams, isCampaignTab }: Props) => { +const PlaceGridCard = ({ place, searchParams, gridMode }: Props) => { const { currentCampaign } = useCampaignContext() const { t } = useTranslation('place') @@ -60,7 +60,14 @@ const PlaceGridCard = ({ place, searchParams, isCampaignTab }: Props) => { { > d.id)} hasCampaignDispo={hasCampaignDispo} /> @@ -109,7 +116,7 @@ const PlaceGridCard = ({ place, searchParams, isCampaignTab }: Props) => { {place.users_permissions_user.structureName} - {place?.disponibilities?.length === 0 && !isCampaignTab && ( + {place?.disponibilities?.length === 0 && gridMode !== 'campaign' && ( { {t('card.noDispo')} )} - {disposInRange?.length > 0 && !isCampaignTab && ( + {disposInRange?.length > 0 && gridMode !== 'campaign' && ( { })} )} - {!disposInRange && disposThisWeek?.length > 0 && !isCampaignTab && ( - - {t(`card.thisWeek${disposThisWeek?.length > 1 ? 's' : ''}`, { - nb: disposThisWeek.length, - })} - - )} + {!disposInRange && + disposThisWeek?.length > 0 && + gridMode !== 'campaign' && ( + + {t(`card.thisWeek${disposThisWeek?.length > 1 ? 's' : ''}`, { + nb: disposThisWeek.length, + })} + + )} {!disposInRange && disposThisWeek?.length === 0 && disposNextWeek?.length > 0 && - !isCampaignTab && ( + gridMode !== 'campaign' && ( {t(`card.nextWeek${disposNextWeek?.length > 1 ? 's' : ''}`, { nb: disposNextWeek.length, @@ -177,7 +186,7 @@ const PlaceGridCard = ({ place, searchParams, isCampaignTab }: Props) => { - {hasCampaignDispo && isCampaignTab && ( + {hasCampaignDispo && gridMode === 'campaign' && ( <> diff --git a/web/components/Place/PlaceList.tsx b/web/components/Place/PlaceList.tsx index d8609592..4d12106a 100644 --- a/web/components/Place/PlaceList.tsx +++ b/web/components/Place/PlaceList.tsx @@ -12,7 +12,7 @@ const PlaceList = ({ isFetching, isLoading, listRef, - isCampaignTab = false, + listMode, }) => { const [focusedPlace, setFocus] = useState(null) const markers = useMemo( @@ -36,7 +36,7 @@ const PlaceList = ({ place={place} key={place.id} setFocus={setFocus} - isCampaignTab={isCampaignTab} + listMode={listMode} /> ))} diff --git a/web/components/Place/PlaceListCard.tsx b/web/components/Place/PlaceListCard.tsx index 7b0ee2cd..01ea4959 100644 --- a/web/components/Place/PlaceListCard.tsx +++ b/web/components/Place/PlaceListCard.tsx @@ -21,10 +21,10 @@ import useCampaignDispo from '~hooks/useCampaignDispo' interface Props { place: Espace setFocus: (idPlace: string) => void - isCampaignTab?: boolean + listMode?: 'solidarity' | 'campaign' } -const PlaceCard = ({ place, setFocus, isCampaignTab }: Props) => { +const PlaceCard = ({ place, setFocus, listMode }: Props) => { const { t } = useTranslation('place') const { currentCampaign } = useCampaignContext() const { campaignDispos } = useCampaignDispo(place?.disponibilities) @@ -72,7 +72,7 @@ const PlaceCard = ({ place, setFocus, isCampaignTab }: Props) => { d.id)} hasCampaignDispo={hasCampaignDispo} /> @@ -91,7 +91,7 @@ const PlaceCard = ({ place, setFocus, isCampaignTab }: Props) => { {`${place.surface}m²`} {t('card.dim')} {`${place.roomLength} x ${place.width} m`} - {isCampaignTab && ( + {listMode === 'campaign' && ( <> {t('card.dates')} @@ -112,11 +112,6 @@ const PlaceCard = ({ place, setFocus, isCampaignTab }: Props) => { )} - {isCampaignTab && ( - - - - )} diff --git a/web/components/Place/PlacesPage.tsx b/web/components/Place/PlacesPage.tsx index e7b1a2f6..f6f65d7b 100644 --- a/web/components/Place/PlacesPage.tsx +++ b/web/components/Place/PlacesPage.tsx @@ -35,15 +35,22 @@ const styleSelected = { borderBottomColor: 'blue.500', } -const PlacesPage = ({ isCampaignTab }: { isCampaignTab?: boolean }) => { - const { currentCampaign, isLoading: campaignLoading } = useCampaignContext() +const PlacesPage = () => { + const { + currentCampaign, + isLoading: campaignLoading, + hasActiveCampaign, + } = useCampaignContext() + const router = useRouter() + const isCampaignTab = (router.query.tab as string) === '1' + const initialFilters = - currentCampaign && isCampaignTab + hasActiveCampaign && isCampaignTab ? { 'disponibilities.campaign': currentCampaign?.id, } : {} - const router = useRouter() + const isMobile = useBreakpointValue({ base: true, md: false }) const { t } = useTranslation('place') const ref = useRef(null) @@ -116,17 +123,14 @@ const PlacesPage = ({ isCampaignTab }: { isCampaignTab?: boolean }) => { - {currentCampaign && isCampaignTab ? ( + {hasActiveCampaign && isCampaignTab ? ( - + @@ -248,7 +252,13 @@ const PlacesPage = ({ isCampaignTab }: { isCampaignTab?: boolean }) => { isFetching={isFetching} isLoading={isLoading} gridRef={ref} - isCampaignTab={isCampaignTab} + gridMode={ + isCampaignTab + ? 'campaign' + : hasActiveCampaign + ? 'solidarity' + : undefined + } /> ) : ( { isFetching={isFetching} isLoading={isLoading} listRef={ref} - isCampaignTab={isCampaignTab} + listMode={ + isCampaignTab + ? 'campaign' + : hasActiveCampaign + ? 'solidarity' + : undefined + } /> )} diff --git a/web/components/Place/PlacesTab.tsx b/web/components/Place/PlacesTab.tsx index 8b5ff53e..a538cddc 100644 --- a/web/components/Place/PlacesTab.tsx +++ b/web/components/Place/PlacesTab.tsx @@ -104,7 +104,7 @@ const PlacesTabs = () => { - + diff --git a/web/pages/index.tsx b/web/pages/index.tsx index ed3788da..fa571cdc 100644 --- a/web/pages/index.tsx +++ b/web/pages/index.tsx @@ -10,6 +10,8 @@ import HomeActus from '~components/Home/HomeActus' import HomeMessage from '~components/Home/HomeMessage' import { useSession } from 'next-auth/client' import useCampaignContext from '~components/Campaign/useCampaignContext' +import HomePlacesCampaign from '~components/Home/HomePlacesCampaign' +import HomePlacesSolidarity from '~components/Home/HomePlacesSolidarity' const Home: NextPage = () => { const [session, loading] = useSession() @@ -21,10 +23,8 @@ const Home: NextPage = () => { {!loading && !session && } - {currentCampaign?.mode === 'applications' && ( - - )} - + {currentCampaign?.mode === 'applications' && } +