-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
230 additions
and
195 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
4 changes: 1 addition & 3 deletions
4
.../backoffice/dashboard/DashboardRecommendationsCard/DashboardRecommendationsCard.styles.ts
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 |
---|---|---|
@@ -1,7 +1,5 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const StyledDashboardRecommendationsList = styled.div` | ||
ul { | ||
gap: 26px; | ||
} | ||
width: 100%; | ||
`; |
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
7 changes: 7 additions & 0 deletions
7
...oryContainer/DirectoryContainer.styles.ts → ...e/directory/Directory/Directory.styles.ts
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
134 changes: 134 additions & 0 deletions
134
src/components/backoffice/directory/Directory/Directory.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,134 @@ | ||
import { useRouter } from 'next/router'; | ||
import React, { useMemo } from 'react'; | ||
import { DirectoryList } from '../DirectoryList'; | ||
import { useDirectoryQueryParams } from '../useDirectoryQueryParams'; | ||
import { SearchBar } from 'src/components/filters/SearchBar/SearchBar'; | ||
import { HeaderBackoffice } from 'src/components/headers/HeaderBackoffice'; | ||
import { StyledBackgroundedHeaderBackoffice } from 'src/components/headers/HeaderBackoffice/HeaderBackoffice.styles'; | ||
import { Button, Section } from 'src/components/utils'; | ||
import { BUSINESS_LINES, DirectoryFilters } from 'src/constants'; | ||
import { DEPARTMENTS_FILTERS } from 'src/constants/departements'; | ||
import { ProfileHelps } from 'src/constants/helps'; | ||
import { GA_TAGS } from 'src/constants/tags'; | ||
import { USER_ROLES } from 'src/constants/users'; | ||
import { useFilters } from 'src/hooks'; | ||
import { useIsMobile } from 'src/hooks/utils'; | ||
import { | ||
findConstantFromValue, | ||
isRoleIncluded, | ||
mutateToArray, | ||
} from 'src/utils'; | ||
import { | ||
StyledDirectoryButtonContainer, | ||
StyledDirectoryContainer, | ||
StyledHeaderDirectory, | ||
} from './Directory.styles'; | ||
|
||
const route = '/backoffice/annuaire'; | ||
|
||
export function Directory() { | ||
const { push } = useRouter(); | ||
const isMobile = useIsMobile(); | ||
|
||
const directoryFiltersParams = useDirectoryQueryParams(); | ||
const { role, departments, helps, businessLines, search } = | ||
directoryFiltersParams; | ||
|
||
const { setFilters, setSearch, resetFilters } = useFilters( | ||
DirectoryFilters, | ||
`/backoffice/annuaire`, | ||
[], | ||
GA_TAGS.PAGE_ANNUAIRE_SUPPRIMER_FILTRES_CLIC | ||
); | ||
|
||
const filters = useMemo(() => { | ||
return { | ||
departments: mutateToArray(departments).map((department) => | ||
findConstantFromValue(department, DEPARTMENTS_FILTERS) | ||
), | ||
helps: mutateToArray(helps).map((help) => | ||
findConstantFromValue(help, ProfileHelps) | ||
), | ||
businessLines: mutateToArray(businessLines).map((businessLine) => | ||
findConstantFromValue(businessLine, BUSINESS_LINES) | ||
), | ||
}; | ||
}, [departments, helps, businessLines]); | ||
|
||
return ( | ||
<> | ||
<StyledBackgroundedHeaderBackoffice> | ||
<Section className="custom-page"> | ||
<StyledHeaderDirectory> | ||
<HeaderBackoffice | ||
title="Bienvenue sur votre réseau" | ||
description={ | ||
"Découvrez les membres de la communauté et développez votre carnet d'adresse." | ||
} | ||
noSeparator | ||
/> | ||
<SearchBar | ||
light | ||
filtersConstants={DirectoryFilters} | ||
filters={filters} | ||
resetFilters={() => { | ||
resetFilters(); | ||
}} | ||
search={search} | ||
setSearch={setSearch} | ||
setFilters={setFilters} | ||
placeholder="Rechercher..." | ||
additionalButtons={ | ||
<StyledDirectoryButtonContainer isMobile={isMobile}> | ||
<Button | ||
size={isMobile ? 'small' : 'large'} | ||
style={`custom-secondary${ | ||
isRoleIncluded([USER_ROLES.CANDIDATE], role) | ||
? '-inverted' | ||
: '' | ||
}`} | ||
onClick={() => { | ||
push({ | ||
pathname: route, | ||
query: { | ||
...directoryFiltersParams, | ||
role: [USER_ROLES.CANDIDATE], | ||
}, | ||
}); | ||
}} | ||
> | ||
Les candidats | ||
</Button> | ||
<Button | ||
size={isMobile ? 'small' : 'large'} | ||
style={`custom-secondary${ | ||
isRoleIncluded([USER_ROLES.COACH], role) | ||
? '-inverted' | ||
: '' | ||
}`} | ||
onClick={() => { | ||
push({ | ||
pathname: route, | ||
query: { | ||
...directoryFiltersParams, | ||
role: USER_ROLES.COACH, | ||
}, | ||
}); | ||
}} | ||
> | ||
Les coachs | ||
</Button> | ||
</StyledDirectoryButtonContainer> | ||
} | ||
/> | ||
</StyledHeaderDirectory> | ||
</Section> | ||
</StyledBackgroundedHeaderBackoffice> | ||
<Section className="custom-page"> | ||
<StyledDirectoryContainer> | ||
<DirectoryList /> | ||
</StyledDirectoryContainer> | ||
</Section> | ||
</> | ||
); | ||
} |
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 @@ | ||
export * from './Directory'; |
113 changes: 0 additions & 113 deletions
113
src/components/backoffice/directory/DirectoryContainer/DirectoryContainer.tsx
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
src/components/backoffice/directory/DirectoryContainer/index.ts
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
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 |
---|---|---|
@@ -1,11 +1,9 @@ | ||
import { USER_ROLES } from 'src/constants/users'; | ||
import { useRole } from 'src/hooks/queryParams/useRole'; | ||
import { assertIsDefined } from 'src/utils/asserts'; | ||
|
||
// Failsafe to make sure that the role query param is set | ||
export function useDirectoryRole() { | ||
const roleFilter = useRole(); | ||
|
||
assertIsDefined(roleFilter, 'No default role'); | ||
|
||
return roleFilter; | ||
return roleFilter || [USER_ROLES.COACH]; | ||
} |
4 changes: 1 addition & 3 deletions
4
...e/referer/dashboard/DashboardReferedCandidateList/DashboardReferedCandidateList.styles.ts
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 |
---|---|---|
@@ -1,7 +1,5 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const StyledDashboardReferedCandidateList = styled.div` | ||
ul { | ||
gap: 26px; | ||
} | ||
width: 100%; | ||
`; |
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
Oops, something went wrong.