Skip to content

Commit

Permalink
Merge dc0ae2e into a8699f6
Browse files Browse the repository at this point in the history
  • Loading branch information
guillobits authored Dec 16, 2024
2 parents a8699f6 + dc0ae2e commit e26f1cc
Show file tree
Hide file tree
Showing 23 changed files with 230 additions and 195 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const cardVariables: {
content:
"N'hésitez pas à prendre contact avec eux pour les accompagner dans votre recherche",
button: 'Découvrez les coachs',
buttonHref: '/backoffice/annuaire?role=coach',
buttonHref: '/backoffice/annuaire?role=Coach',
},
[USER_ROLES.COACH]: {
title: 'Découvrez les candidats que vous pourriez accompagner',
Expand Down
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%;
`;
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export const DashboardRecommendationsCard = () => {
ambitions={profile.searchAmbitions}
job={profile.currentJob}
isAvailable={profile.isAvailable}
displayHelps={false}
/>
);
});
Expand All @@ -93,7 +94,11 @@ export const DashboardRecommendationsCard = () => {
>
<StyledDashboardCardContentContainer>
<StyledDashboardRecommendationsList>
<CardList list={recommendationsList} isLoading={isLoading} />
<CardList
list={recommendationsList}
isLoading={isLoading}
condensed
/>
</StyledDashboardRecommendationsList>
<Button
style="custom-secondary-inverted"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import styled from 'styled-components';

export const StyledHeaderDirectory = styled.div`
display: flex;
flex-direction: column;
gap: 35px;
`;

export const StyledDirectoryContainer = styled.div`
display: flex;
flex-direction: column;
gap: 50px;
`;

export const StyledDirectoryButtonContainer = styled.div`
Expand Down
134 changes: 134 additions & 0 deletions src/components/backoffice/directory/Directory/Directory.tsx
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>
</>
);
}
1 change: 1 addition & 0 deletions src/components/backoffice/directory/Directory/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './Directory';

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ interface DirectoryItemProps {
department: Department;
job?: string;
isAvailable: boolean;
displayHelps: boolean;
}

export function DirectoryItem({
Expand All @@ -38,6 +39,7 @@ export function DirectoryItem({
ambitions,
job,
isAvailable,
displayHelps,
}: DirectoryItemProps) {
return (
<CardListItem dataTestId={id}>
Expand All @@ -52,6 +54,7 @@ export function DirectoryItem({
ambitions={ambitions}
job={job}
isAvailable={isAvailable}
displayHelps={displayHelps}
/>
</CardListItem>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export function DirectoryList() {
ambitions={profile.searchAmbitions}
job={profile.currentJob}
isAvailable={profile.isAvailable}
displayHelps
/>
);
});
Expand Down
6 changes: 2 additions & 4 deletions src/components/backoffice/directory/useDirectoryRole.ts
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];
}
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%;
`;
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export const DashboardReferedCandidateList = () => {
ambitions={profile.searchAmbitions}
job={profile.currentJob}
isAvailable={profile.isAvailable}
displayHelps={false}
/>
);
});
Expand All @@ -70,7 +71,7 @@ export const DashboardReferedCandidateList = () => {
<Card title="Les candidats que vous avez orientés" centerTitle>
<StyledDashboardCardContentContainer>
<StyledDashboardReferedCandidateList>
<CardList list={referedList} isLoading={loading} />
<CardList list={referedList} isLoading={loading} condensed />
</StyledDashboardReferedCandidateList>
</StyledDashboardCardContentContainer>
</Card>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ export const StyledHeaderBackOffice = styled.div`
margin: 30px 0;
}
`;

export const StyledBackgroundedHeaderBackoffice = styled.div`
background-color: ${COLORS.lightGray};
`;
Loading

0 comments on commit e26f1cc

Please sign in to comment.