From 9b895b5081318cc6fb90237d1e68e3133f906048 Mon Sep 17 00:00:00 2001 From: Arunava Basu Date: Mon, 8 Aug 2022 22:32:21 +0530 Subject: [PATCH] fixied the bug and set the defult value of `useNonEqi` and `use_simulate_slit` to false --- frontend/src/components/CalcSpectrum.tsx | 28 ++++++++++++++---------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/frontend/src/components/CalcSpectrum.tsx b/frontend/src/components/CalcSpectrum.tsx index 61893d02..8b799f66 100644 --- a/frontend/src/components/CalcSpectrum.tsx +++ b/frontend/src/components/CalcSpectrum.tsx @@ -39,11 +39,11 @@ export const CalcSpectrum: React.FC = () => { ); const [isNonEquilibrium, setIsNonEquilibrium] = useState(false); const [useGesia, setUseGesia] = useState(false); - const [useSlit, setUseSlit] = useState(false); - const [useSimulateSlitFunction, setUseSimulateSlitFunction] = useState(false); + const [useSlit, setUseSlit] = useState(false); // checking that user wants to apply the slit function or not in available modes + const [useSimulateSlitFunction, setUseSimulateSlitFunction] = useState(false); // checking the mode and enable or disable slit feature const Schema = yup.object().shape({ useNonEqi: yup.boolean(), - useSlitSwitch: yup.boolean(), //bool + use_simulate_slit: yup.boolean(), path_length: yup .number() .required("Path length must be defined") @@ -136,7 +136,9 @@ export const CalcSpectrum: React.FC = () => { } setLoading(true); + console.log(data); setError(undefined); + setPlotData({ max_wavenumber_range: data.max_wavenumber_range, min_wavenumber_range: data.min_wavenumber_range, @@ -188,16 +190,18 @@ export const CalcSpectrum: React.FC = () => { const UseNonEquilibriumCalculations = () => ( ( + render={({ field }) => ( { - setIsNonEquilibrium(e.target.checked); - if (e.target.checked) { + onChange={(event, value) => { + setIsNonEquilibrium(event.target.checked); + field.onChange(value); + if (event.target.checked) { setValue("tvib", 300); setValue("trot", 300); } else { @@ -214,16 +218,18 @@ export const CalcSpectrum: React.FC = () => { const UseSimulateSlit = () => ( ( + render={({ field }) => ( { - setUseSlit(e.target.checked); - if (e.target.checked) { + onChange={(event, value) => { + setUseSlit(event.target.checked); + field.onChange(value); + if (event.target.checked) { setValue("simulate_slit", 5); } else { setValue("simulate_slit", undefined);