-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: adding typescript config to admin portal (#988)
* fix: draft commit for typescript changes * fix: lint fixes * fix: more test fixes * fix: adding more lint fixes * fix: PR requests * fix: small logic change
- Loading branch information
Showing
68 changed files
with
13,599 additions
and
8,225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,42 @@ | ||
import React, { useReducer } from "react"; | ||
// @ts-ignore | ||
import FormContextProvider from "./FormContext.tsx"; | ||
import type { FormFields } from "./FormContext"; | ||
// @ts-ignore | ||
import FormWorkflow from "./FormWorkflow.tsx"; | ||
import type { FormWorkflowProps } from "./FormWorkflow"; | ||
// @ts-ignore | ||
import {FormReducer, initializeForm } from "./data/reducer.ts"; | ||
import type { FormActionArguments } from "./data/actions"; | ||
import React, { useReducer } from 'react'; | ||
import FormContextProvider from './FormContext'; | ||
import FormWorkflow, { FormWorkflowProps } from './FormWorkflow'; | ||
import { | ||
FormReducer, FormReducerType, initializeForm, InitializeFormArguments, | ||
} from './data/reducer'; | ||
|
||
// Context wrapper for multi-step form container | ||
function FormContextWrapper<FormData>({ | ||
type FormWrapperProps<FormConfigData> = FormWorkflowProps<FormConfigData> & { formData: FormConfigData }; | ||
|
||
const FormContextWrapper = <FormConfigData extends unknown>({ | ||
formWorkflowConfig, | ||
onClickOut, | ||
onSubmit, | ||
formData, | ||
isStepperOpen, | ||
}: FormWorkflowProps<FormData>) { | ||
}: FormWrapperProps<FormConfigData>) => { | ||
const initializeAction: InitializeFormArguments<FormConfigData> = { | ||
formFields: formData as FormConfigData, | ||
currentStep: formWorkflowConfig.getCurrentStep(), | ||
}; | ||
const [formFieldsState, dispatch] = useReducer< | ||
FormReducer, | ||
FormActionArguments | ||
FormReducerType, | ||
InitializeFormArguments<FormConfigData> | ||
>( | ||
FormReducer, | ||
initializeForm( | ||
{}, | ||
{ | ||
formFields: formData as FormFields, | ||
currentStep: formWorkflowConfig.getCurrentStep(), | ||
} | ||
), | ||
initializeForm | ||
initializeAction, | ||
initializeForm, | ||
); | ||
return ( | ||
<FormContextProvider | ||
dispatch={dispatch} | ||
formContext={formFieldsState || {}} | ||
> | ||
<FormWorkflow | ||
{...{ formWorkflowConfig, onClickOut, onSubmit, isStepperOpen, dispatch }} | ||
{...{ | ||
formWorkflowConfig, onClickOut, isStepperOpen, dispatch, | ||
}} | ||
/> | ||
</FormContextProvider> | ||
); | ||
} | ||
}; | ||
|
||
export default FormContextWrapper; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.