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 (