diff options
author | Eugene <eug-vs@keemail.me> | 2020-01-12 15:18:00 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-12 15:18:00 +0000 |
commit | 8b163ac33a8bb7fc77f934d20ab8454758abf0d7 (patch) | |
tree | a3edf615afdc83d364d58b84065017fae7fb5e98 /src/pages/Timer/Timer.js | |
parent | d131fe1c40da4faf8fe850994d000263f867c9d6 (diff) | |
parent | fff9eae8022e1e3bb88884a47bfd4153b089f444 (diff) | |
download | chrono-cube-ui-8b163ac33a8bb7fc77f934d20ab8454758abf0d7.tar.gz |
Merge pull request #35 from Eug-VS/profile-window
Markup Profile page
Diffstat (limited to 'src/pages/Timer/Timer.js')
-rw-r--r-- | src/pages/Timer/Timer.js | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/pages/Timer/Timer.js b/src/pages/Timer/Timer.js index d63c661..a41c47b 100644 --- a/src/pages/Timer/Timer.js +++ b/src/pages/Timer/Timer.js @@ -8,7 +8,7 @@ import TimerButton from "./TimerButton/TimerButton"; import SmartList from "../../components/SmartList/SmartList"; import SolutionCard from "../../components/SolutionCard/SolutionCard"; -import { Typography, Button, makeStyles } from "@material-ui/core"; +import { Button, makeStyles } from "@material-ui/core"; const useStyles = makeStyles(theme => ({ @@ -20,14 +20,9 @@ const useStyles = makeStyles(theme => ({ }, })); -const Timer = ({ recentSolutions, setRecentSolutions, setPage }) => { +const Timer = ({ user, recentSolutions, setRecentSolutions, setPage }) => { const classes = useStyles(); - const user = { - id: null, - username: 'anonymous', - }; - const registerResult = result => { const solution = { author_id: user.id, result }; post('solutions/', solution).then(response => { @@ -39,6 +34,10 @@ const Timer = ({ recentSolutions, setRecentSolutions, setPage }) => { setPage('contribute'); }; + const handleLogin = () => { + setPage('profile'); + }; + const removeSolution = (id) => { setRecentSolutions(recentSolutions.filter((solution => solution.id !== id))); }; @@ -66,6 +65,12 @@ const Timer = ({ recentSolutions, setRecentSolutions, setPage }) => { </p> <Button variant="contained" color="secondary" onClick={handleLearnMore}> Learn more </Button> </ContentSection> + {user.id === null && + <ContentSection sectionName="Log into an account"> + <p> Tell us your name so we can track your progress</p> + <Button variant="contained" color="secondary" onClick={handleLogin} size="large"> Login </Button> + </ContentSection> + } <TimerButton registerResult={registerResult} /> </div> </Window> |