diff options
author | Eugene <eug-vs@keemail.me> | 2020-01-12 15:11:05 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-12 15:11:05 +0000 |
commit | d131fe1c40da4faf8fe850994d000263f867c9d6 (patch) | |
tree | c4b8fb31a112ef3fe38b6f02a17d75d722ae3dea /src/components/TimerPage/TimerPage.js | |
parent | 23a5631531861ac76d532c0d9d2b19dd1862f739 (diff) | |
parent | 364c16c467b5257980337a06497647ebc13e4c35 (diff) | |
download | chrono-cube-ui-d131fe1c40da4faf8fe850994d000263f867c9d6.tar.gz |
Merge pull request #33 from Eug-VS/contribute
Contribute section support
Diffstat (limited to 'src/components/TimerPage/TimerPage.js')
-rw-r--r-- | src/components/TimerPage/TimerPage.js | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/src/components/TimerPage/TimerPage.js b/src/components/TimerPage/TimerPage.js deleted file mode 100644 index 22781bc..0000000 --- a/src/components/TimerPage/TimerPage.js +++ /dev/null @@ -1,76 +0,0 @@ -import React from 'react'; - -import { post } from '../../requests'; - -import Window from "../Window/Window"; -import ContentSection from "../ContentSection/ContentSection"; -import Timer from "./Timer/Timer"; -import SmartList from "../SmartList/SmartList"; -import SolutionCard from "../SolutionCard/SolutionCard"; - -import { Typography, makeStyles } from "@material-ui/core"; - - -const useStyles = makeStyles(theme => ({ - primary: { - padding: theme.spacing(4), - }, - cell: { - padding: theme.spacing(5), - }, -})); - -const TimerPage = ({ recentSolutions, setRecentSolutions }) => { - const classes = useStyles(); - - const user = { - id: null, - username: 'anonymous', - }; - - const registerResult = result => { - const solution = { author_id: user.id, result }; - post('solutions/', solution).then(response => { - setRecentSolutions([response.data].concat(recentSolutions)); - }); - }; - - const removeSolution = (id) => { - setRecentSolutions(recentSolutions.filter((solution => solution.id !== id))); - }; - - const renderItem = ({ index, style }) => { - const solution = recentSolutions[index]; - return ( - <div style={style} className={classes.cell}> - <SolutionCard data={solution} removeThisCard={removeSolution} /> - </div> - ); - }; - - return ( - <> - <Window type="primary"> - <div className={classes.primary}> - <ContentSection sectionName="Welcome to ChronoCube!"> - <Typography> - Here is some text about how cool this application is, why you should use it - and how to make it better! - </Typography> - </ContentSection> - <Timer registerResult={registerResult} /> - </div> - </Window> - <Window type="secondary" name="Recent solutions"> - <SmartList - itemSize={270} - itemCount={recentSolutions.length} - renderItem={renderItem} - /> - </Window> - </> - ); -}; - - -export default TimerPage; |