Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor file selection components #10486

Open
Mwindo opened this issue Sep 12, 2024 · 1 comment
Open

Refactor file selection components #10486

Mwindo opened this issue Sep 12, 2024 · 1 comment
Labels
3 (dx/ox) Medium Priority Devex/Opex Devex

Comments

@Mwindo
Copy link
Collaborator

Mwindo commented Sep 12, 2024

No description provided.

@Mwindo
Copy link
Collaborator Author

Mwindo commented Sep 12, 2024

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:

  1. 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.)
  2. 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.
  3. Unnecessary props are removed from the components.
  4. 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.
  5. Pull the file validation logic into sequences/actions if deemed worth the effort.

@Mwindo Mwindo added the Devex label Sep 12, 2024
@codyseibert codyseibert added the 3 (dx/ox) Medium Priority Devex/Opex label Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 (dx/ox) Medium Priority Devex/Opex Devex
Projects
Status: New Issues
Development

No branches or pull requests

2 participants