-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Applications company improvement (#77)
- Loading branch information
Showing
12 changed files
with
233 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 0 additions & 56 deletions
56
web/components/Account/Application/Company/ApplicationCompanyHelper.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
web/components/Account/Application/Company/ApplicationsHelpers/ApplicationCompanyHelper.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Box, Button, Stack, Text } from '@chakra-ui/react' | ||
import { useTranslation } from 'next-i18next' | ||
import useCampaignContext from '~components/Campaign/useCampaignContext' | ||
import { ROUTE_PLACES } from '~constants' | ||
import { useCurrentUser } from '~hooks/useCurrentUser' | ||
import { format } from '~utils/date' | ||
import Link from '~components/Link' | ||
import OpenApplications from '~components/Account/Application/Company/ApplicationsHelpers/OpenApplications' | ||
import ClosedApplications from '~components/Account/Application/Company/ApplicationsHelpers/ClosedApplications' | ||
|
||
const ApplicationCompanyHelper = () => { | ||
const { remainingApplications } = useCurrentUser() | ||
const { currentCampaign } = useCampaignContext() | ||
const { t } = useTranslation('application') | ||
if (remainingApplications > 0 && currentCampaign.mode === 'applications') | ||
return <OpenApplications remainingApplications={remainingApplications} /> | ||
|
||
if (currentCampaign.mode === 'preselections') { | ||
return <ClosedApplications /> | ||
} | ||
return null | ||
} | ||
|
||
export default ApplicationCompanyHelper |
38 changes: 38 additions & 0 deletions
38
web/components/Account/Application/Company/ApplicationsHelpers/ClosedApplications.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Box, Stack, Text } from '@chakra-ui/react' | ||
import { useTranslation } from 'next-i18next' | ||
import useCampaignContext from '~components/Campaign/useCampaignContext' | ||
import { format } from '~utils/date' | ||
|
||
const ClosedApplications = () => { | ||
const { currentCampaign } = useCampaignContext() | ||
const { t } = useTranslation('application') | ||
|
||
return ( | ||
<Box paddingY={6}> | ||
<Stack | ||
backgroundColor="grayBackground" | ||
direction={{ base: 'column', md: 'row' }} | ||
p={2} | ||
borderRadius="4px" | ||
justifyContent="space-between" | ||
alignItems={{ base: 'flex-start', md: 'center' }} | ||
spacing={2} | ||
> | ||
<Box> | ||
<Text as="span" fontWeight="bold"> | ||
{t(`company.helper.closed_start`, { | ||
title: currentCampaign.title, | ||
})} | ||
</Text> | ||
<Text as="span" pl={1}> | ||
{t('company.helper.closed_end', { | ||
date: format(currentCampaign.preselection_end), | ||
})} | ||
</Text> | ||
</Box> | ||
</Stack> | ||
</Box> | ||
) | ||
} | ||
|
||
export default ClosedApplications |
54 changes: 54 additions & 0 deletions
54
web/components/Account/Application/Company/ApplicationsHelpers/OpenApplications.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { Box, Button, Stack, Text } from '@chakra-ui/react' | ||
import { useTranslation } from 'next-i18next' | ||
import useCampaignContext from '~components/Campaign/useCampaignContext' | ||
import { ROUTE_PLACES } from '~constants' | ||
import { format } from '~utils/date' | ||
import Link from '~components/Link' | ||
|
||
const OpenApplications = ({ | ||
remainingApplications, | ||
}: { | ||
remainingApplications: number | ||
}) => { | ||
const { currentCampaign } = useCampaignContext() | ||
const { t } = useTranslation('application') | ||
|
||
return ( | ||
<Box paddingY={6}> | ||
<Stack | ||
backgroundColor="grayBackground" | ||
direction={{ base: 'column', md: 'row' }} | ||
p={2} | ||
borderRadius="4px" | ||
justifyContent="space-between" | ||
alignItems={{ base: 'flex-start', md: 'center' }} | ||
spacing={2} | ||
> | ||
<Box> | ||
<Text as="span"> | ||
{t(`company.helper.start${remainingApplications > 1 ? 's' : ''}`, { | ||
num: remainingApplications, | ||
})} | ||
</Text> | ||
<Text as="span" fontWeight="bold"> | ||
{t('company.helper.end', { | ||
date: format(currentCampaign.application_end), | ||
})} | ||
</Text> | ||
</Box> | ||
<Button | ||
as={Link} | ||
href={ROUTE_PLACES + '?tab=1'} | ||
colorScheme="blue" | ||
size="lg" | ||
whiteSpace={'break-spaces'} | ||
textAlign="center" | ||
> | ||
{t('company.helper.cta')} | ||
</Button> | ||
</Stack> | ||
</Box> | ||
) | ||
} | ||
|
||
export default OpenApplications |
2 changes: 1 addition & 1 deletion
2
web/components/Account/Application/Place/SelectionHelpers/ValidatedSelections.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
web/components/Account/Application/Place/Selectors/SelectMenu.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { useTranslation } from 'next-i18next' | ||
import Select from 'react-select' | ||
|
||
const colourStyles = { | ||
container: (styles) => ({ | ||
...styles, | ||
width: '100%', | ||
}), | ||
valueContainer: (styles) => ({ | ||
...styles, | ||
padding: '2px 8px 2px 3px', | ||
}), | ||
control: (styles, state) => ({ | ||
...styles, | ||
backgroundColor: 'white', | ||
width: '100%', | ||
}), | ||
} | ||
|
||
const SelectMenu = ({ | ||
options = [], | ||
onChange, | ||
value, | ||
}: { | ||
options: any | ||
onChange: any | ||
value: string | ||
}) => { | ||
const { t } = useTranslation('application') | ||
return ( | ||
<Select | ||
name="colors" | ||
placeholder={t('search')} | ||
options={options} | ||
className="basic-multi-select" | ||
classNamePrefix="select" | ||
styles={colourStyles} | ||
onChange={onChange} | ||
value={value} | ||
/> | ||
) | ||
} | ||
|
||
export default SelectMenu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.