Our file input components (StateDrivenFileInput.tsx, ScanBatchPreview.tsx, and PetitionQcBatchScanPreview.tsx) can be improved. For instance: StateDrivenFileInput has multiple things happening on click, hard-codes what sequences to run on file change (rather than being agnostic), has overlap with ScanBatchPreview.tsx that we might be able exploit, etc.
PetitionQcBatchScanPreview.tsx has code for accepting files, but as far as I can tell (and after discussion with Chris H.), it doesn't seem like this should ever be allowed. It might be a copy-paste or refactoring artifact.
Goals:
StateDrivenFileInput and ScanBatchPreview are refactored so that they use the same file selector input if possible. (In other words, there is only one component with the accept='.pdf attribute.)
PetitionQcBatchScanPreview is refactored so that it does not have unnecessary code. Maybe we can get rid of this component altogether and have a readonly mode for ScanBatchPreview.
Unnecessary props are removed from the components.
The input component(s) that results after the above refactor can take in whatever sequence/function/etc. we want for onFileChange so that the component can be reused more easily and is less coupled to our state management library.
Pull the file validation logic into sequences/actions if deemed worth the effort.
Our file input components (
StateDrivenFileInput.tsx
,ScanBatchPreview.tsx
, andPetitionQcBatchScanPreview.tsx
) can be improved. For instance:StateDrivenFileInput
has multiple things happening on click, hard-codes what sequences to run on file change (rather than being agnostic), has overlap withScanBatchPreview.tsx
that we might be able exploit, etc.PetitionQcBatchScanPreview.tsx
has code for accepting files, but as far as I can tell (and after discussion with Chris H.), it doesn't seem like this should ever be allowed. It might be a copy-paste or refactoring artifact.Goals:
StateDrivenFileInput
andScanBatchPreview
are refactored so that they use the same file selector input if possible. (In other words, there is only one component with theaccept='.pdf
attribute.)PetitionQcBatchScanPreview
is refactored so that it does not have unnecessary code. Maybe we can get rid of this component altogether and have a readonly mode forScanBatchPreview
.onFileChange
so that the component can be reused more easily and is less coupled to our state management library.