diff --git a/src/modules/AieraChat/index.tsx b/src/modules/AieraChat/index.tsx index 64b3e5ceb..41c54d24e 100644 --- a/src/modules/AieraChat/index.tsx +++ b/src/modules/AieraChat/index.tsx @@ -45,6 +45,19 @@ export function AieraChat(): ReactElement { setShowConfirm(false); }, []); + const onTranscriptAnimationEnd = useCallback(() => { + if (animateTranscriptExit) { + onSelectSource(undefined); + setTimeout(() => { + setAnimateTranscriptExit(false); + }); + } + }, [animateTranscriptExit, onSelectSource]); + + const onAnimateTranscriptExit = useCallback(() => { + setAnimateTranscriptExit(true); + }, []); + let darkMode = false; if (config.options) { @@ -60,19 +73,12 @@ export function AieraChat(): ReactElement { className={classNames('fixed inset-0 slideInFromRight z-[100]', { slideOutToRight: animateTranscriptExit, })} - onAnimationEnd={() => { - if (animateTranscriptExit) { - onSelectSource(undefined); - setTimeout(() => { - setAnimateTranscriptExit(false); - }); - } - }} + onAnimationEnd={onTranscriptAnimationEnd} > setAnimateTranscriptExit(true)} + onBack={onAnimateTranscriptExit} /> )}