From 692cdcee610f809c3e9b1cf5c1c996b571729aa1 Mon Sep 17 00:00:00 2001
From: Doug Schrashun
Date: Mon, 7 Oct 2024 11:25:44 -0400
Subject: [PATCH 1/6] readability refactors
---
.../[locale]/process/ProcessMilestones.tsx | 49 ++++++++++---------
frontend/src/i18n/messages/en/index.ts | 2 +-
2 files changed, 27 insertions(+), 24 deletions(-)
diff --git a/frontend/src/app/[locale]/process/ProcessMilestones.tsx b/frontend/src/app/[locale]/process/ProcessMilestones.tsx
index 71f970428..f1c70e8ec 100644
--- a/frontend/src/app/[locale]/process/ProcessMilestones.tsx
+++ b/frontend/src/app/[locale]/process/ProcessMilestones.tsx
@@ -17,10 +17,13 @@ import ContentLayout from "src/components/ContentLayout";
import { USWDSIcon } from "src/components/USWDSIcon";
const ProcessMilestones = () => {
- const t = useTranslations("Process");
+ const t = useTranslations("Process.milestones");
- const messages = useMessages() as unknown as IntlMessages;
- const keys = Object.keys(messages.Process.milestones.icon_list);
+ const {
+ Process: {
+ milestones: { high_level_roadmap_items },
+ },
+ } = useMessages() as unknown as IntlMessages;
const getIcon = (iconIndex: number) => {
switch (iconIndex) {
@@ -38,15 +41,15 @@ const ProcessMilestones = () => {
return (
<>
- {keys.map((key, index) => {
- const title = t(`milestones.icon_list.${key}.title`);
- const content = t.rich(`milestones.icon_list.${key}.content`, {
+ {high_level_roadmap_items.map((_unusedItem, index) => {
+ const title = t(`high_level_roadmap_items.${index}.title`);
+ const content = t.rich(`high_level_roadmap_items.${index}.content`, {
p: (chunks) => (
{chunks}
@@ -69,7 +72,7 @@ const ProcessMilestones = () => {
{
// Don't show the chevron in the last row item.
- index < keys.length - 1 ? (
+ index < high_level_roadmap_items.length - 1 ? (
{
title={
<>
- {t("milestones.roadmap_1")}
+ {t("roadmap_1")}
- {t("milestones.title_1")}
+ {t("title_1")}
- {t("milestones.name_1")}
+ {t("name_1")}
>
}
data-testid="process-methodology-content"
@@ -104,24 +107,24 @@ const ProcessMilestones = () => {
bottomBorder="none"
>
- {t("milestones.paragraph_1")}
+ {t("paragraph_1")}
- {t("milestones.sub_title_1")}
+ {t("sub_title_1")}
- {t("milestones.sub_paragraph_1")}
+ {t("sub_paragraph_1")}
- {t("milestones.sub_title_2")}
+ {t("sub_title_2")}
- {t("milestones.sub_paragraph_2")}
+ {t("sub_paragraph_2")}
- {t("milestones.cta_1")}
+ {t("cta_1")}
{
title={
<>
- {t("milestones.roadmap_2")}
+ {t("roadmap_2")}
- {t("milestones.title_2")}
+ {t("title_2")}
- {t("milestones.name_2")}
+ {t("name_2")}
>
}
data-testid="process-methodology-content"
@@ -150,17 +153,17 @@ const ProcessMilestones = () => {
bottomBorder="none"
>
- {t("milestones.paragraph_2")}
+ {t("paragraph_2")}
- {t("milestones.sub_title_3")}
+ {t("sub_title_3")}
- {t("milestones.cta_2")}
+ {t("cta_2")}
Date: Mon, 7 Oct 2024 11:55:54 -0400
Subject: [PATCH 2/6] fix list layout
---
.../[locale]/process/ProcessMilestones.tsx | 83 ++++++++++---------
1 file changed, 44 insertions(+), 39 deletions(-)
diff --git a/frontend/src/app/[locale]/process/ProcessMilestones.tsx b/frontend/src/app/[locale]/process/ProcessMilestones.tsx
index f1c70e8ec..558c670ef 100644
--- a/frontend/src/app/[locale]/process/ProcessMilestones.tsx
+++ b/frontend/src/app/[locale]/process/ProcessMilestones.tsx
@@ -47,46 +47,51 @@ const ProcessMilestones = () => {
bottomBorder="dark"
gridGap={6}
>
- {high_level_roadmap_items.map((_unusedItem, index) => {
- const title = t(`high_level_roadmap_items.${index}.title`);
- const content = t.rich(`high_level_roadmap_items.${index}.content`, {
- p: (chunks) => (
-
- {chunks}
-
- ),
- italics: (chunks) => {chunks} ,
- });
+
+
+ {high_level_roadmap_items.map((_unusedItem, index) => {
+ const title = t(`high_level_roadmap_items.${index}.title`);
+ const content = t.rich(
+ `high_level_roadmap_items.${index}.content`,
+ {
+ p: (chunks) => (
+
+ {chunks}
+
+ ),
+ italics: (chunks) => {chunks} ,
+ },
+ );
- return (
-
-
-
- {getIcon(index)}
-
-
- {title}
-
-
- {content}
-
- {
- // Don't show the chevron in the last row item.
- index < high_level_roadmap_items.length - 1 ? (
-
- ) : (
- ""
- )
- }
-
-
-
-
- );
- })}
+ return (
+
+
+ {getIcon(index)}
+
+
+ {title}
+
+
+ {content}
+
+ {
+ // Don't show the chevron in the last row item.
+ index < high_level_roadmap_items.length - 1 ? (
+
+ ) : (
+ ""
+ )
+ }
+
+
+
+ );
+ })}
+
+
Date: Mon, 7 Oct 2024 15:09:11 -0400
Subject: [PATCH 3/6] fix aria label
---
.../src/app/[locale]/process/ProcessMilestones.tsx | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/frontend/src/app/[locale]/process/ProcessMilestones.tsx b/frontend/src/app/[locale]/process/ProcessMilestones.tsx
index 558c670ef..bd570b451 100644
--- a/frontend/src/app/[locale]/process/ProcessMilestones.tsx
+++ b/frontend/src/app/[locale]/process/ProcessMilestones.tsx
@@ -10,7 +10,6 @@ import {
IconListContent,
IconListIcon,
IconListItem,
- IconListTitle,
} from "@trussworks/react-uswds";
import ContentLayout from "src/components/ContentLayout";
@@ -64,14 +63,17 @@ const ProcessMilestones = () => {
);
return (
-
+
{getIcon(index)}
-
-
+
+
{title}
-
-
+
+
{content}
{
From dce57f5f63935644c827612cb5b948a178f4a6f6 Mon Sep 17 00:00:00 2001
From: Doug Schrashun
Date: Mon, 7 Oct 2024 16:09:01 -0400
Subject: [PATCH 4/6] fix tests
---
.../[locale]/process/ProcessMilestones.tsx | 91 +++++++++----------
frontend/tests/utils/intlMocks.ts | 2 +-
2 files changed, 46 insertions(+), 47 deletions(-)
diff --git a/frontend/src/app/[locale]/process/ProcessMilestones.tsx b/frontend/src/app/[locale]/process/ProcessMilestones.tsx
index bd570b451..7e9b6c1ab 100644
--- a/frontend/src/app/[locale]/process/ProcessMilestones.tsx
+++ b/frontend/src/app/[locale]/process/ProcessMilestones.tsx
@@ -46,53 +46,52 @@ const ProcessMilestones = () => {
bottomBorder="dark"
gridGap={6}
>
-
-
- {high_level_roadmap_items.map((_unusedItem, index) => {
- const title = t(`high_level_roadmap_items.${index}.title`);
- const content = t.rich(
- `high_level_roadmap_items.${index}.content`,
- {
- p: (chunks) => (
-
- {chunks}
-
- ),
- italics: (chunks) => {chunks} ,
- },
- );
+
+ {high_level_roadmap_items.map((_unusedItem, index) => {
+ const title = t(`high_level_roadmap_items.${index}.title`);
+ const content = t.rich(
+ `high_level_roadmap_items.${index}.content`,
+ {
+ p: (chunks) => (
+
+ {chunks}
+
+ ),
+ italics: (chunks) => {chunks} ,
+ },
+ );
- return (
-
-
- {getIcon(index)}
-
-
- {title}
-
-
- {content}
-
- {
- // Don't show the chevron in the last row item.
- index < high_level_roadmap_items.length - 1 ? (
-
- ) : (
- ""
- )
- }
-
-
-
- );
- })}
-
+ return (
+
+ {getIcon(index)}
+
+
+ {title}
+
+
+ {content}
+
+ {
+ // Don't show the chevron in the last row item.
+ index < high_level_roadmap_items.length - 1 ? (
+
+ ) : (
+ ""
+ )
+ }
+
+
+ );
+ })}
Date: Thu, 10 Oct 2024 11:02:38 -0400
Subject: [PATCH 5/6] remove need for useMessages
---
.../app/[locale]/process/ProcessMilestones.tsx | 16 ++++++----------
frontend/src/i18n/messages/en/index.ts | 10 +++++-----
2 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/frontend/src/app/[locale]/process/ProcessMilestones.tsx b/frontend/src/app/[locale]/process/ProcessMilestones.tsx
index 7e9b6c1ab..07458e6ce 100644
--- a/frontend/src/app/[locale]/process/ProcessMilestones.tsx
+++ b/frontend/src/app/[locale]/process/ProcessMilestones.tsx
@@ -15,15 +15,11 @@ import {
import ContentLayout from "src/components/ContentLayout";
import { USWDSIcon } from "src/components/USWDSIcon";
+const highLevelRoadmapItems = ["find", "advanced_reporting", "apply"] as const;
+
const ProcessMilestones = () => {
const t = useTranslations("Process.milestones");
- const {
- Process: {
- milestones: { high_level_roadmap_items },
- },
- } = useMessages() as unknown as IntlMessages;
-
const getIcon = (iconIndex: number) => {
switch (iconIndex) {
case 0:
@@ -47,10 +43,10 @@ const ProcessMilestones = () => {
gridGap={6}
>
- {high_level_roadmap_items.map((_unusedItem, index) => {
- const title = t(`high_level_roadmap_items.${index}.title`);
+ {highLevelRoadmapItems.map((itemKey, index) => {
+ const title = t(`high_level_roadmap_items.${itemKey}.title`);
const content = t.rich(
- `high_level_roadmap_items.${index}.content`,
+ `high_level_roadmap_items.${itemKey}.content`,
{
p: (chunks) => (
@@ -79,7 +75,7 @@ const ProcessMilestones = () => {
{
// Don't show the chevron in the last row item.
- index < high_level_roadmap_items.length - 1 ? (
+ index < highLevelRoadmapItems.length - 1 ? (
Improve how applicants discover funding opportunities that they’re qualified for and that meet their needs.
",
},
- {
+ advanced_reporting: {
title: "Advanced reporting",
content:
"Improve stakeholders’ capacity to understand, analyze, and assess grants from application to acceptance.
Make non-confidential Grants.gov data open for public analysis.
",
},
- {
+ apply: {
title: "Apply",
content:
"Streamline the application process to make it easier for all applicants to apply for funding opportunities.
",
},
- ],
+ },
roadmap_1: "Find",
title_1: "Milestone 1",
name_1:
From 02bb96ebd9659cc3219ff595f489e34b9669ec27 Mon Sep 17 00:00:00 2001
From: Doug Schrashun
Date: Tue, 15 Oct 2024 11:24:16 -0400
Subject: [PATCH 6/6] fix linter
---
frontend/src/app/[locale]/process/ProcessMilestones.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/frontend/src/app/[locale]/process/ProcessMilestones.tsx b/frontend/src/app/[locale]/process/ProcessMilestones.tsx
index 07458e6ce..d93fc8036 100644
--- a/frontend/src/app/[locale]/process/ProcessMilestones.tsx
+++ b/frontend/src/app/[locale]/process/ProcessMilestones.tsx
@@ -1,6 +1,6 @@
import { ExternalRoutes } from "src/constants/routes";
-import { useMessages, useTranslations } from "next-intl";
+import { useTranslations } from "next-intl";
import Link from "next/link";
import React from "react";
import {