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")}