import React, { useState, useEffect } from 'react' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faAngleDown, faAngleUp } from '@fortawesome/free-solid-svg-icons' import { SetVariableMappings, VariableMappings, Config, SetConfig } from '../types/types' import JsonBox from './JsonBox' // Types for SettingsPanel type SettingsPanelProps = { config: Config setConfig: SetConfig variableMappings: VariableMappings setVariableMappings: SetVariableMappings isValidJson: boolean setIsValidJson: (arg0: boolean) => void isValidRegex: boolean setIsValidRegex: (arg0: boolean) => void } const SettingsPanel = ({ config, setConfig, isValidJson, setIsValidJson, isValidRegex, setIsValidRegex, }: SettingsPanelProps) => { const [showConfig, setShowConfig] = useState(true) useEffect(() => { try { console.log('trying regex') new RegExp(config.generation_parameters.regex_string) setIsValidRegex(true) } catch (e) { setIsValidRegex(false) } }, [config.generation_parameters.regex_string]) return (