From 50f3cf104f380ecb2a55464935c2ce7c159019da Mon Sep 17 00:00:00 2001 From: Elliot Nash Date: Mon, 9 Dec 2024 16:23:48 -0500 Subject: [PATCH] refactor: no anonymous fns --- src/modules/AieraChat/index.tsx | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) 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} /> )}