From 805cb1f066c54a75bf445e4fd2d3d6a6b987eb14 Mon Sep 17 00:00:00 2001 From: Robin <16273164+robines@users.noreply.github.com> Date: Thu, 26 Sep 2024 19:57:19 +0200 Subject: [PATCH 1/2] Fix Recruiter Dashboard infinite loop (#1400) * Fix Recruiter Dashboard infinite loop * biome --- .../RecruitmentRecruiterDashboardPage.tsx | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/frontend/src/PagesAdmin/RecruitmentRecruiterDashboardPage/RecruitmentRecruiterDashboardPage.tsx b/frontend/src/PagesAdmin/RecruitmentRecruiterDashboardPage/RecruitmentRecruiterDashboardPage.tsx index 5360bfe12..afe59954a 100644 --- a/frontend/src/PagesAdmin/RecruitmentRecruiterDashboardPage/RecruitmentRecruiterDashboardPage.tsx +++ b/frontend/src/PagesAdmin/RecruitmentRecruiterDashboardPage/RecruitmentRecruiterDashboardPage.tsx @@ -24,22 +24,22 @@ export function RecruitmentRecruiterDashboardPage() { const [applications, setApplications] = useState(); const [loading, setLoading] = useState(true); + // biome-ignore lint/correctness/useExhaustiveDependencies: navigate must not be in deplist useEffect(() => { - if (recruitmentId) { - getRecruitmentRecruiterDashboard(recruitmentId) - .then((resp) => { - setRecruitment(resp.data.recruitment); - setApplications(resp.data.applications); - setLoading(false); - }) - .catch((data) => { - toast.error(t(KEY.common_something_went_wrong)); - if (data.request.status === STATUS.HTTP_404_NOT_FOUND) { - navigate({ url: ROUTES.frontend.not_found }); - } - }); - } - }, [navigate, recruitmentId, t]); + if (!recruitmentId) return; + getRecruitmentRecruiterDashboard(recruitmentId) + .then((resp) => { + setRecruitment(resp.data.recruitment); + setApplications(resp.data.applications); + setLoading(false); + }) + .catch((data) => { + toast.error(t(KEY.common_something_went_wrong)); + if (data.request.status === STATUS.HTTP_404_NOT_FOUND) { + navigate({ url: ROUTES.frontend.not_found }); + } + }); + }, [recruitmentId, t]); if (!recruitmentId) { navigate({ url: ROUTES.frontend.not_found }); From e65f650b3562b01497c116844aa36dda5aa5171f Mon Sep 17 00:00:00 2001 From: Robin <16273164+robines@users.noreply.github.com> Date: Thu, 26 Sep 2024 23:54:31 +0200 Subject: [PATCH 2/2] Add breadcrumbs to Recruiter Dashboard and give proper title (#1401) * Add breadcrumbs to Recruiter Dashboard * Use Dashboard as name for recruiter dashboard page --- .../RecruitmentRecruiterDashboardPage.tsx | 2 +- frontend/src/i18n/constants.ts | 1 + frontend/src/i18n/translations.ts | 2 ++ frontend/src/router/router.tsx | 21 +++++++++++++++---- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/frontend/src/PagesAdmin/RecruitmentRecruiterDashboardPage/RecruitmentRecruiterDashboardPage.tsx b/frontend/src/PagesAdmin/RecruitmentRecruiterDashboardPage/RecruitmentRecruiterDashboardPage.tsx index afe59954a..7674de203 100644 --- a/frontend/src/PagesAdmin/RecruitmentRecruiterDashboardPage/RecruitmentRecruiterDashboardPage.tsx +++ b/frontend/src/PagesAdmin/RecruitmentRecruiterDashboardPage/RecruitmentRecruiterDashboardPage.tsx @@ -46,7 +46,7 @@ export function RecruitmentRecruiterDashboardPage() { return <>; } - const title = `${t(KEY.recruitment_overview)} - ${getObjectFieldOrNumber(recruitment?.organization, 'name')} - ${dbT( + const title = `${t(KEY.recruitment_recruiter_dashboard)} - ${getObjectFieldOrNumber(recruitment?.organization, 'name')} - ${dbT( recruitment, 'name', )}`; diff --git a/frontend/src/i18n/constants.ts b/frontend/src/i18n/constants.ts index 0a6d276ba..e7d955a4b 100644 --- a/frontend/src/i18n/constants.ts +++ b/frontend/src/i18n/constants.ts @@ -336,6 +336,7 @@ export const KEY = { recruitment_no_current_applications_gang: 'recruitment_no_current_applications_gang', recruitment_progression: 'recruitment_progression', recruitment_overview: 'recruitment_overview', + recruitment_recruiter_dashboard: 'recruitment_recruiter_dashboard', recruitment_dashboard_description: 'recruitment_dashboard_description', recruitment_application: 'recruitment_application', recruitment_admitted: 'recruitment_admitted', diff --git a/frontend/src/i18n/translations.ts b/frontend/src/i18n/translations.ts index c7d3616f5..2a084045b 100644 --- a/frontend/src/i18n/translations.ts +++ b/frontend/src/i18n/translations.ts @@ -299,6 +299,7 @@ export const nb = prepareTranslations({ [KEY.recruitment_applications]: 'søknader', [KEY.recruitment_progression]: 'Opptak fremgang', [KEY.recruitment_overview]: 'Opptak oversikt', + [KEY.recruitment_recruiter_dashboard]: 'Dashbord', [KEY.recruitment_statistics]: 'Opptak statistikk', [KEY.recruitment_applications_processed]: 'søknader behandlet', [KEY.recruitment_automatic_rejection]: 'Automatisk avslag', @@ -723,6 +724,7 @@ export const en = prepareTranslations({ [KEY.application_deadline]: 'Application deadline', [KEY.recruitment_progression]: 'Recruitment progression', [KEY.recruitment_overview]: 'Recruitment overview', + [KEY.recruitment_recruiter_dashboard]: 'Dashboard', [KEY.recruitment_admitted]: 'admitted', [KEY.recruitment_statistics]: 'Recruitment statistics', [KEY.recruitment_applications]: 'applications', diff --git a/frontend/src/router/router.tsx b/frontend/src/router/router.tsx index 8352bf12a..e07b7396d 100644 --- a/frontend/src/router/router.tsx +++ b/frontend/src/router/router.tsx @@ -378,10 +378,6 @@ export const router = createBrowserRouter( ), }} /> - } - /> } @@ -429,6 +425,23 @@ export const router = createBrowserRouter( }, }} > + } + loader={recruitmentLoader} + handle={{ + crumb: ({ recruitment }: RecruitmentLoader) => ( + + {t(KEY.recruitment_recruiter_dashboard)} + + ), + }} + />