diff --git a/src/components/sections/employees/EmployeeList.tsx b/src/components/sections/employees/EmployeeList.tsx index 89b0e40d8..9fd0df9e5 100644 --- a/src/components/sections/employees/EmployeeList.tsx +++ b/src/components/sections/employees/EmployeeList.tsx @@ -17,21 +17,6 @@ const competences: Competence[] = [ "Project Management", ]; -function countCompetences(employees: ChewbaccaEmployee[]) { - const competenceCounts: Record = { - Utvikling: 0, - Administasjon: 0, - Design: 0, - "Project Management": 0, - }; - - employees - .flatMap((e) => e.competences) - .forEach((c) => (competenceCounts[c] += 1)); - - return competenceCounts; -} - function countLocations(employees: ChewbaccaEmployee[]) { const locationCounts: Record = {}; @@ -63,7 +48,6 @@ export default function EmployeeList({ language, employeesPageSlug, }: EmployeesProps) { - const competenceCounts = countCompetences(employees); const locationCounts = countLocations(employees); const locations = Object.keys(locationCounts); @@ -79,6 +63,15 @@ export default function EmployeeList({ function filterEmployees(newFilters: Partial) { const combinedFilters = { ...employeeFilters, ...newFilters }; + + if (newFilters.competenceFilter === employeeFilters.competenceFilter) { + combinedFilters.competenceFilter = null; + } + + if (newFilters.locationFilter === employeeFilters.locationFilter) { + combinedFilters.locationFilter = null; + } + setEmployeeFilters(combinedFilters); const newFilteredEmployees = employees.filter((e) => { @@ -111,10 +104,9 @@ export default function EmployeeList({ ); })} @@ -142,10 +135,9 @@ export default function EmployeeList({ ); })}