2023-03-05 16:56:26 +01:00
|
|
|
import React, { useEffect, useRef } from 'react';
|
2023-03-03 23:17:11 +01:00
|
|
|
import useStore from '@store/store';
|
|
|
|
|
|
|
|
import Chat from './components/Chat';
|
|
|
|
import Menu from './components/Menu';
|
|
|
|
|
2023-03-04 01:29:12 +01:00
|
|
|
import useInitialiseNewChat from '@hooks/useInitialiseNewChat';
|
2023-03-03 23:17:11 +01:00
|
|
|
|
2023-03-03 06:25:10 +01:00
|
|
|
function App() {
|
2023-03-04 01:29:12 +01:00
|
|
|
const initialiseNewChat = useInitialiseNewChat();
|
2023-03-03 23:17:11 +01:00
|
|
|
|
|
|
|
useEffect(() => {
|
2023-03-05 16:56:26 +01:00
|
|
|
const chats = useStore.getState().chats;
|
|
|
|
if (!chats || chats.length === 0) {
|
2023-03-04 01:02:49 +01:00
|
|
|
initialiseNewChat();
|
2023-03-03 23:17:11 +01:00
|
|
|
}
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className='overflow-hidden w-full h-full relative'>
|
|
|
|
<Menu />
|
|
|
|
<Chat />
|
|
|
|
</div>
|
|
|
|
);
|
2023-03-03 06:25:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export default App;
|