Skip to content

Commit

Permalink
Move stage dictionary to a higher level (#982)
Browse files Browse the repository at this point in the history
* move analytics scripts to top-level _document.js

* moved stage dictionary into lib/utils
  • Loading branch information
will0684 authored Mar 5, 2024
1 parent 2faff55 commit 5d9296c
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 48 deletions.
2 changes: 1 addition & 1 deletion graphql/queries/dictionaryQuery.graphql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
query getAllProjects {
query getDictionary {
dictionaryV1List {
items {
_path
Expand Down
12 changes: 12 additions & 0 deletions lib/utils/stageDictionary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"en": {
"gc:custom/decd-endc/project-stage/alpha": "Alpha",
"gc:custom/decd-endc/project-stage/beta": "Beta",
"gc:custom/decd-endc/project-stage/discovery": "Discovery"
},
"fr": {
"gc:custom/decd-endc/project-stage/alpha": "Alpha",
"gc:custom/decd-endc/project-stage/beta": "Bêta",
"gc:custom/decd-endc/project-stage/discovery": "Découverte"
}
}
11 changes: 1 addition & 10 deletions pages/projects/benefits-navigator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Heading } from "../../../components/molecules/Heading";
import { Collapse } from "../../../components/molecules/Collapse";
import { generateCollapseElements } from "../../../lib/utils/generateCollapseElements";
import Image from "../../../node_modules/next/image";
import stageDictionary from "../../../lib/utils/stageDictionary";

export default function BenefitsNavigatorOverview(props) {
const [pageData] = useState(props.pageData.item);
Expand All @@ -23,16 +24,6 @@ export default function BenefitsNavigatorOverview(props) {
item.scId === "SUMMARY"
)
);
const stageDictionary = {
en: {
"gc:custom/decd-endc/project-stage/alpha": "Alpha",
"gc:custom/decd-endc/project-stage/beta": "Beta",
},
fr: {
"gc:custom/decd-endc/project-stage/alpha": "Alpha",
"gc:custom/decd-endc/project-stage/beta": "Bêta",
},
};

const displayProjectUpdates = updatesData.map((update) => (
<li key={update.scId} className="list-none ml-0 col-span-12 lg:col-span-4">
Expand Down
12 changes: 1 addition & 11 deletions pages/projects/dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Collapse } from "../../../components/molecules/Collapse";
import { generateCollapseElements } from "../../../lib/utils/generateCollapseElements";
import { ActionButton } from "../../../components/atoms/ActionButton";
import Image from "../../../node_modules/next/image";
import stageDictionary from "../../../lib/utils/stageDictionary";

export default function MscaDashboard(props) {
const pageData = props.pageData?.item;
Expand All @@ -22,17 +23,6 @@ export default function MscaDashboard(props) {
item.scId === "SUMMARY"
);

const stageDictionary = {
en: {
"gc:custom/decd-endc/project-stage/alpha": "Alpha",
"gc:custom/decd-endc/project-stage/beta": "Beta",
},
fr: {
"gc:custom/decd-endc/project-stage/alpha": "Alpha",
"gc:custom/decd-endc/project-stage/beta": "Bêta",
},
};

useEffect(() => {
if (props.adobeAnalyticsUrl) {
window.adobeDataLayer = window.adobeDataLayer || [];
Expand Down
7 changes: 3 additions & 4 deletions pages/projects/digital-standards-playbook/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { createBreadcrumbs } from "../../../lib/utils/createBreadcrumbs";
import { Heading } from "../../../components/molecules/Heading";
import { ActionButton } from "../../../components/atoms/ActionButton";
import Image from "../../../node_modules/next/image";
import stageDictionary from "../../../lib/utils/stageDictionary";

export default function DigitalStandardsPlaybookPage(props) {
const [pageData] = useState(props.pageData.item);
Expand Down Expand Up @@ -312,10 +313,8 @@ export default function DigitalStandardsPlaybookPage(props) {
}
stage={
props.locale === "en"
? pageData.scFragments[0].scContentEn.json[3].content[0]
.value
: pageData.scFragments[0].scContentFr.json[3].content[0]
.value
? stageDictionary.en[pageData.scLabProjectStage]
: stageDictionary.fr[pageData.scLabProjectStage]
}
summary={
props.locale === "en"
Expand Down
13 changes: 1 addition & 12 deletions pages/projects/making-easier-get-benefits/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { createBreadcrumbs } from "../../../lib/utils/createBreadcrumbs";
import { Heading } from "../../../components/molecules/Heading";
import TextRender from "../../../components/text_node_renderer/TextRender";
import Image from "../../../node_modules/next/image";
import stageDictionary from "../../../lib/utils/stageDictionary";

export default function IntegratedChannelStrategyPage(props) {
const [pageData] = useState(props.pageData.item);
Expand All @@ -23,18 +24,6 @@ export default function IntegratedChannelStrategyPage(props) {
item.scId === "SUMMARY"
)
);
const stageDictionary = {
en: {
"gc:custom/decd-endc/project-stage/alpha": "Alpha",
"gc:custom/decd-endc/project-stage/beta": "Beta",
"gc:custom/decd-endc/project-stage/discovery": "Discovery",
},
fr: {
"gc:custom/decd-endc/project-stage/alpha": "Alpha",
"gc:custom/decd-endc/project-stage/beta": "Bêta",
"gc:custom/decd-endc/project-stage/discovery": "Découverte",
},
};

const displayProjectUpdates = updatesData.map((update) => (
<li key={update.scId} className="list-none ml-0 col-span-12 lg:col-span-4">
Expand Down
11 changes: 1 addition & 10 deletions pages/projects/oas-benefits-estimator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Card from "../../../components/molecules/Card";
import { createBreadcrumbs } from "../../../lib/utils/createBreadcrumbs";
import { Heading } from "../../../components/molecules/Heading";
import Image from "../../../node_modules/next/image";
import stageDictionary from "../../../lib/utils/stageDictionary";

export default function OasBenefitsEstimator(props) {
const [pageData] = useState(props.pageData.item);
Expand All @@ -22,16 +23,6 @@ export default function OasBenefitsEstimator(props) {
item.scId === "SUMMARY"
)
);
const stageDictionary = {
en: {
"gc:custom/decd-endc/project-stage/alpha": "Alpha",
"gc:custom/decd-endc/project-stage/beta": "Beta",
},
fr: {
"gc:custom/decd-endc/project-stage/alpha": "Alpha",
"gc:custom/decd-endc/project-stage/beta": "Bêta",
},
};

const displayProjectUpdates = updatesData.map((update) => (
<li key={update.scId} className="list-none ml-0 col-span-12 lg:col-span-4">
Expand Down

0 comments on commit 5d9296c

Please sign in to comment.