Skip to content

Commit

Permalink
Listing candidatures fix 01/03
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucieo committed Mar 1, 2024
1 parent ae499fa commit 94a799d
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 65 deletions.
16 changes: 8 additions & 8 deletions back/config/plugins.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module.exports = ({ env }) => ({
email: {
provider: "nodemailer",
provider: 'nodemailer',
providerOptions: {
host: env("SMTP_HOST", "localhost"),
port: env("SMTP_PORT", 25),
host: env('SMTP_HOST', 'localhost'),
port: env('SMTP_PORT', 25),
auth:
env("SMTP_USERNAME", null) && env("SMTP_PASSWORD", null)
env('SMTP_USERNAME', null) && env('SMTP_PASSWORD', null)
? {
user: env("SMTP_USERNAME"),
pass: env("SMTP_PASSWORD"),
user: env('SMTP_USERNAME'),
pass: env('SMTP_PASSWORD'),
}
: undefined,
ignoreTLS: true,
Expand All @@ -19,7 +19,7 @@ module.exports = ({ env }) => ({
},
},
upload: {
provider: env('NODE_ENV') === 'development' ? 'local' : "do",
provider: process.env.NODE_ENV === 'development' ? 'local' : 'do',
providerOptions: {
key: process.env.DO_SPACE_ACCESS_KEY,
secret: process.env.DO_SPACE_SECRET_KEY,
Expand All @@ -29,4 +29,4 @@ module.exports = ({ env }) => ({
cdn: process.env.DO_SPACE_CDN,
},
},
});
})
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": "03/01/2024 12:10:27 PM"
"x-generation-date": "03/01/2024 1:25:41 PM"
},
"x-strapi-config": {
"path": "/documentation",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ const ApplicationCompanyListItem = ({ application }: Props) => {

return (
<Fragment key={application?.id}>
<Cell>
<Cell cursor="default">
<Text fontFamily="mabry medium" fontWeight="500">
{application?.id}
</Text>
</Cell>
<Cell>
<Cell cursor="default">
<Text fontFamily="mabry medium" fontWeight="500">
{
//@ts-expect-error
Expand All @@ -51,22 +51,22 @@ const ApplicationCompanyListItem = ({ application }: Props) => {
}
</Text>
</Cell>
<Cell>
<Cell cursor="default">
<Text fontFamily="mabry medium" fontWeight="500">
{/* @ts-expect-error */}
{application?.disponibility?.espace?.name}
</Text>
</Cell>
<Cell>
<Cell cursor="default">
<Text fontFamily="mabry medium" fontWeight="500">{`${format(
application?.disponibility.start,
'dd/MM',
)}${format(application?.disponibility.end, 'dd/MM')}`}</Text>
</Cell>
<Cell>
<Cell cursor="default">
<Text>{application?.creation_title}</Text>
</Cell>
<Cell>
<Cell cursor="default">
{currentCampaign?.mode === 'applications' && (
<ConfirmButton
helper={t('company.table.delete_helper')}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { Button, useDisclosure } from '@chakra-ui/react'
import { Box, Button } from '@chakra-ui/react'
import { useTranslation } from 'next-i18next'
import { useRouter } from 'next/router'
import { useState } from 'react'
import ApplicationDownloadButton from '~components/Account/Application/Place/ApplicationsPdf/ApplicationDownloadButton'
import { useMyApplications } from '~hooks/useMyApplications'
import useSelectedCampaign from '~hooks/useSelectedCampaign'

Expand All @@ -23,42 +21,24 @@ const ApplicationDownloadAll = () => {
if (['disponibilities', 'applications']?.includes(selectedCampaign?.mode)) {
return null
}
const { onOpen, onClose, isOpen } = useDisclosure()
const [downloadedApplications, setDownloadedApplications] = useState([])

return (
<>
<Box p={{ base: 2, sm: 4 }}>
<Button
colorScheme={selectedCampaign?.mode === 'closed' ? 'gray' : 'blue'}
backgroundColor={
selectedCampaign?.mode === 'closed' ? 'gray.700' : undefined
}
color={'white'}
size="lg"
onClick={() => {
setDownloadedApplications([])
onOpen()
}}
isLoading={
isLoading ||
isFetching ||
(isOpen && applications?.length !== downloadedApplications.length)
}
onClick={() => console.log('clicked')}
isLoading={isLoading || isFetching}
isDisabled
isFullWidth
>
{t('place.download')}
</Button>
{applications?.map((application) => (
<ApplicationDownloadButton
application={application}
controlledOnClose={onClose}
controlledIsOpen={isOpen}
key={application?.id}
onDownloadFinish={(id) => {
setDownloadedApplications([...downloadedApplications, id])
}}
/>
))}
</>
</Box>
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Loading from '~components/Loading'
import { useEffect } from 'react'
import { useRouter } from 'next/router'

const ApplicationPlaceFetcher = ({ searchParams }) => {
const ApplicationPlaceData = ({ searchParams }) => {
const { query } = useRouter()
const {
data: applications,
Expand Down Expand Up @@ -33,4 +33,4 @@ const ApplicationPlaceFetcher = ({ searchParams }) => {
)
}

export default ApplicationPlaceFetcher
export default ApplicationPlaceData
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ const ApplicationPlaceListItem = ({ application, onSelect }: Props) => {

return (
<Fragment key={application?.id}>
<Cell>
<Cell cursor="default">
<Text fontFamily="mabry medium" fontWeight="500">
{application?.id}
</Text>
</Cell>
<Cell>
<Cell cursor="default">
<Text
fontFamily="mabry medium"
fontWeight="500"
Expand All @@ -33,20 +33,20 @@ const ApplicationPlaceListItem = ({ application, onSelect }: Props) => {
>{`${application?.company?.structureName} (${application.company.firstname} ${application.company.lastname})`}</Text>
<ApplicationStatusIcon status={application?.status} />
</Cell>
<Cell>
<Cell cursor="default">
<Link href={`mailto:${application?.company?.email}`} target="_blank">
<Text color="grayText.1" textDecoration="underline">
{application?.company?.email}
</Text>
</Link>
</Cell>
<Cell>
<Cell cursor="default">
<Text fontFamily="mabry medium" fontWeight="500">
{application?.creation_title}
</Text>
</Cell>
{['preselections', 'closed']?.includes(selectedCampaign?.mode) && (
<Cell>
<Cell cursor="default">
<HStack spacing={2}>
<ApplicationDownloadButton application={application} />
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ const ApplicationsSearch = () => {
}

return (
<Box p={4}>
<InputGroup>
<Box p={{ base: 2, sm: 4 }} width={{ base: '100%', sm: 'auto' }}>
<InputGroup width={{ base: '100%', sm: 'auto' }}>
<Input
placeholder={t('place.search')}
onChange={(e) => handleSearch(e.target.value)}
width="auto"
height="30px"
width={{ base: '100%', sm: 'auto' }}
/>
<InputRightElement height="30px">
<SearchIcon />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HStack, Text } from '@chakra-ui/react'
import { HStack, Stack, Text } from '@chakra-ui/react'
import { useTranslation } from 'next-i18next'
import { useRouter } from 'next/router'
import { useEffect } from 'react'
Expand Down Expand Up @@ -28,7 +28,11 @@ const CampaignSelector = ({ children }) => {

return (
<>
<HStack pt={{ base: 4, md: 8 }} pb={4}>
<Stack
pt={{ base: 4, md: 8 }}
pb={4}
direction={{ base: 'column', sm: 'row' }}
>
<Text
textStyle="accountTitle"
pl={4}
Expand All @@ -39,7 +43,7 @@ const CampaignSelector = ({ children }) => {
{t('place.title')}
</Text>
<CampaignSelectorField />
</HStack>
</Stack>
{selectedCampaign && children}
</>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { HStack, Box, Text } from '@chakra-ui/react'
import { Box, Text, Stack } from '@chakra-ui/react'
import { useTranslation } from 'next-i18next'
import { useRouter } from 'next/router'
import { useEffect, useState } from 'react'
import ApplicationDownloadAll from '~components/Account/Application/Place/ApplicationDownloadAll'
import ApplicationPlaceFetcher from '~components/Account/Application/Place/ApplicationPlaceFetcher'
import ApplicationPlaceData from '~components/Account/Application/Place/ApplicationPlaceData'
import ApplicationsSearch from '~components/Account/Application/Place/ApplicationsSearch'
import ApplicationSelector from '~components/Account/Application/Place/DisponibilitiesSelector/DisponibilitiesSelectorFields'
import { useMyApplications } from '~hooks/useMyApplications'
Expand Down Expand Up @@ -58,7 +58,11 @@ const DisponibilitiesSelector = () => {
return (
<>
{Boolean(places?.length) && !isLoading && !isFetching && (
<HStack justifyContent="space-between" alignItems="baseline">
<Stack
direction={{ base: 'column-reverse', lg: 'row' }}
justifyContent="space-between"
alignItems="baseline"
>
<ApplicationSelector
places={places?.map((p) => ({
...p,
Expand All @@ -68,15 +72,19 @@ const DisponibilitiesSelector = () => {
}))}
hasConfirmedSelection={hasConfirmedSelection}
/>
<HStack>
<Stack
direction={{ base: 'column', sm: 'row' }}
width={{ base: '100%', sm: 'auto' }}
spacing={{ base: 0, sm: '' }}
>
<ApplicationsSearch />
<ApplicationDownloadAll />
</HStack>
</HStack>
</Stack>
</Stack>
)}

{Boolean(searchParams && Object.keys(searchParams)?.length) && (
<ApplicationPlaceFetcher searchParams={searchParams} />
<ApplicationPlaceData searchParams={searchParams} />
)}
</>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box, HStack, Select } from '@chakra-ui/react'
import { Box, HStack, Select, Stack } from '@chakra-ui/react'
import { useRouter } from 'next/router'
import { useEffect, useMemo } from 'react'
import { ROUTE_ACCOUNT_APPLICATIONS } from '~constants'
Expand Down Expand Up @@ -50,7 +50,11 @@ const ApplicationSelector = ({
])

return (
<HStack paddingBottom={4}>
<Stack
paddingBottom={4}
direction={{ base: 'column', sm: 'row' }}
width={{ base: '100%', sm: 'auto' }}
>
<Box background="#F4F5F9" p={1} borderRadius="18px">
<Select
width="auto"
Expand Down Expand Up @@ -107,7 +111,7 @@ const ApplicationSelector = ({
</Select>
</Box>
)}
</HStack>
</Stack>
)
}

Expand Down

0 comments on commit 94a799d

Please sign in to comment.