diff --git a/graphql/queries/indigenousEiArticlesQuery.graphql b/graphql/queries/indigenousEiArticlesQuery.graphql new file mode 100644 index 0000000000..8830553305 --- /dev/null +++ b/graphql/queries/indigenousEiArticlesQuery.graphql @@ -0,0 +1,342 @@ +query getIndigenousEiArticles { + sclabsPageV1List( + filter: { + scContentType: { + _expressions: [ + { + value: "gc:content-types/promotional-material-featured-articles" + _operator: EQUALS + } + ] + } + _path: { + _expressions: [ + { + value: "/content/dam/decd-endc/content-fragments/sclabs/pages/projects/ei-indigenous/updates/" + _operator: STARTS_WITH + } + ] + } + } + ) { + items { + _path + scId + scPageNameEn + scPageNameFr + scTitleEn + scTitleFr + scShortTitleEn + scShortTitleFr + scBreadcrumbParentPages { + ... on SclabsPageV1Model { + scTitleEn + scTitleFr + scPageNameEn + scPageNameFr + } + } + scSubject + scKeywordsEn + scKeywordsFr + scContentType + scOwner + scDateModifiedOverwrite + scAudience + scRegion + scSocialMediaImageEn { + ... on ImageRef { + _path + _publishUrl + width + height + } + ... on DocumentRef { + _path + _publishUrl + } + } + scSocialMediaImageFr { + ... on ImageRef { + _path + _publishUrl + width + height + } + ... on DocumentRef { + _path + _publishUrl + } + } + scSocialMediaImageAltTextEn + scSocialMediaImageAltTextFr + scNoIndex + scNoFollow + scFragments { + ... on SclabsCompContentV1Model { + _model { + ... on ModelInfo { + title + } + } + scId + scLabContent { + ... on SclabsContentV1Model { + scContentEn { + json + } + scContentFr { + json + } + } + } + scLabLayout + } + ... on SclabsCompContentImageV1Model { + _model { + ... on ModelInfo { + title + } + } + scId + scLabContent { + scId + scContentEn { + json + } + scContentFr { + json + } + } + scLabImage { + ... on SclabsImageV1Model { + scId + scImageEn { + ... on ImageRef { + _publishUrl + width + height + } + ... on DocumentRef { + _publishUrl + } + } + scImageFr { + ... on ImageRef { + _publishUrl + width + height + } + ... on DocumentRef { + _publishUrl + } + } + scImageMobileEn { + ... on ImageRef { + _publishUrl + width + height + } + ... on DocumentRef { + _publishUrl + } + } + scImageMobileFr { + ... on ImageRef { + _publishUrl + width + height + } + ... on DocumentRef { + _publishUrl + } + } + scImageAltTextEn + scImageAltTextFr + scImageCaptionEn { + json + } + scImageCaptionFr { + json + } + } + } + scLabLayout + } + ... on SclabsContentV1Model { + _model { + ... on ModelInfo { + title + } + } + _path + scId + scContentEn { + json + } + scContentFr { + json + } + } + ... on SclabsImageV1Model { + _model { + ... on ModelInfo { + title + } + } + _path + scId + scImageEn { + ... on ImageRef { + _publishUrl + width + height + } + ... on DocumentRef { + _publishUrl + } + } + scImageFr { + ... on ImageRef { + _publishUrl + width + height + } + ... on DocumentRef { + _publishUrl + } + } + scImageMobileEn { + ... on ImageRef { + _publishUrl + width + height + } + ... on DocumentRef { + _publishUrl + } + } + scImageMobileFr { + ... on ImageRef { + _publishUrl + width + height + } + ... on DocumentRef { + _publishUrl + } + } + scImageAltTextEn + scImageAltTextFr + scImageCaptionEn { + json + } + scImageCaptionFr { + json + } + scLongDescHeadingEn + scLongDescHeadingFr + scLongDescEn { + json + } + scLongDescFr { + json + } + } + ... on SclabsButtonV1Model { + _model { + ... on ModelInfo { + title + } + } + scId + scTitleEn + scTitleFr + scDestinationURLEn + scDestinationURLFr + scButtonType + } + ... on SclabsFeatureV1Model { + _model { + ... on ModelInfo { + title + } + } + scId + scTitleEn + scTitleFr + scContentEn { + json + } + scContentFr { + json + } + scImageEn { + ... on ImageRef { + _publishUrl + width + height + } + ... on DocumentRef { + _publishUrl + } + } + scImageAltTextEn + scImageFr { + ... on ImageRef { + _publishUrl + width + height + } + ... on DocumentRef { + _publishUrl + } + } + scImageAltTextFr + scFragments { + ... on SclabsAlertV1Model { + _path + scId + scTitleEn + scTitleFr + scContentEn { + json + } + scContentFr { + json + } + scAlertType + } + } + scImageAltTextEn + scImageAltTextFr + scLabsButton { + scId + scTitleEn + scTitleFr + scDestinationURLEn + scDestinationURLFr + scButtonType + } + } + ... on TooltipV1Model { + _model { + ... on ModelInfo { + title + } + } + _path + scId + scTitleEn + scTitleFr + scContentEn { + json + } + scContentFr { + json + } + } + } + } + } +} diff --git a/graphql/queries/indigenousEiQuery.graphql b/graphql/queries/indigenousEiQuery.graphql new file mode 100644 index 0000000000..6d125b91c4 --- /dev/null +++ b/graphql/queries/indigenousEiQuery.graphql @@ -0,0 +1,519 @@ +query getIndigenousEiPage { + sclabsPageV1ByPath( + _path: "/content/dam/decd-endc/content-fragments/sclabs/pages/projects/ei-indigenous/overview" + ) { + item { + scId + scPageNameEn + scPageNameFr + scTitleEn + scTitleFr + scShortTitleEn + scShortTitleFr + scLabProjectStage + scLabProjectSummaryEn { + json + } + scLabProjectSummaryFr { + json + } + scDescriptionEn { + json + } + scDescriptionFr { + json + } + scLabProjectUpdates { + ... on SclabsPageV1Model { + _path + scId + scPageNameEn + scPageNameFr + scTitleEn + scTitleFr + scShortTitleEn + scShortTitleFr + scBreadcrumbParentPages { + ... on SclabsPageV1Model { + scTitleEn + scTitleFr + scPageNameEn + scPageNameFr + } + } + scSubject + scKeywordsEn + scKeywordsFr + scContentType + scOwner + scDateModifiedOverwrite + scAudience + scRegion + scSocialMediaImageEn { + ... on ImageRef { + _path + _publishUrl + width + height + } + ... on DocumentRef { + _path + _publishUrl + } + } + scSocialMediaImageFr { + ... on ImageRef { + _path + _publishUrl + width + height + } + ... on DocumentRef { + _path + _publishUrl + } + } + scSocialMediaImageAltTextEn + scSocialMediaImageAltTextFr + scNoIndex + scNoFollow + scFragments { + ... on SclabsContentV1Model { + _path + scId + scContentEn { + json + } + scContentFr { + json + } + } + ... on SclabsImageV1Model { + scId + scImageEn { + ... on ImageRef { + _publishUrl + width + height + } + ... on DocumentRef { + _publishUrl + } + } + scImageFr { + ... on ImageRef { + _publishUrl + width + height + } + ... on DocumentRef { + _publishUrl + } + } + scImageMobileEn { + ... on ImageRef { + _publishUrl + width + height + } + ... on DocumentRef { + _publishUrl + } + } + scImageMobileFr { + ... on ImageRef { + _publishUrl + width + height + } + ... on DocumentRef { + _publishUrl + } + } + scImageAltTextEn + scImageAltTextFr + scImageCaptionEn { + json + } + scImageCaptionFr { + json + } + } + ... on SclabsButtonV1Model { + scId + scTitleEn + scTitleFr + scDestinationURLEn + scDestinationURLFr + scButtonType + } + ... on SclabsFeatureV1Model { + scId + scTitleEn + scTitleFr + scContentEn { + json + } + scContentFr { + json + } + scImageEn { + ... on ImageRef { + _publishUrl + width + height + } + ... on DocumentRef { + _publishUrl + } + } + scImageFr { + ... on ImageRef { + _publishUrl + width + height + } + ... on DocumentRef { + _publishUrl + } + } + scFragments { + ... on SclabsAlertV1Model { + _path + scId + scTitleEn + scTitleFr + scContentEn { + json + } + scContentFr { + json + } + scAlertType + } + } + scImageAltTextEn + scImageAltTextFr + scLabsButton { + scId + scTitleEn + scTitleFr + scDestinationURLEn + scDestinationURLFr + scButtonType + } + } + ... on TooltipV1Model { + _path + scId + scTitleEn + scTitleFr + scContentEn { + json + } + scContentFr { + json + } + } + } + } + } + scBreadcrumbParentPages { + ... on SclabsPageV1Model { + scTitleEn + scTitleFr + scPageNameEn + scPageNameFr + } + } + scSubject + scKeywordsEn + scKeywordsFr + scContentType + scOwner + scDateModifiedOverwrite + scAudience + scRegion + scSocialMediaImageEn { + ... on ImageRef { + _path + _publishUrl + width + height + } + ... on DocumentRef { + _path + _publishUrl + } + } + scSocialMediaImageFr { + ... on ImageRef { + _path + _publishUrl + width + height + } + ... on DocumentRef { + _path + _publishUrl + } + } + scSocialMediaImageAltTextEn + scSocialMediaImageAltTextFr + scNoIndex + scNoFollow + scFragments { + ... on SclabsContentV1Model { + _model { + ... on ModelInfo { + title + } + } + _path + scId + scContentEn { + json + } + scContentFr { + json + } + scFragments { + ... on SclabsContentV1Model { + _model { + ... on ModelInfo { + title + } + } + _path + scId + scContentEn { + json + } + scContentFr { + json + } + scFragments { + ... on SclabsImageV1Model { + _model { + ... on ModelInfo { + title + } + } + scId + scImageEn { + ... on ImageRef { + _publishUrl + width + height + } + ... on DocumentRef { + _publishUrl + } + } + scImageFr { + ... on ImageRef { + _publishUrl + width + height + } + ... on DocumentRef { + _publishUrl + } + } + scImageMobileEn { + ... on ImageRef { + _publishUrl + width + height + } + ... on DocumentRef { + _publishUrl + } + } + scImageMobileFr { + ... on ImageRef { + _publishUrl + width + height + } + ... on DocumentRef { + _publishUrl + } + } + scImageAltTextEn + scImageAltTextFr + scImageCaptionEn { + json + } + scImageCaptionFr { + json + } + scLongDescHeadingEn + scLongDescHeadingFr + scLongDescEn { + json + } + scLongDescFr { + json + } + } + } + } + } + } + ... on SclabsImageV1Model { + _model { + ... on ModelInfo { + title + } + } + scId + scImageEn { + ... on ImageRef { + _publishUrl + width + height + } + ... on DocumentRef { + _publishUrl + } + } + scImageFr { + ... on ImageRef { + _publishUrl + width + height + } + ... on DocumentRef { + _publishUrl + } + } + scImageMobileEn { + ... on ImageRef { + _publishUrl + width + height + } + ... on DocumentRef { + _publishUrl + } + } + scImageMobileFr { + ... on ImageRef { + _publishUrl + width + height + } + ... on DocumentRef { + _publishUrl + } + } + scImageAltTextEn + scImageAltTextFr + scImageCaptionEn { + json + } + scImageCaptionFr { + json + } + } + ... on SclabsButtonV1Model { + _model { + ... on ModelInfo { + title + } + } + scId + scTitleEn + scTitleFr + scDestinationURLEn + scDestinationURLFr + scButtonType + } + ... on SclabsFeatureV1Model { + _model { + ... on ModelInfo { + title + } + } + scId + scTitleEn + scTitleFr + scContentEn { + json + } + scContentFr { + json + } + scImageEn { + ... on ImageRef { + _publishUrl + width + height + } + ... on DocumentRef { + _publishUrl + } + } + scImageFr { + ... on ImageRef { + _publishUrl + width + height + } + ... on DocumentRef { + _publishUrl + } + } + scFragments { + ... on SclabsAlertV1Model { + _model { + ... on ModelInfo { + title + } + } + _path + scId + scTitleEn + scTitleFr + scContentEn { + json + } + scContentFr { + json + } + scAlertType + } + } + scImageAltTextEn + scImageAltTextFr + scLabsButton { + scId + scTitleEn + scTitleFr + scDestinationURLEn + scDestinationURLFr + scButtonType + } + } + ... on TooltipV1Model { + _model { + ... on ModelInfo { + title + } + } + _path + scId + scTitleEn + scTitleFr + scContentEn { + json + } + scContentFr { + json + } + } + } + } + } +} diff --git a/next.config.js b/next.config.js index e99a510b49..846bc32573 100644 --- a/next.config.js +++ b/next.config.js @@ -57,6 +57,14 @@ const REWRITES = [ source: "/projets/chercheur-prestations/:slug", destination: "/projects/benefits-finder/:slug", }, + { + source: "/projets/transformer-assurance-emploi-peuples-autochtones", + destination: "/projects/transforming-ei-indigenous-peoples", + }, + { + source: "/projets/transformer-assurance-emploi-peuples-autochtones/:slug", + destination: "/projects/transforming-ei-indigenous-peoples/:slug", + }, { source: "/rsdc-demander", destination: "/cdcp-apply" diff --git a/pages/home.js b/pages/home.js index d1e5018a44..18fa788140 100644 --- a/pages/home.js +++ b/pages/home.js @@ -23,6 +23,7 @@ export default function Home(props) { const sortedProjects = (objects) => { // Order to sort the projects const sortOrder = [ + "Transforming EI with Indigenous peoples", "Benefits Finder", "Making it easier to get benefits", "Digital Standards Playbook", diff --git a/pages/projects/transforming-ei-indigenous-peoples/[id].js b/pages/projects/transforming-ei-indigenous-peoples/[id].js new file mode 100644 index 0000000000..6c21ebe694 --- /dev/null +++ b/pages/projects/transforming-ei-indigenous-peoples/[id].js @@ -0,0 +1,135 @@ +import PageHead from "../../../components/fragment_renderer/PageHead"; +import { serverSideTranslations } from "next-i18next/serverSideTranslations"; +import { Layout } from "../../../components/organisms/Layout"; +import { useEffect, useState } from "react"; +import aemServiceInstance from "../../../services/aemServiceInstance"; +import { getAllUpdateIds } from "../../../lib/utils/getAllUpdateIds"; +import { createBreadcrumbs } from "../../../lib/utils/createBreadcrumbs"; +import FragmentRender from "../../../components/fragment_renderer/FragmentRender"; +import { Heading } from "../../../components/molecules/Heading"; + +export default function IndigenousEiArticles(props) { + const [pageData] = useState(props.pageData); + const [dictionary] = useState(props.dictionary.items); + + useEffect(() => { + if (props.adobeAnalyticsUrl) { + window.adobeDataLayer = window.adobeDataLayer || []; + window.adobeDataLayer.push({ event: "pageLoad" }); + } + }, []); + + return ( + <> + + +
+
+ +
+

+ {props.locale === "en" + ? dictionary[13].scTermEn + : dictionary[13].scTermFr} +

+

+ {pageData.scDateModifiedOverwrite} +

+

+ {props.locale === "en" + ? dictionary[8].scTermEn + : dictionary[8].scTermFr} +

+

+ {pageData.scDateModifiedOverwrite} +

+
+
+ + {/* Main */} +
+ +
+
+
+ + ); +} + +export async function getStaticPaths() { + // Get pages data + const { data } = await aemServiceInstance.getFragment( + "indigenousEiArticlesQuery" + ); + // Get paths for dynamic routes from the page name data + const paths = getAllUpdateIds(data.sclabsPageV1List.items); + paths.map((path) => (path.params.id = path.params.id.split("/").at(-1))); + return { + paths, + fallback: "blocking", + }; +} + +export const getStaticProps = async ({ locale, params }) => { + // Get pages data + const { data } = await aemServiceInstance.getFragment( + "indigenousEiArticlesQuery" + ); + // get dictionary + const { data: dictionary } = await aemServiceInstance.getFragment( + "dictionaryQuery" + ); + const pages = data.sclabsPageV1List.items; + // Return page data that matches the current page being built + const pageData = pages.filter((page) => { + return ( + (locale === "en" ? page.scPageNameEn : page.scPageNameFr) + .split("/") + .at(-1) === params.id + ); + }); + + if (!pageData || !pageData.length) { + return { + notFound: true, + }; + } + + return { + props: { + locale: locale, + pageData: pageData[0], + dictionary: dictionary.dictionaryV1List, + adobeAnalyticsUrl: process.env.ADOBE_ANALYTICS_URL ?? null, + ...(await serverSideTranslations(locale, ["common", "vc"])), + }, + revalidate: process.env.ISR_ENABLED === "true" ? 10 : false, + }; +}; diff --git a/pages/projects/transforming-ei-indigenous-peoples/index.js b/pages/projects/transforming-ei-indigenous-peoples/index.js new file mode 100644 index 0000000000..7bab629cb9 --- /dev/null +++ b/pages/projects/transforming-ei-indigenous-peoples/index.js @@ -0,0 +1,390 @@ +import Head from "next/head"; +import { serverSideTranslations } from "next-i18next/serverSideTranslations"; +import { Layout } from "../../../components/organisms/Layout"; +import { useEffect, useState } from "react"; +import aemServiceInstance from "../../../services/aemServiceInstance"; +import { ProjectInfo } from "../../../components/atoms/ProjectInfo"; +import Card from "../../../components/molecules/Card"; +import { createBreadcrumbs } from "../../../lib/utils/createBreadcrumbs"; +import { Heading } from "../../../components/molecules/Heading"; +import Image from "next/image"; +import stageDictionary from "../../../lib/utils/stageDictionary"; +import { sortUpdatesByDate } from "../../../lib/utils/sortUpdatesByDate"; +import FragmentRender from "../../../components/fragment_renderer/FragmentRender"; +import TextRender from "../../../components/text_node_renderer/TextRender"; + +export default function EiIndigenousOverview(props) { + const [pageData] = useState(props.pageData.item); + const updatesData = sortUpdatesByDate(props.updatesData); + const [filteredDictionary] = useState( + props.dictionary.items.filter( + (item) => + item.scId === "STARTED" || + item.scId === "ENDED" || + item.scId === "PROJECT-STAGE" || + item.scId === "SUMMARY" + ) + ); + + const displayProjectUpdates = updatesData.map((update) => ( +
  • + +
  • + )); + + useEffect(() => { + if (props.adobeAnalyticsUrl) { + window.adobeDataLayer = window.adobeDataLayer || []; + window.adobeDataLayer.push({ event: "pageLoad" }); + } + }, []); + + return ( + <> + + + {/* Primary HTML Meta Tags */} + + {props.locale === "en" + ? `${pageData.scTitleEn} - Service Canada Labs` + : `${pageData.scTitleFr} - Laboratoires de Service Canada`} + + + + + + + + + {/* DCMI Meta Tags */} + + + + + + + + + + + + + {/* Open Graph / Facebook */} + + + + + + + + + {/* Twitter */} + + + + + + + + + +
    +
    +
    +
    + +
    +
    +
    +
    + { +
    +
    +
    +

    + {props.locale === "en" + ? pageData.scFragments[0].scContentEn.json[1].content[0].value + : pageData.scFragments[0].scContentFr.json[1].content[0] + .value} +

    +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    +
    + {updatesData.length === 0 ? null : ( +
    +

    + {props.locale === "en" + ? "Project updates" + : "Mises à jour du projet"} +

    +
      + {displayProjectUpdates} +
    +
    + )} +
    +
    + + ); +} + +export const getStaticProps = async ({ locale }) => { + // get page data from AEM + const { data: pageData } = await aemServiceInstance.getFragment( + "indigenousEiQuery" + ); + // get dictionary + const { data: dictionary } = await aemServiceInstance.getFragment( + "dictionaryQuery" + ); + + return { + props: { + locale: locale, + adobeAnalyticsUrl: process.env.ADOBE_ANALYTICS_URL ?? null, + pageData: pageData.sclabsPageV1ByPath, + updatesData: pageData.sclabsPageV1ByPath.item.scLabProjectUpdates, + dictionary: dictionary.dictionaryV1List, + ...(await serverSideTranslations(locale, ["common"])), + }, + revalidate: process.env.ISR_ENABLED === "true" ? 10 : false, + }; +};