From 97b3f0f9d55ccc2452d7810513f58b1bd23a98fd Mon Sep 17 00:00:00 2001 From: runarvestmann Date: Tue, 30 Apr 2024 13:38:22 +0000 Subject: [PATCH] Wrap vacancies pages with custom page wrapper --- ...ndicGovernmentInstitutionVacanciesList.tsx | 19 +++++++++++-------- ...dicGovernmentInstitutionVacancyDetails.tsx | 14 ++++++++------ libs/cms/src/lib/dto/getCustomPage.input.ts | 1 + .../src/lib/generated/contentfulTypes.d.ts | 5 ++++- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/apps/web/screens/IcelandicGovernmentInstitutionVacancies/IcelandicGovernmentInstitutionVacanciesList.tsx b/apps/web/screens/IcelandicGovernmentInstitutionVacancies/IcelandicGovernmentInstitutionVacanciesList.tsx index ca84684ee7ca..1403af9b5d02 100644 --- a/apps/web/screens/IcelandicGovernmentInstitutionVacancies/IcelandicGovernmentInstitutionVacanciesList.tsx +++ b/apps/web/screens/IcelandicGovernmentInstitutionVacancies/IcelandicGovernmentInstitutionVacanciesList.tsx @@ -28,6 +28,7 @@ import { Webreader, } from '@island.is/web/components' import { + CustomPageUniqueIdentifier, GetIcelandicGovernmentInstitutionVacanciesQuery, GetIcelandicGovernmentInstitutionVacanciesQueryVariables, GetNamespaceQuery, @@ -40,6 +41,7 @@ import { withMainLayout } from '@island.is/web/layouts/main' import { Screen } from '@island.is/web/types' import { CustomNextError } from '@island.is/web/units/errors' +import { withCustomPageWrapper } from '../CustomPage/CustomPageWrapper' import { extractFilterTags } from '../Organization/PublishedMaterial/utils' import { GET_NAMESPACE_QUERY } from '../queries' import { GET_ICELANDIC_GOVERNMENT_INSTITUTION_VACANCIES } from '../queries/IcelandicGovernmentInstitutionVacancies' @@ -695,10 +697,6 @@ IcelandicGovernmentInstitutionVacanciesList.getProps = async ({ namespaceResponse?.data?.getNamespace?.fields || '{}', ) as Record - if (namespace['display404']) { - throw new CustomNextError(404, 'Vacancies on Ísland.is are turned off') - } - const vacanciesResponse = await apolloClient.query< GetIcelandicGovernmentInstitutionVacanciesQuery, GetIcelandicGovernmentInstitutionVacanciesQueryVariables @@ -715,10 +713,15 @@ IcelandicGovernmentInstitutionVacanciesList.getProps = async ({ return { vacancies, namespace, - customAlertBanner: namespace['customAlertBanner'], } } -export default withMainLayout(IcelandicGovernmentInstitutionVacanciesList, { - footerVersion: 'organization', -}) +export default withMainLayout( + withCustomPageWrapper( + CustomPageUniqueIdentifier.Vacancies, + IcelandicGovernmentInstitutionVacanciesList, + ), + { + footerVersion: 'organization', + }, +) diff --git a/apps/web/screens/IcelandicGovernmentInstitutionVacancies/IcelandicGovernmentInstitutionVacancyDetails.tsx b/apps/web/screens/IcelandicGovernmentInstitutionVacancies/IcelandicGovernmentInstitutionVacancyDetails.tsx index bed450bd4878..61c3dadfec43 100644 --- a/apps/web/screens/IcelandicGovernmentInstitutionVacancies/IcelandicGovernmentInstitutionVacancyDetails.tsx +++ b/apps/web/screens/IcelandicGovernmentInstitutionVacancies/IcelandicGovernmentInstitutionVacancyDetails.tsx @@ -15,6 +15,7 @@ import { Webreader, } from '@island.is/web/components' import { + CustomPageUniqueIdentifier, GetIcelandicGovernmentInstitutionVacancyDetailsQuery, GetIcelandicGovernmentInstitutionVacancyDetailsQueryVariables, GetNamespaceQuery, @@ -28,6 +29,7 @@ import { Screen } from '@island.is/web/types' import { CustomNextError } from '@island.is/web/units/errors' import { webRichText } from '@island.is/web/utils/richText' +import { withCustomPageWrapper } from '../CustomPage/CustomPageWrapper' import SidebarLayout from '../Layouts/SidebarLayout' import { GET_NAMESPACE_QUERY } from '../queries' import { GET_ICELANDIC_GOVERNMENT_INSTITUTION_VACANCY_DETAILS } from '../queries/IcelandicGovernmentInstitutionVacancies' @@ -398,15 +400,15 @@ IcelandicGovernmentInstitutionVacancyDetails.getProps = async ({ namespaceResponse?.data?.getNamespace?.fields || '{}', ) as Record - if (namespace['display404']) { - throw new CustomNextError(404, 'Vacancies on Ísland.is are turned off') - } - return { vacancy, namespace, - customAlertBanner: namespace['customAlertBanner'], } } -export default withMainLayout(IcelandicGovernmentInstitutionVacancyDetails) +export default withMainLayout( + withCustomPageWrapper( + CustomPageUniqueIdentifier.Vacancies, + IcelandicGovernmentInstitutionVacancyDetails, + ), +) diff --git a/libs/cms/src/lib/dto/getCustomPage.input.ts b/libs/cms/src/lib/dto/getCustomPage.input.ts index a741cf59e0d5..fb044f33b005 100644 --- a/libs/cms/src/lib/dto/getCustomPage.input.ts +++ b/libs/cms/src/lib/dto/getCustomPage.input.ts @@ -6,6 +6,7 @@ import { CacheField } from '@island.is/nest/graphql' export enum CustomPageUniqueIdentifier { PensionCalculator = 'PensionCalculator', OfficialJournalOfIceland = 'OfficialJournalOfIceland', + Vacancies = 'Vacancies', } registerEnumType(CustomPageUniqueIdentifier, { diff --git a/libs/cms/src/lib/generated/contentfulTypes.d.ts b/libs/cms/src/lib/generated/contentfulTypes.d.ts index fa34e4272905..3e49fa9adce2 100644 --- a/libs/cms/src/lib/generated/contentfulTypes.d.ts +++ b/libs/cms/src/lib/generated/contentfulTypes.d.ts @@ -739,7 +739,10 @@ export interface ICustomPageFields { title?: string | undefined /** Unique Identifier */ - uniqueIdentifier: 'PensionCalculator' | 'OfficialJournalOfIceland' + uniqueIdentifier: + | 'PensionCalculator' + | 'OfficialJournalOfIceland' + | 'Vacancies' /** Alert Banner */ alertBanner?: IAlertBanner | undefined