Skip to content

8821: refactor file selection components#9525

Open
paulo-filho-ctr wants to merge 46 commits intostagingfrom
8821-refactor-file-selection-components
Open

8821: refactor file selection components#9525
paulo-filho-ctr wants to merge 46 commits intostagingfrom
8821-refactor-file-selection-components

Conversation

@paulo-filho-ctr
Copy link
Contributor

@paulo-filho-ctr paulo-filho-ctr commented Dec 15, 2025

Summary

  • FileInput.tsx - Decoupled file input component that accepts onFileChange and onError callbacks
  • ScanBatchFileInput.tsx - Cerebral wrapper for scan batch previewer upload mode
  • Extracted components from ScanBatchPreviewer: ScanPreviewSection, ScanModeRadios, ScanPdfPreview, ScanBatchesTable, ScanDocumentTabs, ScannerAreaHeader, ScanUploadMode
  • StateDrivenFileInput.tsx - Now uses FileInput internally, acts as Cerebral wrapper
  • ScanBatchPreviewer.tsx - Extracted render functions into separate components, added scanOnly prop and petition-specific PDF removal logic

@paulo-filho-ctr paulo-filho-ctr force-pushed the 8821-refactor-file-selection-components branch from 2522b64 to 778d775 Compare December 16, 2025 21:05
@paulo-filho-ctr paulo-filho-ctr force-pushed the 8821-refactor-file-selection-components branch 2 times, most recently from 81bf9d9 to dba9112 Compare January 12, 2026 18:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the scan/upload file selection flow by extracting ScanBatchPreviewer UI sections into dedicated components, introducing a reusable FileInput, and adding new validation plumbing and end-to-end coverage around scanning/uploading behavior (including Petition QC).

Changes:

  • Extracts ScanBatchPreviewer UI into smaller components (header, mode radios, PDF preview, scan preview, batches table, document tabs, upload mode wrapper).
  • Introduces a decoupled FileInput component and updates StateDrivenFileInput (and scan-batch upload) to use it.
  • Adds a validateFileSequence/actions + unit tests, plus new Cypress coverage for file upload and scan batch previewer flows.

Reviewed changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
web-client/src/views/StartCaseInternal/StartCaseInternal.tsx Removes noValidate from a non-form container.
web-client/src/views/ScanBatchPreviewer/ScannerAreaHeader.tsx New extracted header component for scanner area.
web-client/src/views/ScanBatchPreviewer/ScanUploadMode.tsx New extracted upload-mode radio (with scanOnly gating).
web-client/src/views/ScanBatchPreviewer/ScanPreviewSection.tsx New extracted scan image preview + paging + “Create PDF” control.
web-client/src/views/ScanBatchPreviewer/ScanPdfPreview.tsx New extracted PDF preview + remove/replace modal wiring.
web-client/src/views/ScanBatchPreviewer/ScanModeRadios.tsx New extracted scan/upload mode selector + “Start Scan” button.
web-client/src/views/ScanBatchPreviewer/ScanDocumentTabs.tsx New extracted tabs component for selecting document context.
web-client/src/views/ScanBatchPreviewer/ScanBatchesTable.tsx New extracted scanned-batches table component.
web-client/src/views/ScanBatchPreviewer/ScanBatchModals.tsx Refactors rescan/delete modals to derive batch index from state + null-guards.
web-client/src/views/ScanBatchPreviewer/ScanBatchFileInput.tsx New Cerebral wrapper around FileInput for scan-batch upload mode.
web-client/src/views/ScanBatchPreviewer.tsx Refactors ScanBatchPreviewer to use extracted components and simplifies render logic.
web-client/src/views/PreviewControls.tsx Exports PreviewControlsProps and refactors connect deps typing.
web-client/src/views/PetitionQcScanBatchPreviewer.tsx Updates petition QC previewer to reuse extracted scan/upload components and new gating logic.
web-client/src/views/PetitionQc/PetitionQcDocumentPreview.tsx Adds guard for missing selected document and passes scanOnly prop.
web-client/src/views/PetitionQc/PetitionQc.tsx Adds data-testid to Petition QC page heading.
web-client/src/views/FileDocument/StateDrivenFileInput.tsx Converts to use new FileInput internally and makes validation sequence optional.
web-client/src/views/FileDocument/FileInput.tsx Adds new reusable FileInput with internal validation + optional external-validation mode.
web-client/src/views/ConfirmReplacePetitionModal.tsx Refactors to typed deps using cerebralProps and exports connected component.
web-client/src/views/ConfirmDeletePdfModal.tsx Adds configurable cancelLabel with a default.
web-client/src/ustc-ui/Tabs/Tabs.tsx Extends Tab to accept data-testid and forwards it to the rendered <button>.
web-client/src/presenter/sequences/validateFileSequence.ts New sequence to validate a file and open error modal on invalid.
web-client/src/presenter/sequences/validateFileSequence.test.ts Unit tests for new validate-file sequence behavior.
web-client/src/presenter/presenter.ts Registers validateFileSequence in presenter sequences.
web-client/src/presenter/computeds/scanBatchPreviewerHelper.ts Adds pdfPreviewUrl to helper output.
web-client/src/presenter/computeds/petitionQcHelper.ts Adds selectedTabHasAttachment (and related mapping logic).
web-client/src/presenter/computeds/petitionQcHelper.test.ts Adds extensive tests for selectedTabHasAttachment.
web-client/src/presenter/actions/validateFileAction.ts New action that wraps validateFile and routes valid/invalid paths.
web-client/src/presenter/actions/validateFileAction.test.ts Unit tests for validateFileAction.
web-client/src/presenter/actions/getDocumentSelectedForPreviewAction.ts Adds lookup by docketEntryId for documentSelectedForPreview.
web-client/src/presenter/actions/fileUploadErrorAction.ts New action to prepare file-upload error modal props (incl. troubleshooting link).
cypress/local-only/tests/integration/scanBatchPreviewer/scan-batch-previewer.cy.ts Adds scan-batch previewer Cypress coverage for mode toggling + upload + error modal.
cypress/local-only/tests/integration/petitionQc/petition-qc-scan-batch-previewer.cy.ts Adds Petition QC scan-batch previewer Cypress coverage.
cypress/local-only/tests/integration/fileUpload/state-driven-file-input.cy.ts Adds Cypress coverage ensuring StateDrivenFileInput flows through new FileInput.
cypress/local-only/tests/integration/fileUpload/file-input.cy.ts Adds Cypress coverage for FileInput validation scenarios and change behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@paulo-filho-ctr paulo-filho-ctr force-pushed the 8821-refactor-file-selection-components branch from cf862f8 to e2a84f3 Compare February 11, 2026 16:46
<CaseDetailHeader />
<section className="usa-section grid-container DocumentDetail">
<h2 className="heading-1">Petition</h2>
<h2 className="heading-1" data-testid="petition-qc-page-heading">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New elements should be using tailwind

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, using tailwind now.

return (
<>
<h5 className="header-scanned-batches">Scanned batches</h5>
<div className="batches-table-wrapper" ref={batchWrapperRef}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see here that you've created new components and opted to use the .scss files. I see why because you're trying to mimic the old stylings to keep everything uniform. I'm wondering now if this kind of situation where youre trying to mimic a complex styling for a table should be exempt from that..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I'm reluctant with this change is that I can test the change before sending out to test. The scan mode, is an interface that only Microsoft devices physically inside the Court has access.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, I implemented the changes in the scanner sections, Tenille tested and so far looks great! Thank you for the heads up on that one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants