Skip to content

Commit

Permalink
feat: add new rich text field 'answering questions'
Browse files Browse the repository at this point in the history
  • Loading branch information
thorkellmani committed Jan 14, 2025
1 parent f737a18 commit 9c78001
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 0 deletions.
18 changes: 18 additions & 0 deletions apps/web/screens/Grants/Grant/Grant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,24 @@ const GrantSinglePage: CustomScreen<GrantSingleProps> = ({ grant, locale }) => {
</>
) : undefined}

{grant.answeringQuestions?.length ? (
<>
<Box>
<Text variant="h3">
{formatMessage(m.single.answeringQuestions)}
</Text>
<Box className="rs_read">
{webRichText(
grant.answeringQuestions as SliceType[],
undefined,
locale,
)}
</Box>
</Box>
<Divider />
</>
) : undefined}

{grant.applicationHints?.length ? (
<Box className="rs_read">
{webRichText(
Expand Down
4 changes: 4 additions & 0 deletions apps/web/screens/Grants/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
4 changes: 4 additions & 0 deletions apps/web/screens/queries/Grants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ export const GET_GRANT_QUERY = gql`
...AllSlices
${nestedFields}
}
answeringQuestions {
...AllSlices
${nestedFields}
}
applicationHints {
...AllSlices
${nestedFields}
Expand Down
3 changes: 3 additions & 0 deletions libs/cms/src/lib/generated/contentfulTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1873,6 +1873,9 @@ export interface IGrantFields {
/** Application hints */
grantApplicationHints?: Document | undefined

/** Answering questions */
grantAnsweringQuestions?: Document | undefined

/** Application url */
granApplicationUrl?: ILinkUrl | undefined

Expand Down
9 changes: 9 additions & 0 deletions libs/cms/src/lib/models/grant.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ export class Grant {
@CacheField(() => [SliceUnion])
howToApply?: Array<typeof SliceUnion>

@CacheField(() => [SliceUnion])
answeringQuestions?: Array<typeof SliceUnion>

@CacheField(() => [SliceUnion])
applicationHints?: Array<typeof SliceUnion>

Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 9c78001

Please sign in to comment.