From 7d5a4d6b7e3525430e4bcf0f3b7b39e0ba49bab2 Mon Sep 17 00:00:00 2001 From: Snorre Jr Date: Sun, 3 Nov 2024 03:50:57 +0100 Subject: [PATCH 1/5] deleted empty file --- .../ApplicantApplicationOverviewPage.tsx | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 frontend/src/Pages/ApplicantApplicationOverviewPage/ApplicantApplicationOverviewPage.tsx diff --git a/frontend/src/Pages/ApplicantApplicationOverviewPage/ApplicantApplicationOverviewPage.tsx b/frontend/src/Pages/ApplicantApplicationOverviewPage/ApplicantApplicationOverviewPage.tsx deleted file mode 100644 index e69de29bb..000000000 From dc5e2982d1535e14f38b20d39a23ccaf3e6d1cb6 Mon Sep 17 00:00:00 2001 From: Snorre Jr Date: Sun, 3 Nov 2024 04:08:53 +0100 Subject: [PATCH 2/5] subcomponents --- .../ActiveApplications.module.scss | 58 +++++ .../ActiveApplications/ActiveApplications.tsx | 226 ++++++++++++++++++ .../components/ActiveApplications/index.ts | 1 + .../WithdrawnApplications.module.scss | 31 +++ .../WithdrawnApplications.tsx | 68 ++++++ .../components/WithdrawnApplications/index.ts | 1 + 6 files changed, 385 insertions(+) create mode 100644 frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/ActiveApplications/ActiveApplications.module.scss create mode 100644 frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/ActiveApplications/ActiveApplications.tsx create mode 100644 frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/ActiveApplications/index.ts create mode 100644 frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/WithdrawnApplications/WithdrawnApplications.module.scss create mode 100644 frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/WithdrawnApplications/WithdrawnApplications.tsx create mode 100644 frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/WithdrawnApplications/index.ts diff --git a/frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/ActiveApplications/ActiveApplications.module.scss b/frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/ActiveApplications/ActiveApplications.module.scss new file mode 100644 index 000000000..20fc72101 --- /dev/null +++ b/frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/ActiveApplications/ActiveApplications.module.scss @@ -0,0 +1,58 @@ +.priorityControllArrow { + cursor: pointer; + + &:hover { + filter: brightness(150%); + transform: scale(1.5); + } + &:active { + cursor: none; + filter: brightness(200%); + transform: scale(0.5); + } +} + +.priorityControllBtnWrapper { + display: flex; + flex-direction: column; + justify-content: center; + align-items: start; + gap: 1rem; +} + +.positionName { + display: inline-block; +} + +.positionLinkWrapper { + position: relative; + display: inline-block; +} + +.priorityChangeIndicator { + position: absolute; + top: -1rem; + right: -2.25rem; + font-size: 3rem; + opacity: 0; + animation: fadeInOut 2s ease; +} + +@keyframes fadeInOut { + 0% { + opacity: 0; + transform: translateY(10px); + } + 15% { + opacity: 1; + transform: translateY(0); + } + 85% { + opacity: 1; + transform: translateY(0); + } + 100% { + opacity: 0; + transform: translateY(-10px); + } +} diff --git a/frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/ActiveApplications/ActiveApplications.tsx b/frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/ActiveApplications/ActiveApplications.tsx new file mode 100644 index 000000000..a734c301b --- /dev/null +++ b/frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/ActiveApplications/ActiveApplications.tsx @@ -0,0 +1,226 @@ +import { Icon } from '@iconify/react'; +import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; +import { useEffect, useState } from 'react'; +import { useTranslation } from 'react-i18next'; +import { toast } from 'react-toastify'; +import { Button, Link, Table } from '~/Components'; +import { + getRecruitmentApplicationsForApplicant, + putRecruitmentPriorityForUser, + withdrawRecruitmentApplicationApplicant, +} from '~/api'; +import type { RecruitmentApplicationDto, UserPriorityDto } from '~/dto'; +import { KEY } from '~/i18n/constants'; +import { reverse } from '~/named-urls'; +import { ROUTES } from '~/routes'; +import { COLORS } from '~/types'; +import { dbT, niceDateTime } from '~/utils'; +import type { ApplicantApplicationManagementQK } from '../../RecruitmentApplicationsOverviewPage'; +import styles from './ActiveApplications.module.scss'; +type PriorityChange = { + id: string; + direction: 'up' | 'down'; +}; + +type ActiveApplicationsProps = { + recruitmentId?: string; + queryKey: ApplicantApplicationManagementQK; +}; + +export function ActiveApplications({ recruitmentId, queryKey }: ActiveApplicationsProps) { + const { t } = useTranslation(); + const queryClient = useQueryClient(); + const [recentChanges, setRecentChanges] = useState([]); + // Clear the recent change after 2 seconds + useEffect(() => { + if (recentChanges.length > 0) { + const timer = setTimeout(() => { + setRecentChanges([]); + }, 2000); + return () => clearTimeout(timer); + } + }, [recentChanges]); + + // Query for fetching applications + const { data: applications = [] } = useQuery({ + queryKey: ['applications', recruitmentId], + queryFn: () => getRecruitmentApplicationsForApplicant(recruitmentId as string).then((response) => response.data), + enabled: !!recruitmentId, + }); + + // Mutation for changing priority, also deals with displaying priority direction + const priorityMutation = useMutation({ + mutationFn: ({ id, direction }: PriorityChange) => { + const data: UserPriorityDto = { direction: direction === 'up' ? 1 : -1 }; + return putRecruitmentPriorityForUser(id, data); + }, + onSuccess: (response, variables) => { + const oldData = queryClient.getQueryData(['applications', recruitmentId]); + queryClient.setQueryData(['applications', recruitmentId], response.data); + + if (oldData) { + const clickedApp = oldData.find((app) => app.id === variables.id); + const swappedApp = response.data.find( + (newApp) => + clickedApp && newApp.applicant_priority === clickedApp.applicant_priority && newApp.id !== clickedApp.id, + ); + + if (clickedApp && swappedApp) { + const changes: PriorityChange[] = [ + { id: clickedApp.id, direction: variables.direction }, + { id: swappedApp.id, direction: variables.direction === 'up' ? 'down' : 'up' }, + ]; + setRecentChanges(changes); + } + } + }, + onError: () => { + toast.error(t(KEY.common_something_went_wrong)); + }, + }); + + // Mutation for withdrawing application + const withdrawMutation = useMutation({ + mutationFn: (positionId: string) => withdrawRecruitmentApplicationApplicant(positionId), + onSuccess: () => { + // Pass the proper query filter objects + queryClient.invalidateQueries({ + queryKey: queryKey.applications(recruitmentId as string), + }); + queryClient.invalidateQueries({ + queryKey: queryKey.withdrawnApplications(recruitmentId as string), + }); + }, + onError: () => { + toast.error(t(KEY.common_something_went_wrong)); + }, + }); + + const handleChangePriority = (id: string, direction: 'up' | 'down') => { + priorityMutation.mutate({ id, direction }); + }; + + const upDownArrow = (id: string) => { + return ( +
+ + +
+ ); + }; + + const applicationLink = (application: RecruitmentApplicationDto) => { + const change = recentChanges.find((change) => change.id === application.id); + + return ( +
+ {change && + (change.direction === 'up' ? ( + + ) : ( + + ))} + + {dbT(application.recruitment_position, 'name')} + +
+ ); + }; + + const withdrawButton = (application: RecruitmentApplicationDto) => { + return ( + + ); + }; + const tableColumns = [ + // Only include priority column if there are multiple applications + ...(applications.length > 1 ? [{ sortable: false, content: t(KEY.recruitment_change_priority) }] : []), + { sortable: false, content: t(KEY.recruitment_application_for_position) }, + // Only include priority display if there are multiple applications + ...(applications.length > 1 ? [{ sortable: false, content: t(KEY.recruitment_your_priority) }] : []), + { sortable: false, content: t(KEY.recruitment_interview_time) }, + { sortable: false, content: t(KEY.recruitment_interview_location) }, + { sortable: false, content: t(KEY.recruitment_withdraw_application) }, + ]; + + const tableRows = applications.map((application) => ({ + cells: [ + // Only include priority arrows if there are multiple applications + ...(applications.length > 1 + ? [ + { + content: upDownArrow(application.id), + }, + ] + : []), + { + content: applicationLink(application), + }, + // Only include priority number if there are multiple applications + ...(applications.length > 1 + ? [ + { + content: application.applicant_priority, + }, + ] + : []), + { + content: niceDateTime(application.interview?.interview_time) ?? '-', + }, + { + content: application.interview?.interview_location ?? '-', + }, + { + content: withdrawButton(application), + }, + ], + })); + + return ( +
+ {applications.length > 0 ? ( + + ) : ( +

{t(KEY.recruitment_not_applied)}

+ )} + + ); +} diff --git a/frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/ActiveApplications/index.ts b/frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/ActiveApplications/index.ts new file mode 100644 index 000000000..5a85a5931 --- /dev/null +++ b/frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/ActiveApplications/index.ts @@ -0,0 +1 @@ +export { ActiveApplications } from './ActiveApplications'; diff --git a/frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/WithdrawnApplications/WithdrawnApplications.module.scss b/frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/WithdrawnApplications/WithdrawnApplications.module.scss new file mode 100644 index 000000000..12e923507 --- /dev/null +++ b/frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/WithdrawnApplications/WithdrawnApplications.module.scss @@ -0,0 +1,31 @@ +@import 'src/mixins'; + +@import 'src/constants'; + +.withdrawnHeader { + background-color: $red-samf; + color: $white; + &:hover { + background-color: $red-samf; + filter: brightness(95%); + } + border: none; +} + +.withdrawnRow { + background-color: $grey-3; + &:hover { + background-color: $grey-3; + filter: brightness(95%); + } + border-bottom: none; + border-top: 1px solid $grey-2; +} + +.withdrawnContainer { + margin-top: 2em; +} + +.withdrawnText { + color: $red; +} diff --git a/frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/WithdrawnApplications/WithdrawnApplications.tsx b/frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/WithdrawnApplications/WithdrawnApplications.tsx new file mode 100644 index 000000000..a99fef535 --- /dev/null +++ b/frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/WithdrawnApplications/WithdrawnApplications.tsx @@ -0,0 +1,68 @@ +import { useQuery } from '@tanstack/react-query'; +import { useTranslation } from 'react-i18next'; +import { Link, Table } from '~/Components'; +import { getWithdrawRecruitmentApplicationApplicant } from '~/api'; +import type { RecruitmentApplicationDto } from '~/dto'; +import { KEY } from '~/i18n/constants'; +import { reverse } from '~/named-urls'; +import { ROUTES } from '~/routes'; +import { dbT } from '~/utils'; +import type { ApplicantApplicationManagementQK } from '../../RecruitmentApplicationsOverviewPage'; +import styles from './WithdrawnApplications.module.scss'; + +type WithdrawnApplicationsProps = { + recruitmentId?: string; + queryKey: ApplicantApplicationManagementQK; +}; +export function WithdrawnApplications({ recruitmentId, queryKey }: WithdrawnApplicationsProps) { + const { t } = useTranslation(); + + const { data: withdrawnApplications = [] } = useQuery({ + queryKey: queryKey.withdrawnApplications(recruitmentId as string), + queryFn: () => + getWithdrawRecruitmentApplicationApplicant(recruitmentId as string).then((response) => response.data), + enabled: !!recruitmentId, + }); + + const withdrawnTableColumns = [{ sortable: true, content: t(KEY.recruitment_withdrawn) }]; + + function withdrawnApplicationToTableRow(application: RecruitmentApplicationDto) { + return [ + { + value: dbT(application.recruitment_position, 'name'), + content: ( + + {dbT(application.recruitment_position, 'name')} + + ), + }, + ]; + } + + return ( +
+ {withdrawnApplications.length > 0 && ( +
+
({ + cells: withdrawnApplicationToTableRow(application), + }))} + columns={withdrawnTableColumns} + /> + + )} + + ); +} diff --git a/frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/WithdrawnApplications/index.ts b/frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/WithdrawnApplications/index.ts new file mode 100644 index 000000000..31d7f4813 --- /dev/null +++ b/frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/WithdrawnApplications/index.ts @@ -0,0 +1 @@ +export { WithdrawnApplications } from './WithdrawnApplications'; From 9127bd54c052b1c56c24b059131fcd555b6a13f4 Mon Sep 17 00:00:00 2001 From: Snorre Jr Date: Sun, 3 Nov 2024 04:09:11 +0100 Subject: [PATCH 3/5] translations and API --- frontend/src/api.ts | 12 ++++++++++++ frontend/src/i18n/constants.ts | 3 +++ frontend/src/i18n/translations.ts | 6 ++++++ 3 files changed, 21 insertions(+) diff --git a/frontend/src/api.ts b/frontend/src/api.ts index 9a7997519..d3ed3b72b 100644 --- a/frontend/src/api.ts +++ b/frontend/src/api.ts @@ -990,6 +990,18 @@ export async function withdrawRecruitmentApplicationApplicant(positionId: number return response; } +export async function getWithdrawRecruitmentApplicationApplicant(positionId: number | string): Promise { + const url = + BACKEND_DOMAIN + + reverse({ + pattern: ROUTES.backend.samfundet__recruitment_withdraw_application, + urlParams: { pk: positionId }, + }); + const response = await axios.get(url, { withCredentials: true }); + + return response; +} + export async function withdrawRecruitmentApplicationRecruiter(id: string): Promise { const url = BACKEND_DOMAIN + diff --git a/frontend/src/i18n/constants.ts b/frontend/src/i18n/constants.ts index 6f8a67974..b54c4b01b 100644 --- a/frontend/src/i18n/constants.ts +++ b/frontend/src/i18n/constants.ts @@ -293,7 +293,9 @@ export const KEY = { recruitment_no_active: 'recruitment_no_active', recruitment_interview_notes: 'recruitment_interview_notes', recruitment_priority: 'recruitment_priority', + recruitment_your_priority: 'recruitment_your_priority', recruitment_recruiter_priority: 'recruitment_recruiter_priority', + recruitment_change_priority: 'recruitment_change_priority', recruitment_recruiter_status: 'recruitment_recruiter_status', recruitment_duration: 'recruitment_duration', recruitment_funksjonaer: 'recruitment_funksjonaer', @@ -310,6 +312,7 @@ export const KEY = { recruitment_administrate_applications: 'recruitment_administrate_applications', recruitment_unprocessed_applicants: 'recruitment_unprocessed_applicants', recruitment_administrate_reservations: 'recruitment_administrate_reservations', + recruitment_application_for_position: 'recruitment_application_for_position', recruitment_my_applications: 'recruitment_my_applications', recruitment_all_applications: 'recruitment_all_applications', recruitment_not_applied: 'recruitment_not_applied', diff --git a/frontend/src/i18n/translations.ts b/frontend/src/i18n/translations.ts index 1e3a3b20e..7587f5057 100644 --- a/frontend/src/i18n/translations.ts +++ b/frontend/src/i18n/translations.ts @@ -258,6 +258,7 @@ export const nb = prepareTranslations({ [KEY.recruitment_applicant]: 'Søker', [KEY.recruitment_applicants]: 'Søkere', [KEY.recruitment_my_applications]: 'Mine søknader', + [KEY.recruitment_application_for_position]: 'Søknad på verv', [KEY.recruitment_all_applications]: 'Alle søknader', [KEY.recruitment_not_applied]: 'Du har ikke sendt søknader til noen stillinger ennå', [KEY.recruitment_will_be_anonymized]: 'All info relatert til dine søknader vil bli slettet 3 uker etter opptaket', @@ -276,6 +277,8 @@ export const nb = prepareTranslations({ [KEY.recruitment_no_active]: 'Ingen aktive opptak', [KEY.recruitment_interview_notes]: 'Intervju notater', [KEY.recruitment_priority]: 'Søkers prioritet', + [KEY.recruitment_your_priority]: 'Din prioritering av verv', + [KEY.recruitment_change_priority]: 'Endre prioritet', [KEY.recruitment_recruiter_priority]: 'Prioritet', [KEY.recruitment_recruiter_status]: 'Status', [KEY.common_not_set]: 'Ikke satt', @@ -742,6 +745,7 @@ export const en = prepareTranslations({ [KEY.recruitment_applicant]: 'Applicant', [KEY.recruitment_applicants]: 'Applicants', [KEY.recruitment_my_applications]: 'My applications', + [KEY.recruitment_application_for_position]: 'Application for position', [KEY.recruitment_all_applications]: 'All applications', [KEY.recruitment_not_applied]: 'You have not applied to any positions yet', [KEY.recruitment_will_be_anonymized]: @@ -757,6 +761,8 @@ export const en = prepareTranslations({ [KEY.recruitment_interview_location]: 'Interview Location', [KEY.recruitment_interview_notes]: 'Interview notes', [KEY.recruitment_priority]: 'Applicants priority', + [KEY.recruitment_your_priority]: 'Your position priority', + [KEY.recruitment_change_priority]: 'Change priority', [KEY.recruitment_recruiter_priority]: 'Priority', [KEY.recruitment_recruiter_status]: 'Status', [KEY.common_not_set]: 'Not set', From 3dffc59bd3eb420c0a37858c5cf275e518636da4 Mon Sep 17 00:00:00 2001 From: Snorre Jr Date: Sun, 3 Nov 2024 04:10:19 +0100 Subject: [PATCH 4/5] reafactor RecruitmentApplicationsOverviewPage --- ...itmentApplicationsOverviewPage.module.scss | 39 ---- .../RecruitmentApplicationsOverviewPage.tsx | 174 ++---------------- .../components/index.ts | 2 + 3 files changed, 17 insertions(+), 198 deletions(-) create mode 100644 frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/index.ts diff --git a/frontend/src/Pages/RecruitmentApplicationsOverviewPage/RecruitmentApplicationsOverviewPage.module.scss b/frontend/src/Pages/RecruitmentApplicationsOverviewPage/RecruitmentApplicationsOverviewPage.module.scss index dafe2e4ad..fe5726e36 100644 --- a/frontend/src/Pages/RecruitmentApplicationsOverviewPage/RecruitmentApplicationsOverviewPage.module.scss +++ b/frontend/src/Pages/RecruitmentApplicationsOverviewPage/RecruitmentApplicationsOverviewPage.module.scss @@ -28,42 +28,3 @@ $back-button-width: 5rem; .empty_div { width: $back-button-width; } - -.arrows { - &:hover { - filter: brightness(150%); - transform: scale(1.05); - } - &:active { - filter: brightness(200%); - transform: scale(1.10); - } -} - -.withdrawnHeader { - background-color: $red-samf; - color: $white; - &:hover { - background-color: $red-samf; - filter: brightness(95%); - } - border:none; -} - -.withdrawnRow { - background-color: $grey-3; - &:hover { - background-color: $grey-3; - filter: brightness(95%); - } - border-bottom: none; - border-top: 1px solid $grey-2; -} - -.withdrawnContainer { - margin-top: 2em; -} - -.withdrawnText { - color: $red; -} diff --git a/frontend/src/Pages/RecruitmentApplicationsOverviewPage/RecruitmentApplicationsOverviewPage.tsx b/frontend/src/Pages/RecruitmentApplicationsOverviewPage/RecruitmentApplicationsOverviewPage.tsx index d36979d25..d9cc9d03d 100644 --- a/frontend/src/Pages/RecruitmentApplicationsOverviewPage/RecruitmentApplicationsOverviewPage.tsx +++ b/frontend/src/Pages/RecruitmentApplicationsOverviewPage/RecruitmentApplicationsOverviewPage.tsx @@ -1,147 +1,25 @@ -import { Icon } from '@iconify/react'; -import { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; -import { useNavigate, useParams } from 'react-router-dom'; -import { toast } from 'react-toastify'; -import { Button, Link, Page } from '~/Components'; +import { useParams } from 'react-router-dom'; +import { Button, Page } from '~/Components'; import { OccupiedFormModal } from '~/Components/OccupiedForm'; -import { Table } from '~/Components/Table'; -import { Text } from '~/Components/Text/Text'; -import { - getRecruitmentApplicationsForApplicant, - putRecruitmentPriorityForUser, - withdrawRecruitmentApplicationApplicant, -} from '~/api'; -import type { RecruitmentApplicationDto, UserPriorityDto } from '~/dto'; import { KEY } from '~/i18n/constants'; -import { reverse } from '~/named-urls'; import { ROUTES } from '~/routes'; -import { dbT, niceDateTime } from '~/utils'; import styles from './RecruitmentApplicationsOverviewPage.module.scss'; +import { ActiveApplications, WithdrawnApplications } from './components'; + +export type ApplicantApplicationManagementQK = { + applications: (recruitmentId: string) => readonly ['applications', string]; + withdrawnApplications: (recruitmentId: string) => readonly ['withdrawnApplications', string]; +}; export function RecruitmentApplicationsOverviewPage() { const { recruitmentId } = useParams(); - const [applications, setApplications] = useState([]); - const [withdrawnApplications, setWithdrawnApplications] = useState([]); - const navigate = useNavigate(); - const { t } = useTranslation(); - function handleChangePriority(id: string, direction: 'up' | 'down') { - const data: UserPriorityDto = { direction: direction === 'up' ? 1 : -1 }; - putRecruitmentPriorityForUser(id, data).then((response) => { - setApplications(response.data); - }); - } - - function upDownArrow(id: string) { - return ( - <> - handleChangePriority(id, 'up')} /> - handleChangePriority(id, 'down')} /> - - ); - } - - useEffect(() => { - if (recruitmentId) { - getRecruitmentApplicationsForApplicant(recruitmentId).then((response) => { - setApplications(response.data.filter((application) => !application.withdrawn)); - setWithdrawnApplications(response.data.filter((application) => application.withdrawn)); - }); - } - }, [recruitmentId]); - - const tableColumns = [ - { sortable: false, content: t(KEY.recruitment_position) }, - { sortable: false, content: t(KEY.recruitment_interview_time) }, - { sortable: false, content: t(KEY.recruitment_interview_location) }, - { sortable: true, content: t(KEY.recruitment_priority) }, - { sortable: false, content: '' }, - { sortable: false, content: '' }, - ]; - - function applicationToTableRow(application: RecruitmentApplicationDto) { - const position = [ - { - content: ( - - {dbT(application.recruitment_position, 'name')} - - ), - }, - ]; - const notWithdrawn = [ - niceDateTime(application.interview?.interview_time), - application.interview?.interview_location, - application.applicant_priority, - { content: upDownArrow(application.id) }, - ]; - const withdrawn = [ - { - content: ( - - {t(KEY.recruitment_withdrawn)} - - ), - }, - ]; - const widthdrawButton = { - content: ( - - ), - }; - return [...position, ...(application.withdrawn ? withdrawn : notWithdrawn), widthdrawButton]; - } - - const withdrawnTableColumns = [{ sortable: true, content: t(KEY.recruitment_withdrawn) }]; - - function withdrawnApplicationToTableRow(application: RecruitmentApplicationDto) { - return [ - { - value: dbT(application.recruitment_position, 'name'), - content: ( - - {dbT(application.recruitment_position, 'name')} - - ), - }, - ]; - } + const QUERY_KEYS: ApplicantApplicationManagementQK = { + applications: (recruitmentId: string) => ['applications', recruitmentId] as const, + withdrawnApplications: (recruitmentId: string) => ['withdrawnApplications', recruitmentId] as const, + }; return ( @@ -153,32 +31,10 @@ export function RecruitmentApplicationsOverviewPage() {

{t(KEY.recruitment_my_applications)}

-

{t(KEY.recruitment_will_be_anonymized)}

- {applications.length > 0 ? ( -
({ cells: applicationToTableRow(application) }))} - columns={tableColumns} - defaultSortColumn={3} - /> - ) : ( -

{t(KEY.recruitment_not_applied)}

- )} - - - {withdrawnApplications.length > 0 && ( -
-
({ - cells: withdrawnApplicationToTableRow(application), - }))} - columns={withdrawnTableColumns} - /> - - )} +

{t(KEY.recruitment_will_be_anonymized)}

+ + ); diff --git a/frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/index.ts b/frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/index.ts new file mode 100644 index 000000000..2d5ce7928 --- /dev/null +++ b/frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/index.ts @@ -0,0 +1,2 @@ +export { ActiveApplications } from './ActiveApplications'; +export { WithdrawnApplications } from './WithdrawnApplications'; From acbd6d0bae96d55f6a4c7431a1e43704b5f8d17c Mon Sep 17 00:00:00 2001 From: Snorre Jr Date: Sun, 3 Nov 2024 04:15:08 +0100 Subject: [PATCH 5/5] change ID to Id --- .../WithdrawnApplications/WithdrawnApplications.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/WithdrawnApplications/WithdrawnApplications.tsx b/frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/WithdrawnApplications/WithdrawnApplications.tsx index a99fef535..38a98aae8 100644 --- a/frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/WithdrawnApplications/WithdrawnApplications.tsx +++ b/frontend/src/Pages/RecruitmentApplicationsOverviewPage/components/WithdrawnApplications/WithdrawnApplications.tsx @@ -35,8 +35,8 @@ export function WithdrawnApplications({ recruitmentId, queryKey }: WithdrawnAppl url={reverse({ pattern: ROUTES.frontend.recruitment_application, urlParams: { - positionID: application.recruitment_position.id, - gangID: application.recruitment_position.gang.id, + positionId: application.recruitment_position.id, + gangId: application.recruitment_position.gang.id, }, })} className={styles.withdrawnLink}