Skip to content

Commit

Permalink
fix(RV-436): Adjust cta to only have one for screens (#448)
Browse files Browse the repository at this point in the history
  • Loading branch information
knguyenrise8 authored Dec 3, 2024
1 parent 68d5be6 commit 67c8d9e
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 36 deletions.
14 changes: 2 additions & 12 deletions frontend/e2e/ReviewTemplate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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("/");
});
});
2 changes: 1 addition & 1 deletion frontend/src/components/ExtractDataHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import "./ExtractDataHeader.scss";

interface ExtractDataHeaderProps {
onBack: () => void;
onSubmit: () => void;
onExit: () => void;
isUploadComplete: boolean;
onSubmit?: () => void;
hasSubmit?: boolean;
}

Expand Down
12 changes: 8 additions & 4 deletions frontend/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface UploadHeaderProps {
title: string;
isUpload?: boolean;
onBack: () => void;
onSubmit: () => void;
onSubmit?: () => void;
}

export const UploadHeader = ({
Expand Down Expand Up @@ -41,9 +41,13 @@ export const UploadHeader = ({
>
Back
</Button>
<Button disabled={isUpload} onClick={onSubmit} type="submit" base>
Submit
</Button>
{
onSubmit && (
<Button disabled={isUpload} onClick={onSubmit} type="submit" base>
Submit
</Button>
)
}
</div>
</div>
</Header>
Expand Down
15 changes: 6 additions & 9 deletions frontend/src/components/ReviewBulk.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ const ReviewBulk = ({
);
};

const handleCSVDownload = () => {
onDownload();
navigate("/");
}

return (
<div className="display-flex flex-column flex-justify-start width-full height-full padding-1 padding-top-2">
<ExtractDataHeader
Expand Down Expand Up @@ -107,7 +112,7 @@ const ReviewBulk = ({
0
}
type="button"
onClick={() => onDownload()}
onClick={handleCSVDownload}
>
<Icon.FileDownload className="csv-icon" />
Download CSV
Expand Down Expand Up @@ -143,14 +148,6 @@ const ReviewBulk = ({
>
Cancel
</Button>
<Button
className="extract-button-submit"
onClick={() => navigate("/")}
type="submit"
disabled={resultsTable.some((row) => row.errors > 0)}
>
Done
</Button>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/ExtractUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const ExtractUpload = () => {
navigate("/");
clearFiles();
}}
onSubmit={() => navigate("/extract/process")}
hasSubmit={false}
isUploadComplete={isUploadComplete}
/>
<Divider margin="0px" />
Expand Down
1 change: 0 additions & 1 deletion frontend/src/pages/UploadTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export const UploadTemplate = () => {
onBack={() => {
navigate("/");
}}
onSubmit={() => navigate("/new-template/annotate")}
isUpload={files.length === 0}
/>
<Divider margin="0px" />
Expand Down
8 changes: 0 additions & 8 deletions frontend/src/pages/__snapshots__/UploadTemplate.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@ exports[`UploadTemplate component > matches the snapshot 1`] = `
>
Back
</button>
<button
class="usa-button usa-button--base"
data-testid="button"
disabled=""
type="submit"
>
Submit
</button>
</div>
</div>
</header>
Expand Down

0 comments on commit 67c8d9e

Please sign in to comment.