diff --git a/frontend/src/Pages/OrganizationRecruitmentPage/OrganizationRecruitmentPage.tsx b/frontend/src/Pages/OrganizationRecruitmentPage/OrganizationRecruitmentPage.tsx index f567826df..6413c9e83 100644 --- a/frontend/src/Pages/OrganizationRecruitmentPage/OrganizationRecruitmentPage.tsx +++ b/frontend/src/Pages/OrganizationRecruitmentPage/OrganizationRecruitmentPage.tsx @@ -4,18 +4,33 @@ import { useTranslation } from 'react-i18next'; import { useParams } from 'react-router-dom'; import { Button, Logo, OccupiedFormModal, Page, SamfundetLogoSpinner, Text, Video } from '~/Components'; import { PersonalRow } from '~/Pages/RecruitmentPage'; -import { getOrganization, getRecruitment } from '~/api'; +import { getRecruitment } from '~/api'; import { useOrganizationContext } from '~/context/OrgContextProvider'; import type { RecruitmentDto } from '~/dto'; import { useDesktop, useTitle } from '~/hooks'; import { KEY } from '~/i18n/constants'; import { OrgNameType, type OrgNameTypeValue } from '~/types'; -import { dbT, getObjectFieldOrNumber } from '~/utils'; +import { dbT } from '~/utils'; import { GangSeparatePositions, GangTypeContainer, RecruitmentTabs } from './Components'; import styles from './OrganizationRecruitmentPage.module.scss'; type ViewMode = 'list' | 'tab'; +const ORG_STYLES = { + [OrgNameType.SAMFUNDET_NAME]: { + subHeaderStyle: styles.samfRecruitmentSubHeader, + }, + [OrgNameType.UKA_NAME]: { + subHeaderStyle: styles.ukaRecruitmentSubHeader, + }, + [OrgNameType.ISFIT_NAME]: { + subHeaderStyle: styles.isfitRecruitmentSubHeader, + }, + [OrgNameType.FALLBACK]: { + subHeaderStyle: '', + }, +}; + export function OrganizationRecruitmentPage() { const isDesktop = useDesktop(); const { recruitmentId } = useParams<{ recruitmentId: string }>(); @@ -23,7 +38,6 @@ export function OrganizationRecruitmentPage() { const { t } = useTranslation(); const { changeOrgTheme, organizationTheme } = useOrganizationContext(); const [recruitment, setRecruitment] = useState(); - const [organizationName, setOrganizationName] = useState(OrgNameType.FALLBACK); const [loading, setLoading] = useState(true); const [positionsViewMode, setViewMode] = useState('list'); @@ -43,25 +57,10 @@ export function OrganizationRecruitmentPage() { useEffect(() => { if (recruitment) { - getOrganization(getObjectFieldOrNumber(recruitment.organization, 'id')) - .then((response) => { - if (Object.values(OrgNameType).includes(response.name as OrgNameTypeValue)) { - setOrganizationName(response.name as OrgNameTypeValue); - } - }) - .catch((error) => { - console.log(error); - setOrganizationName(OrgNameType.FALLBACK); - }); + changeOrgTheme(recruitment.organization.name as OrgNameTypeValue); } setLoading(false); - }, [recruitment]); - - useEffect(() => { - if (organizationName) { - changeOrgTheme(organizationName); - } - }, [organizationName, changeOrgTheme]); + }, [recruitment, changeOrgTheme]); function toggleViewAll() { const toggledValue = !viewAllPositions; @@ -75,7 +74,11 @@ export function OrganizationRecruitmentPage() { ) : (
- + {dbT(recruitment, 'name')} @@ -83,14 +86,12 @@ export function OrganizationRecruitmentPage() { {recruitment?.promo_media &&