From 747cd1beb3af7f89bfcb6e7334212f199f9a4f86 Mon Sep 17 00:00:00 2001 From: Joseph Andersen <12385932+jpandersen87@users.noreply.github.com> Date: Tue, 17 Dec 2024 17:52:25 -0600 Subject: [PATCH 01/19] Create Test Result Page (without "Download Results") Fixes #16074 - first pass --- frontend-react/src/AppRouter.tsx | 4 +- .../AddCustomTestMessageForm.tsx | 51 +++++++ .../Admin/MessageTesting/CustomMessage.tsx | 64 --------- .../Admin/MessageTesting/MessageTesting.tsx | 114 --------------- .../MessageTesting/MessageTestingBody.tsx | 19 +++ .../MessageTesting/MessageTestingForm.tsx | 56 ++++++++ .../MessageTesting/MessageTestingFormBase.tsx | 133 ++++++++++++++++++ .../MessageTestingResult.fixtures.ts | 45 ++++++ .../MessageTesting/MessageTestingResult.tsx | 107 ++++++++++++++ .../Admin/MessageTesting/RadioField.tsx | 57 -------- .../Admin/MessageTesting/TestMessageLabel.tsx | 22 +++ .../Admin/MessageTesting/language.json | 8 ++ .../src/config/endpoints/reports.ts | 35 +++++ .../src/config/endpoints/settings.ts | 18 --- .../{ => UseTestMessages}/UseTestMessages.ts | 10 +- .../AdminReportTestingPage.tsx | 50 +++++++ .../src/utils/OpenAsBlob/OpenAsBlob.test.ts | 31 ++++ .../src/utils/OpenAsBlob/OpenAsBlob.ts | 21 +++ 18 files changed, 585 insertions(+), 260 deletions(-) create mode 100644 frontend-react/src/components/Admin/MessageTesting/AddCustomTestMessageForm.tsx delete mode 100644 frontend-react/src/components/Admin/MessageTesting/CustomMessage.tsx delete mode 100644 frontend-react/src/components/Admin/MessageTesting/MessageTesting.tsx create mode 100644 frontend-react/src/components/Admin/MessageTesting/MessageTestingBody.tsx create mode 100644 frontend-react/src/components/Admin/MessageTesting/MessageTestingForm.tsx create mode 100644 frontend-react/src/components/Admin/MessageTesting/MessageTestingFormBase.tsx create mode 100644 frontend-react/src/components/Admin/MessageTesting/MessageTestingResult.fixtures.ts create mode 100644 frontend-react/src/components/Admin/MessageTesting/MessageTestingResult.tsx delete mode 100644 frontend-react/src/components/Admin/MessageTesting/RadioField.tsx create mode 100644 frontend-react/src/components/Admin/MessageTesting/TestMessageLabel.tsx create mode 100644 frontend-react/src/components/Admin/MessageTesting/language.json create mode 100644 frontend-react/src/config/endpoints/reports.ts rename frontend-react/src/hooks/api/messages/{ => UseTestMessages}/UseTestMessages.ts (81%) create mode 100644 frontend-react/src/pages/admin/AdminReportTestingPage/AdminReportTestingPage.tsx create mode 100644 frontend-react/src/utils/OpenAsBlob/OpenAsBlob.test.ts create mode 100644 frontend-react/src/utils/OpenAsBlob/OpenAsBlob.ts diff --git a/frontend-react/src/AppRouter.tsx b/frontend-react/src/AppRouter.tsx index b2c78dc8a94..73a8d0e1116 100644 --- a/frontend-react/src/AppRouter.tsx +++ b/frontend-react/src/AppRouter.tsx @@ -7,7 +7,7 @@ import { SenderType } from "./utils/DataDashboardUtils"; import { lazyRouteMarkdown } from "./utils/LazyRouteMarkdown"; import { PERMISSIONS } from "./utils/UsefulTypes"; -const ReportTestingPage = lazy(() => import("./components/Admin/MessageTesting/MessageTesting")); +const AdminReportTestingPage = lazy(() => import("./pages/admin/AdminReportTestingPage/AdminReportTestingPage")); /* Content Pages */ const Home = lazy(lazyRouteMarkdown(() => import("./content/home/index.mdx"))); const About = lazy(lazyRouteMarkdown(() => import("./content/about/index.mdx"))); @@ -440,7 +440,7 @@ export const appRoutes: RouteObject[] = [ }, { path: "orgreceiversettings/org/:orgname/receiver/:receivername/action/:action/message-testing", - element: , + element: , }, { path: "orgsendersettings/org/:orgname/sender/:sendername/action/:action", diff --git a/frontend-react/src/components/Admin/MessageTesting/AddCustomTestMessageForm.tsx b/frontend-react/src/components/Admin/MessageTesting/AddCustomTestMessageForm.tsx new file mode 100644 index 00000000000..dcca397171e --- /dev/null +++ b/frontend-react/src/components/Admin/MessageTesting/AddCustomTestMessageForm.tsx @@ -0,0 +1,51 @@ +import { Button, Textarea } from "@trussworks/react-uswds"; +import { type ComponentProps, type FormEventHandler, useCallback, useState } from "react"; + +export interface AddCustomMessageFormProps extends ComponentProps<"form"> { + onCancel: () => void; +} + +export interface AddCustomMessageFormValues { + customMessageTestBody: string; +} + +const AddCustomTestMessageFormProps = ({ onCancel, onChange, ...props }: AddCustomMessageFormProps) => { + const [isSubmitEnabled, setIsSubmitEnabled] = useState(false); + + const handleFormChange = useCallback>( + (e) => { + setIsSubmitEnabled(e.currentTarget.checkValidity()); + onChange?.(e); + }, + [onChange], + ); + + return ( +
+

Enter custom message

+

Custom messages do not save to the bank after you log out.

+