@@ -11,6 +11,8 @@ import { updateSeriesTheme } from "../../../../slices/seriesDetailsSlice";
1111import WizardNavigationButtons from "../../../shared/wizard/WizardNavigationButtons" ;
1212import ModalContentTable from "../../../shared/modals/ModalContentTable" ;
1313
14+ type SeriesTheme = { id : string ; value : string ; } ;
15+
1416/**
1517 * This component renders the tab for editing the theme of a certain series
1618 */
@@ -19,23 +21,20 @@ const SeriesDetailsThemeTab = ({
1921 themeNames,
2022 seriesId,
2123} : {
22- theme : string ,
23- themeNames : {
24- id : string ;
25- value : string ;
26- } [ ] ,
24+ theme : SeriesTheme | null ,
25+ themeNames : SeriesTheme [ ] ,
2726 seriesId : string
2827} ) => {
2928 const { t } = useTranslation ( ) ;
3029 const dispatch = useAppDispatch ( ) ;
3130
3231 const user = useAppSelector ( state => getUserInformation ( state ) ) ;
3332
34- const handleSubmit = ( values : { theme : string } ) => {
33+ const handleSubmit = ( values : { theme : SeriesTheme | null } ) => {
3534 dispatch ( updateSeriesTheme ( { id : seriesId , values : values } ) ) ;
3635 } ;
3736
38- const checkValidity = ( formik : FormikProps < { theme : string } > ) => {
37+ const checkValidity = ( formik : FormikProps < { theme : SeriesTheme | null } > ) => {
3938 if ( formik . dirty && formik . isValid ) {
4039 // check if user provided values differ from initial ones
4140 return ! _ . isEqual ( formik . values , formik . initialValues ) ;
@@ -64,13 +63,13 @@ const SeriesDetailsThemeTab = ({
6463 { themeNames . length > 0 && (
6564 < div className = "editable" >
6665 < DropDown
67- value = { formik . values . theme }
68- text = { formik . values . theme }
66+ value = { formik . values . theme ?. id }
67+ text = { formik . values . theme ?. value || '' }
6968 options = { themeNames . map ( names => ( { label : names . value , value : names . id } ) ) }
7069 required = { false }
7170 handleChange = { ( element ) => {
7271 if ( element ) {
73- formik . setFieldValue ( "theme" , element . value )
72+ formik . setFieldValue ( "theme" , { id : element . value , value : element . label } )
7473 }
7574 } }
7675 placeholder = { t ( "EVENTS.SERIES.NEW.THEME.LABEL" ) }
0 commit comments