-
-
Save Daltonic/8501785cc58f5091491dcb8ef876f2c3 to your computer and use it in GitHub Desktop.
DappBnb Project Chats view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect } from 'react' | |
import { Route, Routes } from 'react-router-dom' | |
import Card from './components/Card' | |
import Footer from './components/Footer' | |
import Header from './components/Header' | |
import Home from './views/Home' | |
import Room from './views/Room' | |
import AddRoom from './views/AddRoom' | |
import { isWallectConnected, loadAppartments } from './Blockchain.services' | |
import UpdateRoom from './views/UpdateRoom' | |
import { ToastContainer } from 'react-toastify' | |
import 'react-toastify/dist/ReactToastify.css' | |
import Bookings from './views/Bookings' | |
import Chats from './views/Chats' | |
import RecentConversations from './views/RecentConversations' | |
import { setGlobalState, useGlobalState } from './store' | |
import { isUserLoggedIn } from './services/Chat' | |
import AuthModal from './components/AuthModal' | |
const App = () => { | |
const [connectedAccount] = useGlobalState('connectedAccount') | |
useEffect(async () => { | |
await isWallectConnected() | |
await loadAppartments() | |
await isUserLoggedIn().then((user) => setGlobalState('currentUser', user)) | |
}, [connectedAccount]) | |
return ( | |
<div className="relative h-screen min-w-screen"> | |
<Header /> | |
<Routes> | |
<Route path="/" element={<Home />} /> | |
<Route path="/room/:id" element={<Room />} /> | |
<Route path="/card" element={<Card />} /> | |
<Route path="/addRoom" element={<AddRoom />} /> | |
<Route path="/editRoom/:id" element={<UpdateRoom />} /> | |
<Route path="/bookings/:id" element={<Bookings />} /> | |
<Route path="/chats/:id" element={<Chats />} /> | |
<Route path="/recentconversations" element={<RecentConversations />} /> | |
</Routes> | |
<div className="h-20"></div> | |
<Footer /> | |
<AuthModal /> | |
<ToastContainer | |
position="bottom-center" | |
autoClose={5000} | |
hideProgressBar={false} | |
newestOnTop={false} | |
closeOnClick | |
rtl={false} | |
pauseOnFocusLoss | |
draggable | |
pauseOnHover | |
theme="dark" | |
/> | |
</div> | |
) | |
} | |
export default App |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment