diff --git a/app/components/chat/ChatComponent/Chat.client.tsx b/app/components/chat/ChatComponent/Chat.client.tsx index d52e6613..a228dc36 100644 --- a/app/components/chat/ChatComponent/Chat.client.tsx +++ b/app/components/chat/ChatComponent/Chat.client.tsx @@ -2,17 +2,11 @@ * @ts-nocheck * Preventing TS checks with files presented in the video for a better presentation. */ -import { cssTransition, ToastContainer } from 'react-toastify'; import { useChatHistory } from '~/lib/persistence'; import { renderLogger } from '~/utils/logger'; import ChatImplementer from './components/ChatImplementer/ChatImplementer'; import flushSimulationData from './functions/flushSimulation'; -const toastAnimation = cssTransition({ - enter: 'animated fadeInRight', - exit: 'animated fadeOutRight', -}); - setInterval(async () => { flushSimulationData(); }, 1000); @@ -31,30 +25,6 @@ export function Chat() { storeMessageHistory={storeMessageHistory} /> )} - { - return ( - - ); - }} - icon={({ type }) => { - switch (type) { - case 'success': { - return
; - } - case 'error': { - return
; - } - } - - return undefined; - }} - position="bottom-right" - pauseOnFocusLoss - transition={toastAnimation} - /> ); } diff --git a/app/root.tsx b/app/root.tsx index f2f1f0c9..a4fa82bf 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -11,7 +11,7 @@ import { useEffect, useState } from 'react'; import { logStore } from './lib/stores/logs'; import { initializeAuth, userStore, isLoadingStore } from './lib/stores/auth'; import { initializeUserStores } from './lib/stores/user'; -import { ToastContainer, toast } from 'react-toastify'; +import { ToastContainer, toast, cssTransition } from 'react-toastify'; import { Analytics } from '@vercel/analytics/remix'; import { AuthModal } from './components/auth/AuthModal'; @@ -65,6 +65,11 @@ export const loader: LoaderFunction = async () => { }); }; +const toastAnimation = cssTransition({ + enter: 'animated fadeInRight', + exit: 'animated fadeOutRight', +}); + const inlineThemeCode = stripIndents` setTutorialKitTheme(); @@ -172,7 +177,31 @@ export default function App() {
{isLoading ?
: }
- + { + return ( + + ); + }} + icon={({ type }) => { + switch (type) { + case 'success': { + return
; + } + case 'error': { + return
; + } + } + + return undefined; + }} + position="bottom-right" + theme={theme} + pauseOnFocusLoss + transition={toastAnimation} + />