From 4658876200b73856378c7db4c509843454ddb7e4 Mon Sep 17 00:00:00 2001 From: Kevin Haube Date: Mon, 6 Nov 2023 11:24:46 -0500 Subject: [PATCH] Save Point: building form --- .../BreadCrumb/bread-crumb-config.ts | 41 ++++++++----- .../actions/EnableRaiResponseWithdraw.tsx | 58 +++++++++++++++++-- 2 files changed, 80 insertions(+), 19 deletions(-) diff --git a/src/services/ui/src/components/BreadCrumb/bread-crumb-config.ts b/src/services/ui/src/components/BreadCrumb/bread-crumb-config.ts index a37635349d..6648502bca 100644 --- a/src/services/ui/src/components/BreadCrumb/bread-crumb-config.ts +++ b/src/services/ui/src/components/BreadCrumb/bread-crumb-config.ts @@ -1,4 +1,6 @@ import { ROUTES } from "@/routes"; +import { mapActionLabel } from "@/utils"; +import { Action } from "shared-types"; export type BreadCrumbConfig = { default?: boolean; @@ -75,16 +77,29 @@ export const BREAD_CRUMB_CONFIG_NEW_SUBMISSION: BreadCrumbConfig[] = [ export const BREAD_CRUMB_CONFIG_PACKAGE_DETAILS = (data: { id: string; -}): BreadCrumbConfig[] => [ - { - displayText: "Dashboard", - order: 1, - default: true, - to: ROUTES.DASHBOARD, - }, - { - displayText: `${data.id}`, - order: 2, - to: ROUTES.DETAILS, - }, -]; + action?: Action; +}): BreadCrumbConfig[] => { + const base = [ + { + displayText: "Dashboard", + order: 1, + default: true, + to: ROUTES.DASHBOARD, + }, + { + displayText: data.id, + order: 2, + to: `/details?id=${data.id}`, + }, + ]; + return !data.action + ? base + : [ + ...base, + { + displayText: mapActionLabel(data.action), + order: 3, + to: `/actions/${data.id}/${data.action}`, + }, + ]; +}; diff --git a/src/services/ui/src/pages/actions/EnableRaiResponseWithdraw.tsx b/src/services/ui/src/pages/actions/EnableRaiResponseWithdraw.tsx index ec6d2a1166..8da1ecdf04 100644 --- a/src/services/ui/src/pages/actions/EnableRaiResponseWithdraw.tsx +++ b/src/services/ui/src/pages/actions/EnableRaiResponseWithdraw.tsx @@ -1,15 +1,61 @@ -import { useParams } from "react-router-dom"; +import { Navigate, useParams } from "react-router-dom"; +import { SimplePageContainer } from "@/components"; +import { BreadCrumbs } from "@/components/BreadCrumb"; +import { BREAD_CRUMB_CONFIG_PACKAGE_DETAILS } from "@/components/BreadCrumb/bread-crumb-config"; +import { ROUTES } from "@/routes"; +import { Action } from "shared-types"; +import { Button } from "@/components/Inputs"; +import { useGetItem } from "@/api"; +import { removeUnderscoresAndCapitalize } from "@/utils"; export const EnableRaiResponseWithdraw = () => { const { id, type } = useParams<{ id: string; - type: string; + type: Action; }>(); + const { data, isLoading, error } = useGetItem(id!); - return ( -
- ID: {id} - Type: {type} + // Keeps aria stuff and classes condensed + const SectionTemplate = ({ + label, + value, + }: { + label: string; + value: string; + }) => ( +
+ + {value}
); + + return !id || !type ? ( + + ) : ( + + +

Enable RAI Response Withdraw

+

+ Once you submit this form, the most recent Formal RAI Response for this + package will be able to be withdrawn by the state.{" "} + If you leave this page, you will lose your progress on this form. +

+
+ + +
+ + +
+ ); };