From 67c8d9eb8678b1072f6bc97b92c90c622cfb46dc Mon Sep 17 00:00:00 2001 From: knguyenrise8 <159168836+knguyenrise8@users.noreply.github.com> Date: Tue, 3 Dec 2024 17:04:07 -0600 Subject: [PATCH] fix(RV-436): Adjust cta to only have one for screens (#448) --- frontend/e2e/ReviewTemplate.spec.ts | 14 ++------------ frontend/src/components/ExtractDataHeader.tsx | 2 +- frontend/src/components/Header.tsx | 12 ++++++++---- frontend/src/components/ReviewBulk.tsx | 15 ++++++--------- frontend/src/pages/ExtractUpload.tsx | 2 +- frontend/src/pages/UploadTemplate.tsx | 1 - .../__snapshots__/UploadTemplate.test.tsx.snap | 8 -------- 7 files changed, 18 insertions(+), 36 deletions(-) diff --git a/frontend/e2e/ReviewTemplate.spec.ts b/frontend/e2e/ReviewTemplate.spec.ts index edf8aa9d..c8360403 100644 --- a/frontend/e2e/ReviewTemplate.spec.ts +++ b/frontend/e2e/ReviewTemplate.spec.ts @@ -15,17 +15,6 @@ test.describe("ReviewTemplate Page", () => { await expect(page).toHaveURL("/extract/upload"); }); - // Test the Done button functionality - test("Done button navigates correctly", async ({ page }) => { - const submitButton = page.getByRole("button", { name: "Done" }); - await expect(submitButton).toBeDisabled(); - const errorRows = await page.locator("tr *[data-testid='edit-fix-error']"); - for (const row of await errorRows.elementHandles()) { - await row.click(); - await page.keyboard.press("Enter"); - } - }); - // Test the extracted data section test("Displays extracted data with overall confidence score", async ({ page, @@ -120,10 +109,11 @@ test.describe("ReviewTemplate Page", () => { await page.keyboard.press("Enter"); } + const finalSubmitButton = page.getByRole("button", { name: "Download CSV" }); await expect(submitButton).toBeEnabled(); await submitButton.click(); - await submitButton.click(); + await finalSubmitButton.click(); await expect(page).toHaveURL("/"); }); }); diff --git a/frontend/src/components/ExtractDataHeader.tsx b/frontend/src/components/ExtractDataHeader.tsx index 8f9c2147..db453244 100644 --- a/frontend/src/components/ExtractDataHeader.tsx +++ b/frontend/src/components/ExtractDataHeader.tsx @@ -5,9 +5,9 @@ import "./ExtractDataHeader.scss"; interface ExtractDataHeaderProps { onBack: () => void; - onSubmit: () => void; onExit: () => void; isUploadComplete: boolean; + onSubmit?: () => void; hasSubmit?: boolean; } diff --git a/frontend/src/components/Header.tsx b/frontend/src/components/Header.tsx index d99dbf77..7c4ea1bf 100644 --- a/frontend/src/components/Header.tsx +++ b/frontend/src/components/Header.tsx @@ -7,7 +7,7 @@ interface UploadHeaderProps { title: string; isUpload?: boolean; onBack: () => void; - onSubmit: () => void; + onSubmit?: () => void; } export const UploadHeader = ({ @@ -41,9 +41,13 @@ export const UploadHeader = ({ > Back - + { + onSubmit && ( + + ) + } diff --git a/frontend/src/components/ReviewBulk.tsx b/frontend/src/components/ReviewBulk.tsx index 2125664b..813db2af 100644 --- a/frontend/src/components/ReviewBulk.tsx +++ b/frontend/src/components/ReviewBulk.tsx @@ -76,6 +76,11 @@ const ReviewBulk = ({ ); }; + const handleCSVDownload = () => { + onDownload(); + navigate("/"); + } + return (
onDownload()} + onClick={handleCSVDownload} > Download CSV @@ -143,14 +148,6 @@ const ReviewBulk = ({ > Cancel -
diff --git a/frontend/src/pages/ExtractUpload.tsx b/frontend/src/pages/ExtractUpload.tsx index 4a53bed2..4acd73f6 100644 --- a/frontend/src/pages/ExtractUpload.tsx +++ b/frontend/src/pages/ExtractUpload.tsx @@ -41,7 +41,7 @@ const ExtractUpload = () => { navigate("/"); clearFiles(); }} - onSubmit={() => navigate("/extract/process")} + hasSubmit={false} isUploadComplete={isUploadComplete} /> diff --git a/frontend/src/pages/UploadTemplate.tsx b/frontend/src/pages/UploadTemplate.tsx index 9884ccdf..f09ecb7d 100644 --- a/frontend/src/pages/UploadTemplate.tsx +++ b/frontend/src/pages/UploadTemplate.tsx @@ -25,7 +25,6 @@ export const UploadTemplate = () => { onBack={() => { navigate("/"); }} - onSubmit={() => navigate("/new-template/annotate")} isUpload={files.length === 0} /> diff --git a/frontend/src/pages/__snapshots__/UploadTemplate.test.tsx.snap b/frontend/src/pages/__snapshots__/UploadTemplate.test.tsx.snap index 7586af7b..ae36bf1f 100644 --- a/frontend/src/pages/__snapshots__/UploadTemplate.test.tsx.snap +++ b/frontend/src/pages/__snapshots__/UploadTemplate.test.tsx.snap @@ -49,14 +49,6 @@ exports[`UploadTemplate component > matches the snapshot 1`] = ` > Back -