Skip to content

Commit

Permalink
refactor: no anonymous fns
Browse files Browse the repository at this point in the history
  • Loading branch information
getnashty committed Dec 9, 2024
1 parent c4f8333 commit 50f3cf1
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/modules/AieraChat/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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}
>
<Transcript
onBackHeader="Back"
eventId={selectedSource.targetId}
onBack={() => setAnimateTranscriptExit(true)}
onBack={onAnimateTranscriptExit}
/>
</div>
)}
Expand Down

0 comments on commit 50f3cf1

Please sign in to comment.