aboutsummaryrefslogtreecommitdiff
path: root/src/pages
diff options
context:
space:
mode:
authorEugene <eug-vs@keemail.me>2020-01-16 19:32:18 +0000
committerGitHub <noreply@github.com>2020-01-16 19:32:18 +0000
commit22918f53bdee82e0a34bb2a09059ccd3ffca0dc6 (patch)
tree52779dc13ae2b8714b108c6cd23951de36344fbd /src/pages
parent8a005dd6d506faf4fd1d5766a3f51d94300f4fd8 (diff)
parent6ceb6dbb3a7a43394a2318c8c9eda44e8c7a3ccb (diff)
downloadchrono-cube-ui-22918f53bdee82e0a34bb2a09059ccd3ffca0dc6.tar.gz
Merge pull request #40 from Eug-VS/eslint
feat: configure ESlint
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/Contribute/Contribute.js6
-rw-r--r--src/pages/Profile/Profile.js14
-rw-r--r--src/pages/Profile/Registration/Registration.js6
-rw-r--r--src/pages/Scoreboard/Scoreboard.js12
-rw-r--r--src/pages/Timer/Timer.js12
-rw-r--r--src/pages/Timer/TimerButton/TimerButton.js27
6 files changed, 40 insertions, 37 deletions
diff --git a/src/pages/Contribute/Contribute.js b/src/pages/Contribute/Contribute.js
index 6837f59..d94cc80 100644
--- a/src/pages/Contribute/Contribute.js
+++ b/src/pages/Contribute/Contribute.js
@@ -9,14 +9,14 @@ import {
Avatar,
Divider,
makeStyles,
-} from "@material-ui/core";
+} from '@material-ui/core';
import TrendingUpIcon from '@material-ui/icons/TrendingUp';
import BugReportIcon from '@material-ui/icons/BugReport';
import NewReleasesIcon from '@material-ui/icons/NewReleases';
-import Window from "../../components/Window/Window";
-import ContentSection from "../../components/ContentSection/ContentSection";
+import Window from '../../components/Window/Window';
+import ContentSection from '../../components/ContentSection/ContentSection';
const useStyles = makeStyles(theme => ({
diff --git a/src/pages/Profile/Profile.js b/src/pages/Profile/Profile.js
index 861e58e..783d497 100644
--- a/src/pages/Profile/Profile.js
+++ b/src/pages/Profile/Profile.js
@@ -1,17 +1,17 @@
import React, { useState, useEffect } from 'react';
-import Window from "../../components/Window/Window";
+import Window from '../../components/Window/Window';
import {
Button,
makeStyles,
-} from "@material-ui/core";
+} from '@material-ui/core';
-import Registration from "./Registration/Registration";
-import ContentSection from "../../components/ContentSection/ContentSection";
-import SmartList from "../../components/SmartList/SmartList";
+import Registration from './Registration/Registration';
+import ContentSection from '../../components/ContentSection/ContentSection';
+import SmartList from '../../components/SmartList/SmartList';
-import { get } from "../../requests";
-import SolutionCard from "../../components/SolutionCard/SolutionCard";
+import { get } from '../../requests';
+import SolutionCard from '../../components/SolutionCard/SolutionCard';
const useStyles = makeStyles(theme => ({
diff --git a/src/pages/Profile/Registration/Registration.js b/src/pages/Profile/Registration/Registration.js
index 45c83bc..af4ec30 100644
--- a/src/pages/Profile/Registration/Registration.js
+++ b/src/pages/Profile/Registration/Registration.js
@@ -6,10 +6,10 @@ import {
Checkbox,
FormControlLabel,
Grid,
-} from "@material-ui/core";
+} from '@material-ui/core';
-import ContentSection from "../../../components/ContentSection/ContentSection";
-import {get, post} from "../../../requests";
+import ContentSection from '../../../components/ContentSection/ContentSection';
+import {get, post} from '../../../requests';
const Registration = ({ setUser }) => {
diff --git a/src/pages/Scoreboard/Scoreboard.js b/src/pages/Scoreboard/Scoreboard.js
index 29d26c8..335c06b 100644
--- a/src/pages/Scoreboard/Scoreboard.js
+++ b/src/pages/Scoreboard/Scoreboard.js
@@ -1,13 +1,13 @@
import React, { useEffect, useState } from 'react';
-import { makeStyles } from "@material-ui/core/styles";
+import { makeStyles } from '@material-ui/core/styles';
-import { get } from "../../requests";
+import { get } from '../../requests';
-import SmartList from "../../components/SmartList/SmartList";
-import SolutionCard from "../../components/SolutionCard/SolutionCard";
-import Loading from "../../components/Loading/Loading";
-import Window from "../../components/Window/Window";
+import SmartList from '../../components/SmartList/SmartList';
+import SolutionCard from '../../components/SolutionCard/SolutionCard';
+import Loading from '../../components/Loading/Loading';
+import Window from '../../components/Window/Window';
const useStyles = makeStyles(theme => ({
diff --git a/src/pages/Timer/Timer.js b/src/pages/Timer/Timer.js
index a41c47b..1323d97 100644
--- a/src/pages/Timer/Timer.js
+++ b/src/pages/Timer/Timer.js
@@ -2,13 +2,13 @@ import React from 'react';
import { post } from '../../requests';
-import Window from "../../components/Window/Window";
-import ContentSection from "../../components/ContentSection/ContentSection";
-import TimerButton from "./TimerButton/TimerButton";
-import SmartList from "../../components/SmartList/SmartList";
-import SolutionCard from "../../components/SolutionCard/SolutionCard";
+import Window from '../../components/Window/Window';
+import ContentSection from '../../components/ContentSection/ContentSection';
+import TimerButton from './TimerButton/TimerButton';
+import SmartList from '../../components/SmartList/SmartList';
+import SolutionCard from '../../components/SolutionCard/SolutionCard';
-import { Button, makeStyles } from "@material-ui/core";
+import { Button, makeStyles } from '@material-ui/core';
const useStyles = makeStyles(theme => ({
diff --git a/src/pages/Timer/TimerButton/TimerButton.js b/src/pages/Timer/TimerButton/TimerButton.js
index 76bb65d..0f43c5a 100644
--- a/src/pages/Timer/TimerButton/TimerButton.js
+++ b/src/pages/Timer/TimerButton/TimerButton.js
@@ -1,7 +1,7 @@
import React, { useState, useEffect } from 'react';
import { Paper, Typography } from '@material-ui/core';
-import { makeStyles } from "@material-ui/core/styles";
+import { makeStyles } from '@material-ui/core/styles';
const useStyles = makeStyles(theme => ({
root: {
@@ -19,21 +19,25 @@ const TimerButton = ({ registerResult }) => {
const maxCountdown = 15000;
const [time, setTime] = useState('00:00:00');
const [mode, setMode] = useState('idle');
- const [repeater, setRepeater] = useState(0);
useEffect(()=> {
- clearInterval(repeater);
const timestamp = Date.now();
- if (mode === 'countdown') setRepeater(setInterval(() => {
- const timeDelta = maxCountdown - (Date.now() - timestamp);
- if (timeDelta <= 0) setMode('over');
- setTime(convertTimeToString(timeDelta));
- }, 10));
+ if (mode === 'countdown') {
+ const repeater = setInterval(() => {
+ const timeDelta = maxCountdown - (Date.now() - timestamp);
+ if (timeDelta <= 0) setMode('over');
+ setTime(convertTimeToString(timeDelta));
+ }, 10);
+ return () => clearInterval(repeater);
+ }
- if (mode === 'running') setRepeater(setInterval(() => {
- setTime(convertTimeToString(Date.now() - timestamp));
- }, 10));
+ if (mode === 'running') {
+ const repeater = setInterval(() => {
+ setTime(convertTimeToString(Date.now() - timestamp));
+ }, 10);
+ return () => clearInterval(repeater);
+ }
if (mode === 'over') {
setTime('00:00:00');
@@ -46,7 +50,6 @@ const TimerButton = ({ registerResult }) => {
};
const handleKeyUp = event => {
- clearInterval(repeater);
if (event.keyCode === SPACE) {
if (mode === 'running') {
registerResult(time);