2023-02-07 09:41:54 -05:00
|
|
|
import React from 'react';
|
|
|
|
|
import { useSelector } from 'react-redux';
|
2023-02-05 19:41:24 -05:00
|
|
|
import Messages from './components/Messages';
|
2023-02-04 20:48:33 -05:00
|
|
|
import TextChat from './components/TextChat';
|
2023-02-06 13:27:28 -05:00
|
|
|
import Nav from './components/Nav';
|
|
|
|
|
import MobileNav from './components/MobileNav';
|
2023-02-06 16:00:59 -05:00
|
|
|
import useSWR from 'swr';
|
|
|
|
|
|
|
|
|
|
const fetcher = (url) => fetch(url).then((res) => res.json());
|
2023-02-07 09:41:54 -05:00
|
|
|
// const postRequest = async (url, { arg }) => await axios.post(url, { arg });
|
2023-02-04 19:19:53 -05:00
|
|
|
|
|
|
|
|
const App = () => {
|
2023-02-07 00:05:00 -05:00
|
|
|
const messages = useSelector((state) => state.messages);
|
2023-02-06 16:00:59 -05:00
|
|
|
const { data, error, isLoading, mutate } = useSWR('http://localhost:3050/convos', fetcher);
|
2023-02-06 18:25:11 -05:00
|
|
|
|
2023-02-04 19:19:53 -05:00
|
|
|
return (
|
|
|
|
|
<div className="flex h-screen">
|
2023-02-06 13:27:28 -05:00
|
|
|
{/* <div className="w-80 bg-slate-800"></div> */}
|
2023-02-07 09:41:54 -05:00
|
|
|
<Nav conversations={data} />
|
2023-02-06 13:27:28 -05:00
|
|
|
{/* <div className="flex h-full flex-1 flex-col md:pl-[260px]"> */}
|
|
|
|
|
<div className="flex h-full w-full flex-1 flex-col bg-gray-50 md:pl-[260px]">
|
|
|
|
|
{/* <main className="relative h-full w-full transition-width flex flex-col overflow-hidden items-stretch flex-1"> */}
|
2023-02-06 15:17:54 -05:00
|
|
|
<MobileNav />
|
2023-02-05 19:41:24 -05:00
|
|
|
<Messages messages={messages} />
|
2023-02-07 09:41:54 -05:00
|
|
|
<TextChat messages={messages} reloadConvos={mutate} />
|
2023-02-06 13:27:28 -05:00
|
|
|
{/* </main> */}
|
2023-02-04 19:19:53 -05:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default App;
|