From 9512433adc8e61646d6387a82fa81cdeaf2f3cab Mon Sep 17 00:00:00 2001 From: Rohit Date: Wed, 25 Jun 2025 12:57:15 +0530 Subject: [PATCH] feat: add on preview complete --- src/components/run/InterpretationButtons.tsx | 27 ++++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/components/run/InterpretationButtons.tsx b/src/components/run/InterpretationButtons.tsx index a6ebb1bb..fd60c4eb 100644 --- a/src/components/run/InterpretationButtons.tsx +++ b/src/components/run/InterpretationButtons.tsx @@ -10,6 +10,7 @@ import { useTranslation } from "react-i18next"; interface InterpretationButtonsProps { enableStepping: (isPaused: boolean) => void; + onPreviewComplete?: () => void; } interface InterpretationInfo { @@ -22,7 +23,7 @@ const interpretationInfo: InterpretationInfo = { isPaused: false, }; -export const InterpretationButtons = ({ enableStepping }: InterpretationButtonsProps) => { +export const InterpretationButtons = ({ enableStepping, onPreviewComplete }: InterpretationButtonsProps) => { const { t } = useTranslation(); const [info, setInfo] = useState(interpretationInfo); const [decisionModal, setDecisionModal] = useState<{ @@ -102,16 +103,20 @@ export const InterpretationButtons = ({ enableStepping }: InterpretationButtonsP }, [socket, finishedHandler, breakpointHitHandler]); const handlePlay = async () => { - if (!info.running) { - setInfo({ ...info, running: true }); - const finished = await interpretCurrentRecording(); - setInfo({ ...info, running: false }); - if (finished) { - notify('info', t('interpretation_buttons.messages.run_finished')); - } else { - notify('error', t('interpretation_buttons.messages.run_failed')); - } - } + onPreviewComplete?.(); + notify('info', t('interpretation_buttons.messages.run_finished')); + + // Legacy code for running the interpretation + + // if (!info.running) { + // setInfo({ ...info, running: true }); + // // const finished = await interpretCurrentRecording(); + // setInfo({ ...info, running: false }); + // if (finished) { + // } else { + // notify('error', t('interpretation_buttons.messages.run_failed')); + // } + // } }; // pause and stop logic (do not delete - we wil bring this back!)