diff options
author | eug-vs <eugene@eug-vs.xyz> | 2022-05-04 12:52:25 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2022-05-04 12:52:25 +0300 |
commit | f35c1cf5480f7506442ac4c9170c5e0a1a4a8b15 (patch) | |
tree | 94fa0fa38e8a90df08933c05910bea6bed461291 /src/index.tsx | |
parent | 8dc803f882f31430abb600fba250fdcf3334d9bf (diff) | |
download | chrono-cube-ui-f35c1cf5480f7506442ac4c9170c5e0a1a4a8b15.tar.gz |
feat: remove material UI and useless functionality
Diffstat (limited to 'src/index.tsx')
-rw-r--r-- | src/index.tsx | 83 |
1 files changed, 3 insertions, 80 deletions
diff --git a/src/index.tsx b/src/index.tsx index 360ca89..2b8d92d 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,87 +1,10 @@ -import React, { useState, useEffect } from 'react'; +import React from 'react'; import ReactDOM from 'react-dom'; -import { - BenzinThemeProvider, - Header, -} from 'react-benzin'; -import { User, Solution } from './types'; - -import 'typeface-roboto'; - -import Timer from './pages/Timer/Timer'; -import Scoreboard from './pages/Scoreboard/Scoreboard'; -import Contribute from './pages/Contribute/Contribute'; -import Profile from './pages/Profile/Profile'; - -import TimerIcon from '@material-ui/icons/Timer'; -import AccountCircleIcon from '@material-ui/icons/AccountCircle'; -import AssignmentIcon from '@material-ui/icons/Assignment'; -import GitHubIcon from '@material-ui/icons/GitHub'; - -import { get } from './requests'; - +import Timer from './components/Timer'; const App: React.FC = () => { - const [page, setPage] = useState<string>('app'); - const [user, setUser] = useState<User>({ username: 'anonymous', id: null }); - const [recentSolutions, setRecentSolutions] = useState<Solution[]>([]); - - const headerContents = { - app: (<TimerIcon />), - profile: (<AccountCircleIcon />), - scoreboard: (<AssignmentIcon />), - contribute: (<GitHubIcon />), - }; - - useEffect(() => { - const userId = localStorage.getItem('userId'); - if (userId) { - get('users/').then(response => { - setUser(response.data.filter((user: User) => user.id === +userId)[0]); - }); - } - }, []); - - const Page: React.FC<{ page: string }> = ({ page }) => { - switch (page) { - case 'app': - return ( - <Timer - user={user} - recentSolutions={recentSolutions} - setRecentSolutions={setRecentSolutions} - setPage={setPage} - /> - ); - - case 'profile': - return <Profile user={user} setUser={setUser} />; - - case 'scoreboard': - return <Scoreboard />; - - case 'contribute': - return <Contribute />; - - default: - return <Contribute />; - } - }; - - return ( - <BenzinThemeProvider> - <Header - logo={{ - title: 'ChronoCube', - icon: null - }} - contents={headerContents} - page={page} - setPage={setPage}/> - <Page page={page} /> - </BenzinThemeProvider> - ); + return (<Timer />); }; document.body.style.overflow = 'hidden'; |