From 9c78001728a4a6f1987c673422924839e1a17b5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Eorkell=20M=C3=A1ni=20=C3=9Eorkelsson?= Date: Tue, 14 Jan 2025 15:33:48 +0000 Subject: [PATCH] feat: add new rich text field 'answering questions' --- apps/web/screens/Grants/Grant/Grant.tsx | 18 ++++++++++++++++++ apps/web/screens/Grants/messages.ts | 4 ++++ apps/web/screens/queries/Grants.ts | 4 ++++ .../cms/src/lib/generated/contentfulTypes.d.ts | 3 +++ libs/cms/src/lib/models/grant.model.ts | 9 +++++++++ 5 files changed, 38 insertions(+) diff --git a/apps/web/screens/Grants/Grant/Grant.tsx b/apps/web/screens/Grants/Grant/Grant.tsx index c557ca00bf24..78965d643b00 100644 --- a/apps/web/screens/Grants/Grant/Grant.tsx +++ b/apps/web/screens/Grants/Grant/Grant.tsx @@ -181,6 +181,24 @@ const GrantSinglePage: CustomScreen = ({ grant, locale }) => { ) : undefined} + {grant.answeringQuestions?.length ? ( + <> + + + {formatMessage(m.single.answeringQuestions)} + + + {webRichText( + grant.answeringQuestions as SliceType[], + undefined, + locale, + )} + + + + + ) : undefined} + {grant.applicationHints?.length ? ( {webRichText( diff --git a/apps/web/screens/Grants/messages.ts b/apps/web/screens/Grants/messages.ts index 1047ab3883dc..6b2cd4b3add8 100644 --- a/apps/web/screens/Grants/messages.ts +++ b/apps/web/screens/Grants/messages.ts @@ -174,6 +174,10 @@ export const m = { id: 'web.grants:single.howToApply', defaultMessage: 'Hvernig er sótt um?', }, + answeringQuestions: { + id: 'web.grants:single.answeringQuestions', + defaultMessage: 'Svör við spurningum', + }, }), home: defineMessages({ title: { diff --git a/apps/web/screens/queries/Grants.ts b/apps/web/screens/queries/Grants.ts index c62a073a363b..d42c2c3928a6 100644 --- a/apps/web/screens/queries/Grants.ts +++ b/apps/web/screens/queries/Grants.ts @@ -121,6 +121,10 @@ export const GET_GRANT_QUERY = gql` ...AllSlices ${nestedFields} } + answeringQuestions { + ...AllSlices + ${nestedFields} + } applicationHints { ...AllSlices ${nestedFields} diff --git a/libs/cms/src/lib/generated/contentfulTypes.d.ts b/libs/cms/src/lib/generated/contentfulTypes.d.ts index 0d1d8a29ae32..2208cecabfe5 100644 --- a/libs/cms/src/lib/generated/contentfulTypes.d.ts +++ b/libs/cms/src/lib/generated/contentfulTypes.d.ts @@ -1873,6 +1873,9 @@ export interface IGrantFields { /** Application hints */ grantApplicationHints?: Document | undefined + /** Answering questions */ + grantAnsweringQuestions?: Document | undefined + /** Application url */ granApplicationUrl?: ILinkUrl | undefined diff --git a/libs/cms/src/lib/models/grant.model.ts b/libs/cms/src/lib/models/grant.model.ts index d497c9f81168..2f5a048c5d17 100644 --- a/libs/cms/src/lib/models/grant.model.ts +++ b/libs/cms/src/lib/models/grant.model.ts @@ -57,6 +57,9 @@ export class Grant { @CacheField(() => [SliceUnion]) howToApply?: Array + @CacheField(() => [SliceUnion]) + answeringQuestions?: Array + @CacheField(() => [SliceUnion]) applicationHints?: Array @@ -162,6 +165,12 @@ export const mapGrant = ({ fields, sys }: IGrant): Grant => { applicationHints: fields.grantApplicationHints ? mapDocument(fields.grantApplicationHints, sys.id + ':application-hints') : [], + answeringQuestions: fields.grantAnsweringQuestions + ? mapDocument( + fields.grantAnsweringQuestions, + sys.id + ':answering-questions', + ) + : [], dateFrom: parseDate(fields.grantDateFrom, fields.grantOpenFromHour), dateTo: parseDate(fields.grantDateTo, fields.grantOpenToHour), status: parseStatus(fields),