2022-06-21 23:20:53 +00:00
|
|
|
import { useState, useEffect } from 'react';
|
2022-04-11 17:10:36 +00:00
|
|
|
import { useLocation } from 'react-router-dom';
|
2022-06-10 09:15:38 +00:00
|
|
|
import { ThemeContext, useThemeSwitcher } from '@vegaprotocol/react-helpers';
|
2022-06-21 23:20:53 +00:00
|
|
|
import { EnvironmentProvider, NetworkLoader } from '@vegaprotocol/environment';
|
2022-02-15 14:44:09 +00:00
|
|
|
import { createClient } from './lib/apollo-client';
|
|
|
|
import { Nav } from './components/nav';
|
|
|
|
import { Header } from './components/header';
|
|
|
|
import { Main } from './components/main';
|
|
|
|
import { TendermintWebsocketProvider } from './contexts/websocket/tendermint-websocket-provider';
|
|
|
|
|
|
|
|
function App() {
|
2022-03-29 12:13:25 +00:00
|
|
|
const [theme, toggleTheme] = useThemeSwitcher();
|
2022-04-01 14:20:23 +00:00
|
|
|
const [menuOpen, setMenuOpen] = useState(false);
|
2022-03-29 12:13:25 +00:00
|
|
|
|
2022-04-01 14:20:23 +00:00
|
|
|
const location = useLocation();
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
setMenuOpen(false);
|
|
|
|
}, [location]);
|
|
|
|
|
2022-02-15 14:44:09 +00:00
|
|
|
return (
|
2022-06-01 00:30:02 +00:00
|
|
|
<EnvironmentProvider>
|
|
|
|
<ThemeContext.Provider value={theme}>
|
|
|
|
<TendermintWebsocketProvider>
|
2022-06-21 23:20:53 +00:00
|
|
|
<NetworkLoader createClient={createClient}>
|
2022-06-01 00:30:02 +00:00
|
|
|
<div
|
|
|
|
className={`${
|
|
|
|
menuOpen && 'h-[100vh] overflow-hidden'
|
|
|
|
} antialiased m-0 bg-white dark:bg-black text-black dark:text-white`}
|
|
|
|
>
|
|
|
|
<div className="min-h-[100vh] max-w-[1300px] grid grid-rows-[repeat(2,_auto)_1fr] grid-cols-[1fr] md:grid-rows-[auto_minmax(700px,_1fr)] md:grid-cols-[300px_1fr] border-black dark:border-white lg:border-l-1 lg:border-r-1 mx-auto">
|
|
|
|
<Header
|
|
|
|
toggleTheme={toggleTheme}
|
|
|
|
menuOpen={menuOpen}
|
|
|
|
setMenuOpen={setMenuOpen}
|
|
|
|
/>
|
|
|
|
<Nav menuOpen={menuOpen} />
|
|
|
|
<Main />
|
|
|
|
</div>
|
2022-03-29 12:13:25 +00:00
|
|
|
</div>
|
2022-06-21 23:20:53 +00:00
|
|
|
</NetworkLoader>
|
2022-06-01 00:30:02 +00:00
|
|
|
</TendermintWebsocketProvider>
|
|
|
|
</ThemeContext.Provider>
|
|
|
|
</EnvironmentProvider>
|
2022-02-15 14:44:09 +00:00
|
|
|
);
|
2022-02-15 14:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default App;
|