aboutsummaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/components/ContentSection/ContentSection.js2
-rw-r--r--src/components/Header/Header.js4
-rw-r--r--src/components/Loading/Loading.js4
-rw-r--r--src/components/SolutionCard/SolutionCard.js6
-rw-r--r--src/components/Window/Window.js4
-rw-r--r--src/components/Window/WindowSurface/WindowSurface.js2
-rw-r--r--src/index.js14
-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
13 files changed, 58 insertions, 55 deletions
diff --git a/src/components/ContentSection/ContentSection.js b/src/components/ContentSection/ContentSection.js
index 99e76aa..5108ce0 100644
--- a/src/components/ContentSection/ContentSection.js
+++ b/src/components/ContentSection/ContentSection.js
@@ -4,7 +4,7 @@ import {
Typography,
Divider,
makeStyles
-} from "@material-ui/core";
+} from '@material-ui/core';
const useStyles = makeStyles(theme => ({
diff --git a/src/components/Header/Header.js b/src/components/Header/Header.js
index d6294db..1595141 100644
--- a/src/components/Header/Header.js
+++ b/src/components/Header/Header.js
@@ -1,4 +1,4 @@
-import React from "react";
+import React from 'react';
import {
AppBar,
@@ -6,7 +6,7 @@ import {
Tab,
Typography,
Toolbar,
-} from "@material-ui/core";
+} from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles';
import TimerIcon from '@material-ui/icons/Timer';
diff --git a/src/components/Loading/Loading.js b/src/components/Loading/Loading.js
index 632142b..e8b9701 100644
--- a/src/components/Loading/Loading.js
+++ b/src/components/Loading/Loading.js
@@ -3,9 +3,9 @@ import React from 'react';
import {
Card,
CardHeader,
-} from "@material-ui/core";
+} from '@material-ui/core';
-import { makeStyles } from "@material-ui/core/styles";
+import { makeStyles } from '@material-ui/core/styles';
import CircularProgress from '@material-ui/core/CircularProgress';
diff --git a/src/components/SolutionCard/SolutionCard.js b/src/components/SolutionCard/SolutionCard.js
index 1fff873..8252347 100644
--- a/src/components/SolutionCard/SolutionCard.js
+++ b/src/components/SolutionCard/SolutionCard.js
@@ -10,13 +10,13 @@ import {
Grid,
Menu,
MenuItem,
-} from "@material-ui/core";
+} from '@material-ui/core';
-import { makeStyles } from "@material-ui/core/styles";
+import { makeStyles } from '@material-ui/core/styles';
import TimerIcon from '@material-ui/icons/Timer';
import MoreVertIcon from '@material-ui/icons/MoreVert';
-import { del } from "../../requests";
+import { del } from '../../requests';
const DATE_FORMAT = {
diff --git a/src/components/Window/Window.js b/src/components/Window/Window.js
index 63bd6ba..0ba2454 100644
--- a/src/components/Window/Window.js
+++ b/src/components/Window/Window.js
@@ -1,8 +1,8 @@
import React from 'react';
-import { Typography, Divider, makeStyles } from "@material-ui/core";
+import { Typography, Divider, makeStyles } from '@material-ui/core';
-import WindowSurface from "./WindowSurface/WindowSurface";
+import WindowSurface from './WindowSurface/WindowSurface';
const useStyles = makeStyles(theme => ({
diff --git a/src/components/Window/WindowSurface/WindowSurface.js b/src/components/Window/WindowSurface/WindowSurface.js
index c4e6b3d..26fea01 100644
--- a/src/components/Window/WindowSurface/WindowSurface.js
+++ b/src/components/Window/WindowSurface/WindowSurface.js
@@ -1,6 +1,6 @@
import React from 'react';
-import { Paper, makeStyles } from "@material-ui/core";
+import { Paper, makeStyles } from '@material-ui/core';
const useStyles = makeStyles(theme => ({
diff --git a/src/index.js b/src/index.js
index 6563c60..869ec3d 100644
--- a/src/index.js
+++ b/src/index.js
@@ -5,14 +5,14 @@ import CssBaseline from '@material-ui/core/CssBaseline';
import { ThemeProvider } from '@material-ui/core/styles';
import 'typeface-roboto';
-import theme from "./theme";
+import theme from './theme';
import Header from './components/Header/Header';
-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 Timer from './pages/Timer/Timer';
+import Scoreboard from './pages/Scoreboard/Scoreboard';
+import Contribute from './pages/Contribute/Contribute';
+import Profile from './pages/Profile/Profile';
-import { get } from "./requests";
+import { get } from './requests';
const App = () => {
@@ -65,5 +65,5 @@ const App = () => {
);
};
-document.body.style.overflow = "hidden";
+document.body.style.overflow = 'hidden';
ReactDOM.render(<App />, document.getElementById('root'));
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);