0e4e9bcf68
* fix: content offset When the appbar was changed to a `div` the content became offset, this fixes that. * style: make display of cheques table more readable * style: restyle sidebar * fix: content overflow * chore: split theme into separate file * feat: show ethereum transaction link for cashout * feat: make cashout link to etherscan transaction Co-authored-by: Vojtech Simetka <vojtech@simetka.cz>
54 lines
1.3 KiB
TypeScript
54 lines
1.3 KiB
TypeScript
import React, { useEffect, useState } from 'react';
|
|
import { BrowserRouter as Router } from 'react-router-dom';
|
|
import './App.css';
|
|
|
|
import { ThemeProvider } from '@material-ui/styles';
|
|
import CssBaseline from '@material-ui/core/CssBaseline';
|
|
|
|
import BaseRouter from './routes/routes';
|
|
import { lightTheme, darkTheme } from './theme';
|
|
|
|
declare global {
|
|
interface Window {
|
|
ethereum: {};
|
|
web3: {};
|
|
}
|
|
}
|
|
|
|
|
|
function App() {
|
|
const [themeMode, toggleThemeMode] = useState('light');
|
|
|
|
useEffect(() => {
|
|
let theme = localStorage.getItem('theme')
|
|
|
|
if (theme) {
|
|
toggleThemeMode(String(localStorage.getItem('theme')))
|
|
} else if (window?.matchMedia('(prefers-color-scheme: dark)')?.matches) {
|
|
toggleThemeMode('dark')
|
|
}
|
|
|
|
window?.matchMedia('(prefers-color-scheme: dark)')?.addEventListener('change', e => {
|
|
toggleThemeMode(e?.matches ? "dark" : "light")
|
|
});
|
|
|
|
return () => window?.matchMedia('(prefers-color-scheme: dark)')?.removeEventListener('change', e => {
|
|
toggleThemeMode(e?.matches ? "dark" : "light")
|
|
})
|
|
|
|
}, []);
|
|
|
|
return (
|
|
<div className="App">
|
|
<ThemeProvider theme={themeMode === 'light' ? lightTheme : darkTheme}>
|
|
<CssBaseline />
|
|
<Router>
|
|
<BaseRouter />
|
|
</Router>
|
|
</ThemeProvider>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default App;
|