refactors some of the SpreadsheetInput state out of the Formik form state and into its own context, addressing an issue where the component state was being written to the project.json file because the whole Formik state was included
I put headerMap and requiredFieldsSet (and their respective useStateset functions) into a new context because EventImport needed to access some stuff from inside the SpreadsheetInput component while ProjectForm did not. This makes it simpler for parent forms to read/manage SpreadsheetInput's state without having to pass tons of props.
adds a toggle button that replaces the existing field config table with a preview of the data based on the current field mapping
when the preview is enabled, the Import button's label changes to Undo, and clicking it returns to the config view where the user can make changes
the Import button is disabled until all required fields are selected
Summary
SpreadsheetInput
state out of the Formik form state and into its own context, addressing an issue where the component state was being written to theproject.json
file because the whole Formik state was includedheaderMap
andrequiredFieldsSet
(and their respectiveuseState
set
functions) into a new context becauseEventImport
needed to access some stuff from inside theSpreadsheetInput
component whileProjectForm
did not. This makes it simpler for parent forms to read/manageSpreadsheetInput
's state without having to pass tons of props.Screenshot
Config view
Preview view
(this scrolls horizontally on overflow)