diff --git a/packages/client/src/components/CheckoutBuilder/Config.tsx b/packages/client/src/components/CheckoutBuilder/Config.tsx index c55b4bc..3b1284d 100644 --- a/packages/client/src/components/CheckoutBuilder/Config.tsx +++ b/packages/client/src/components/CheckoutBuilder/Config.tsx @@ -8,7 +8,7 @@ export const Config = ({ configuration, descriptors, step, setActiveStep, action const handleUpdateConfig: UpdateConfig = (item, value, current): void => { let newConfig = { ...configuration }; - console.log('UPDATE CONFIG PARAMS', item, value, newConfig); + console.log('UPDATE CONFIG PARAMS', item, value, current, newConfig); if (value === null) { delete newConfig[item]; } else if (current) { diff --git a/packages/client/src/components/CheckoutBuilder/ConfigWrapper.tsx b/packages/client/src/components/CheckoutBuilder/ConfigWrapper.tsx index a0f0d97..f865b11 100644 --- a/packages/client/src/components/CheckoutBuilder/ConfigWrapper.tsx +++ b/packages/client/src/components/CheckoutBuilder/ConfigWrapper.tsx @@ -20,7 +20,7 @@ export const ConfigWrapper = () => { const dispatch = useAppDispatch(); - const updateStore = (value: any, action: any): void => { + const updateStore = (value: any, action: ActionCreatorWithPayload): void => { dispatch(action(value)); }; diff --git a/packages/client/src/components/CheckoutBuilder/configSteps/Option.tsx b/packages/client/src/components/CheckoutBuilder/configSteps/Option.tsx index 82aae0f..980253c 100644 --- a/packages/client/src/components/CheckoutBuilder/configSteps/Option.tsx +++ b/packages/client/src/components/CheckoutBuilder/configSteps/Option.tsx @@ -1,3 +1,4 @@ +import { ChangeEvent } from 'react'; import { Grid, Typography, TextField } from '@mui/material'; import { Descriptor, HandleInput } from '../types'; @@ -6,14 +7,24 @@ export interface OptionPropTypes { onChange: HandleInput; value: string; isChecked: boolean; + current?: string; } -export const Option = ({ descriptor, onChange, value, isChecked }: OptionPropTypes) => { +export const Option = ({ descriptor, onChange, value, isChecked, current }: OptionPropTypes) => { return ( {descriptor.name} {/* {descriptor.description} */} - {isChecked && } + {isChecked && ( + ) => onChange(e, current)} + id={descriptor.name} + label={descriptor.name} + value={value} + fullWidth + /> + )} ); }; diff --git a/packages/client/src/components/CheckoutBuilder/configSteps/OptionWrapper.tsx b/packages/client/src/components/CheckoutBuilder/configSteps/OptionWrapper.tsx index 79c9d2d..8b5a119 100644 --- a/packages/client/src/components/CheckoutBuilder/configSteps/OptionWrapper.tsx +++ b/packages/client/src/components/CheckoutBuilder/configSteps/OptionWrapper.tsx @@ -30,7 +30,7 @@ export const OptionWrapper = ({ descriptor, indexKey, value, addOrRemoveProp, ha return ( isChecked && ( - ) ); diff --git a/packages/client/src/components/CheckoutBuilder/configSteps/ProfileForm.tsx b/packages/client/src/components/CheckoutBuilder/configSteps/ProfileForm.tsx index 4a710c0..166f91a 100644 --- a/packages/client/src/components/CheckoutBuilder/configSteps/ProfileForm.tsx +++ b/packages/client/src/components/CheckoutBuilder/configSteps/ProfileForm.tsx @@ -2,6 +2,7 @@ import { Fragment, useState } from 'react'; import { FormControl, FormHelperText, Grid, InputLabel, MenuItem, Select, SelectChangeEvent, TextField, Typography } from '@mui/material'; import { NavButtons } from './NavButtons'; import type { OnDeckPropType } from '../../../app/types'; +import type { ActionCreatorWithPayload } from '@reduxjs/toolkit'; interface ProfileFormProps { configuration: OnDeckPropType; diff --git a/packages/client/src/components/CheckoutBuilder/types.ts b/packages/client/src/components/CheckoutBuilder/types.ts index aab2fce..702d30c 100644 --- a/packages/client/src/components/CheckoutBuilder/types.ts +++ b/packages/client/src/components/CheckoutBuilder/types.ts @@ -1,11 +1,12 @@ import { ChangeEvent } from 'react'; import type { Descriptor, OnDeckPropType } from '../../app/types'; +import type { ActionCreatorWithPayload } from '@reduxjs/toolkit'; export interface ConfigPropTypes { step: number; configuration: OnDeckPropType; descriptors: Descriptor[]; - action: any; + action: ActionCreatorWithPayload; updateStore: (value: any, action: any) => void; setActiveStep: (step: number) => void; }