Skip to content

Commit

Permalink
Fix/style fixes 22 02 (#80)
Browse files Browse the repository at this point in the history
* Lieu Admin Listing des espaces fix

* Lieu fiche détail d'un lieu fix

* Public listing des lieux en mode candidatures ouvertes fix

* Home encart dispositif emergence
  • Loading branch information
Lucieo authored Feb 22, 2024
1 parent af54f3a commit 9073466
Show file tree
Hide file tree
Showing 17 changed files with 99 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"name": "Apache 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0.html"
},
"x-generation-date": "02/22/2024 6:38:10 PM"
"x-generation-date": "02/22/2024 8:24:57 PM"
},
"x-strapi-config": {
"path": "/documentation",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { Application } from '~typings/api'
import Chevron from 'public/assets/img/chevron-down.svg'
import Cell from '~components/Account/Booking/Cell'
import useCampaignContext from '~components/Campaign/useCampaignContext'
import ApplicationPlaceListItem from '~components/Account/Application/Place/ApplicationPlaceListItem'
import ApplicationPlaceHelper from '~components/Account/Application/Place/ApplicationsHelpers/ApplicationPlaceHelper'
import ApplicationPlaceListItem from '~components/Account/Application/Place/ApplicationPlaceListItem'

interface Props {
applications: Application[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ const DisponibilitiesSelector = () => {
['myPlaces', query.campaign as string],
)

console.log(query.campaign, places)

useEffect(() => {
const search = {}
if (query.disponibility) {
Expand Down
11 changes: 9 additions & 2 deletions web/components/Account/Place/ListItem/PlaceListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,21 @@ interface Props {

const PlaceListItem = ({ place, setVisible, isFirst }: Props) => {
const isComplete = useIsComplete(place)
const { hasActiveCampaign } = useCampaignContext()
const { currentCampaign } = useCampaignContext()

useEffect(() => {
if (!isComplete) {
setVisible(true)
}
}, [isComplete])

const showCampaignDisponibilities =
currentCampaign?.mode === 'disponibilities' ||
(place?.disponibilities &&
place?.disponibilities?.some(
(d) => d?.campaign?.toString() === currentCampaign?.id.toString(),
))

return (
<Flex
w="100%"
Expand Down Expand Up @@ -57,7 +64,7 @@ const PlaceListItem = ({ place, setVisible, isFirst }: Props) => {

<VStack flex={1} spacing={8} alignItems="stretch">
<PlaceDisponibilitiesInfo place={place} />
{hasActiveCampaign && (
{showCampaignDisponibilities && (
<CampaignDisponibilitiesInfo place={place} />
)}
</VStack>
Expand Down
6 changes: 5 additions & 1 deletion web/components/Campaign/ApplicationCounter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ const ApplicationCounter = ({
const { currentCampaign } = useCampaignContext()
const { data: user, applications } = useCurrentUser()

if (user?.type === 'company' && currentCampaign?.applications_max > 0) {
if (
user?.type === 'company' &&
currentCampaign?.applications_max > 0 &&
applications?.length > 0
) {
return (
<HStack width="100%" paddingY={3} {...props}>
<Flex>
Expand Down
6 changes: 6 additions & 0 deletions web/components/Campaign/Home/HomeCampaignInsert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ const HomeCampaignInsert = () => {
p={4}
paddingBottom={{ base: 8, md: 2 }}
height="100%"
_hover={{ lg: { borderColor: 'rgba(235, 164, 10, 0.3)' } }}
border={{
base: 'none',
lg: '2px solid transparent',
}}
transition="border 0.3s ease-in-out"
>
<VStack alignItems="flex-start" spacing={4}>
<Tag status="campaign">{title}</Tag>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,23 @@ const CampaignApplicationSchedule = ({
})}
</Text>
<Text>{currentCampaign?.description}</Text>
<Text color="gray.500">{t('detail.campaign.eligibility')}</Text>
<MarkdownRenderer>{currentCampaign?.eligibility}</MarkdownRenderer>
<Button
variant="blueFill"
as={Link}
href={currentCampaign?.article_link ?? ''}
>
{t('detail.campaign.more')}
</Button>
{currentCampaign?.eligibility && (
<>
<Text color="gray.500">{t('detail.campaign.eligibility')}</Text>
<MarkdownRenderer>
{currentCampaign?.eligibility}
</MarkdownRenderer>
</>
)}
{currentCampaign?.article_link && (
<Button
variant="blueFill"
as={Link}
href={currentCampaign?.article_link ?? ''}
>
{t('detail.campaign.more')}
</Button>
)}
</VStack>
</Stack>
</VStack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ const CampaignApplicationScheduleItem = ({
[selected, disponibility],
)

const handleClick = () => {
const handleClick = (e) => {
console.log('click')
if (isSelected) {
setSelected(
//@ts-expect-error
Expand Down Expand Up @@ -111,13 +112,24 @@ const CampaignApplicationScheduleItem = ({
border={isSelected ? '2px solid #6EAE7F' : '2px solid transparent'}
borderRadius="8px"
opacity={isDisabled ? 0.5 : 1}
cursor="pointer"
onClick={(e) => {
e.stopPropagation()
handleClick(e)
}}
_hover={{ border: '2px solid #6EAE7F' }}
transition="border 0.3s ease-in-out"
>
<Checkbox
colorScheme="green"
paddingTop={2}
sx={checkBoxStyle}
isChecked={isSelected}
onChange={handleClick}
onClick={(e) => {
e.stopPropagation()
e.preventDefault()
handleClick(e)
}}
isDisabled={isDisabled}
/>
<VStack alignItems="flex-start" spacing={1}>
Expand Down
6 changes: 4 additions & 2 deletions web/components/Campaign/Places/Detail/CampaignPlaceDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { useRouter } from 'next/router'
import CampaignApplicationSchedule from '~components/Campaign/Places/Application/CampaignApplicationSchedule'
import PlaceDetailCalendar from '~components/Place/PlaceDetailPage/PlaceDetailCalendar'
import CampaignDetailSwitcher from '~components/Campaign/Places/Detail/CampaignDetailSwitcher'
import useCampaignContext from '~components/Campaign/useCampaignContext'

interface Props {
place: Espace
Expand All @@ -28,6 +29,7 @@ const CampaignPlaceDetail = ({ place }: Props) => {
const isMobile = useBreakpointValue({ base: true, lg: false })
const router = useRouter()
const isCampaignTab = router.query.tab === '1'
const { currentCampaign } = useCampaignContext()

const displayPrecise = useMemo(() => {
if (!place) return false
Expand Down Expand Up @@ -68,8 +70,8 @@ const CampaignPlaceDetail = ({ place }: Props) => {

{isCampaignTab ? (
<CampaignApplicationSchedule
disponibilities={place?.disponibilities?.filter((d) =>
Boolean(d?.campaign),
disponibilities={place?.disponibilities?.filter(
(d) => d?.campaign?.toString() === currentCampaign?.id.toString(),
)}
/>
) : (
Expand Down
21 changes: 17 additions & 4 deletions web/components/Campaign/Places/PlacesListCampaignHelper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,17 @@ const PlacesListCampaignHelper = ({
paddingY={4}
marginBottom={4}
spacing={'1rem'}
height={!isHome ? '100%' : 'auto'}
{...props}
>
{campaign && !isHome && (
<ApplicationCounter borderBottom="1px solid lightgray" />
)}
<Stack width="100%" spacing={6} direction={{ base: 'column', sm: 'row' }}>
<Stack
width="100%"
spacing={6}
direction={isHome ? { base: 'column', sm: 'row' } : 'column'}
>
<VStack flex={4} justifyContent="flex-start" alignItems="flex-start">
<Text as="span" fontWeight="bold" marginRight={1}>
{campaign
Expand All @@ -42,13 +47,21 @@ const PlacesListCampaignHelper = ({
{campaign ? campaign.description : t('solidarity.helper')}
</Text>
</VStack>
<Flex flex={1} justifyContent={{ base: 'flex-start', sm: 'flex-end' }}>
<Flex
flex={1}
justifyContent={
isHome ? { base: 'flex-start', sm: 'flex-end' } : 'flex-end'
}
alignItems="center"
>
<Button
variant={campaign ? 'campaign' : 'blueFill'}
as={Link}
href={
campaign?.mode === 'applications'
? `${ROUTE_PLACES}?tab=1`
campaign
? campaign?.article_link
? campaign?.article_link
: `${ROUTE_PLACES}?tab=1`
: `${ROUTE_PLACES}?tab=0`
}
>
Expand Down
3 changes: 2 additions & 1 deletion web/components/Home/HomeActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const HomeActions = () => {
{hasActiveCampaign && (
<Box
flex={2}
borderTop={{ base: '1px solid rgba( 211, 211, 211, 0.5)', lg: 'none' }}
id="licorne"
borderTop={{ base: '1px solid rgba(211, 211, 211, 0.5)', lg: 'none' }}
>
<HomeCampaignInsert />
</Box>
Expand Down
2 changes: 1 addition & 1 deletion web/components/Home/HomePlaces.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const HomePlaces = ({ campaign }: Props) => {

<PlacesListCampaignHelper campaign={campaign} limitLines isHome />

<PlaceGrid places={places.slice(0, isLgOrSm ? 4 : 3)} />
<PlaceGrid places={places.slice(0, isLgOrSm ? 4 : 3)} isCampaignTab />
<Flex justifyContent="center" pt={10} pb={{ base: 6, md: 0 }}>
{campaign?.mode === 'applications' ? (
<Button
Expand Down
6 changes: 5 additions & 1 deletion web/components/Place/PlaceGridCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,11 @@ const PlaceGridCard = ({ place, searchParams, isCampaignTab }: Props) => {
</Text>
<Box isTruncated>
{place?.disponibilities
?.filter((el) => Boolean(el?.campaign))
?.filter(
(d) =>
d?.campaign?.toString() ===
currentCampaign?.id?.toString(),
)
?.map((el) => (
<Text key={el?.id}>
{`${format(el.start, 'dd MMMM')} ${t('card.to')}
Expand Down
13 changes: 5 additions & 8 deletions web/components/Place/PlaceListCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@ const PlaceCard = ({ place, setFocus, isCampaignTab }: Props) => {
const { t } = useTranslation('place')
const { currentCampaign } = useCampaignContext()

const isCampaignPlace =
currentCampaign?.mode === 'applications' &&
place?.disponibilities?.some(
//@ts-expect-error
(d) => d?.campaign === currentCampaign?.id,
)

return (
<LinkBox
w="100%"
Expand Down Expand Up @@ -100,7 +93,11 @@ const PlaceCard = ({ place, setFocus, isCampaignTab }: Props) => {
</Text>
<Box>
{place?.disponibilities
?.filter((el) => Boolean(el?.campaign))
?.filter(
(d) =>
d.campaign?.toString() ===
currentCampaign?.id?.toString(),
)
.map((el) => (
<Text>
{`${format(el.start, 'dd/MM')} ${t('card.to')}
Expand Down
6 changes: 5 additions & 1 deletion web/components/Place/PlaceSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ const PlaceSearch = ({
const { currentCampaign } = useCampaignContext()

return (
<form onSubmit={form.handleSubmit(onSubmit)}>
<form
onSubmit={form.handleSubmit(onSubmit)}
style={isCampaignTab ? { width: '100%' } : {}}
>
<Flex
bgColor={isCampaignTab ? 'campaign.light' : 'blue.100'}
px={{ base: 3, md: 5 }}
Expand All @@ -56,6 +59,7 @@ const PlaceSearch = ({
mb={{ base: 0, sm: 10 }}
direction="column"
mt={currentCampaign ? 0 : 6}
height={isCampaignTab ? '100%' : 'auto'}
>
<SimpleGrid
columns={
Expand Down
4 changes: 2 additions & 2 deletions web/components/Place/PlacesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ const PlacesPage = ({ isCampaignTab }: { isCampaignTab?: boolean }) => {
marginBottom={0}
/>
</Box>
<Box flex={1}>
<Flex flex={1} alignItems="stretch">
<PlaceSearch onSubmit={onSubmit} isCampaignTab={isCampaignTab} />
</Box>
</Flex>
</Stack>
) : (
<Box>
Expand Down
6 changes: 5 additions & 1 deletion web/pages/compte/mes-candidatures/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ const CompanyApplications = ({ user }: Props) => {
const { data: applications, isLoading } = useMyApplications({
campaignId: currentCampaign?.id,
options: { enabled: !!currentCampaign?.id },
searchParams: { _sort: 'disponibility.start:asc' },
searchParams: {
_sort: 'disponibility.start:asc',
//@ts-expect-error
'disponibility.campaign': currentCampaign?.id,
},
})
if (!currentCampaign) return null
return (
Expand Down

0 comments on commit 9073466

Please sign in to comment.