2023-02-07 09:41:54 -05:00
|
|
|
import React from 'react';
|
2023-02-22 21:30:48 -05:00
|
|
|
import Messages from './components/Main/Messages';
|
|
|
|
|
import Landing from './components/Main/Landing';
|
|
|
|
|
import TextChat from './components/Main/TextChat';
|
2023-02-06 13:27:28 -05:00
|
|
|
import Nav from './components/Nav';
|
2023-02-07 10:26:19 -05:00
|
|
|
import MobileNav from './components/Nav/MobileNav';
|
2023-02-13 18:02:29 -05:00
|
|
|
import useDocumentTitle from '~/hooks/useDocumentTitle';
|
2023-02-14 16:15:45 -05:00
|
|
|
import { useSelector } from 'react-redux';
|
2023-02-04 19:19:53 -05:00
|
|
|
|
|
|
|
|
const App = () => {
|
2023-02-07 16:22:35 -05:00
|
|
|
const { messages } = useSelector((state) => state.messages);
|
2023-02-13 18:02:29 -05:00
|
|
|
const { title } = useSelector((state) => state.convo);
|
|
|
|
|
useDocumentTitle(title);
|
2023-02-06 18:25:11 -05:00
|
|
|
|
2023-02-04 19:19:53 -05:00
|
|
|
return (
|
|
|
|
|
<div className="flex h-screen">
|
2023-02-13 10:20:21 -05:00
|
|
|
<Nav />
|
2023-02-06 13:27:28 -05:00
|
|
|
<div className="flex h-full w-full flex-1 flex-col bg-gray-50 md:pl-[260px]">
|
2023-02-08 22:58:24 -05:00
|
|
|
<div className="transition-width relative flex h-full w-full flex-1 flex-col items-stretch overflow-hidden dark:bg-gray-800">
|
2023-02-08 15:26:42 -05:00
|
|
|
<MobileNav />
|
2023-02-13 18:02:29 -05:00
|
|
|
{messages.length === 0 ? (
|
|
|
|
|
<Landing title={title} />
|
|
|
|
|
) : (
|
|
|
|
|
<Messages
|
|
|
|
|
messages={messages}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
<TextChat messages={messages} />
|
2023-02-08 09:15:47 -05:00
|
|
|
</div>
|
2023-02-04 19:19:53 -05:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default App;
|