From 7838237f4befbf2ea7b343647a8b634d3c2ff722 Mon Sep 17 00:00:00 2001 From: JP1998 Date: Tue, 9 Apr 2019 09:22:12 +0200 Subject: [PATCH 1/5] Export all the common components into their own files --- js/CommonComponents.js | 282 ------------------------------- js/components/ErrorComponents.js | 3 +- js/components/Footer.js | 19 +++ js/components/Login.js | 112 ++++++++++++ js/components/Navigation.js | 97 +++++++++++ js/components/UserRestrictor.js | 51 ++++++ pages/create.js | 5 +- pages/faq.js | 4 +- pages/imprint.js | 4 +- pages/index.js | 4 +- pages/list.js | 3 +- pages/login.js | 4 +- pages/privacy.js | 4 +- pages/register.js | 3 +- pages/tournament-edit.js | 6 +- pages/tournament.js | 4 +- 16 files changed, 312 insertions(+), 293 deletions(-) delete mode 100644 js/CommonComponents.js create mode 100644 js/components/Footer.js create mode 100644 js/components/Login.js create mode 100644 js/components/Navigation.js create mode 100644 js/components/UserRestrictor.js diff --git a/js/CommonComponents.js b/js/CommonComponents.js deleted file mode 100644 index b32d412..0000000 --- a/js/CommonComponents.js +++ /dev/null @@ -1,282 +0,0 @@ -import { - Badge, - Button, - ButtonGroup, - Card, - CardBody, - Container, - Collapse, - Form, - FormGroup, - Nav, - Navbar, - NavbarBrand, - NavbarToggler, - NavItem, - NavLink, - Input, - Label -} from 'reactstrap'; - -import { connect } from 'react-redux'; - -import React from 'react'; - -import { login, logout } from './api'; - -export function BigImage(props) { - return ( -
-

{props.text}

-
- ); -} - -export class TurniereNavigation extends React.Component { - - constructor(props) { - super(props); - - this.toggle = this.toggle.bind(this); - - this.state = { - collapsed: true - }; - } - - toggle() { - this.setState({ - collapsed: !this.state.collapsed - }); - } - - render() { - return ( - - turnie.re - - - - - - - - ); - } -} - -function Navlink(props) { - return ( - - {props.text} - - ); -} - -function Betabadge() { - return (BETA); -} - -class InvisibleLoginLogoutButtons extends React.Component { - - render() { - const { isSignedIn, username } = this.props; - - if(isSignedIn) { - return ( - - - - - ); - } else { - return ( - - - - - ); - } - } -} - -const mapStateToLoginLogoutButtonProperties = (state) => { - const { isSignedIn, username } = state.userinfo; - return { isSignedIn, username }; -}; - -const LoginLogoutButtons = connect( - mapStateToLoginLogoutButtonProperties -)(InvisibleLoginLogoutButtons); - -export function Footer() { - return ( - - ); -} - -/** - * This component works just like a switch statement, although the conditions of the first items - * are checked first, and the first component with a condition that is true will be shown. - * - * For single conditions and options any kind of component can be taken, while the Option-component - * is dedicated for this job. The only important thing is that this component has to have a condition property. - * - * You should also give a default option with a condition that always evaluates to true. - * - * A quick example would be some content that is only to be shown when the user is logged in: - * - * function SomeRestrictedContent(props) { - * const { isSignedIn } = props; - * - * return ( - * - * - * - * - * ); - * } - * - * In the example you'll have to note that the default option is at the bottom of all the options - * since it would always be taken otherwise (the options' conditions are checked from top to bottom) - */ -export class UserRestrictor extends React.Component { - - render() { - const { children } = this.props; - - for(var i in children) { - var c = children[i]; - - if(c.props.condition) { - return c; - } - } - - return null; - } -} - -export function Option(props) { - return props.children; -} - -export function Login(props) { - return ( - - - -

Login

- - - -
-
-
- ); -} - -class LoginErrorList extends React.Component { - render() { - const { error, errorMessages } = this.props; - if(error) { - return ( - - ); - } else { - return null; - } - } -} - -const mapStateToErrorMessages = (state) => { - const { errorMessages, error } = state.userinfo; - return { errorMessages, error }; -}; - -const VisibleLoginErrorList = connect( - mapStateToErrorMessages -)(LoginErrorList); - - -class LoginForm extends React.Component { - - constructor(props) { - super(props); - - this.state = { - email : '', - password : '' - }; - } - - render() { - return ( -
- - - - - - - - - - - - ); - } - - handlePasswordInput(input) { - this.setState({ password : input.target.value }); - } - - handleEmailInput(input) { - this.setState({ email : input.target.value }); - } -} - -function Hint(props) { - if(props.hint != null) { - return ( -

{ props.hint }

- ); - } else { - return null; - } -} diff --git a/js/components/ErrorComponents.js b/js/components/ErrorComponents.js index 2e84ee9..8515ec2 100644 --- a/js/components/ErrorComponents.js +++ b/js/components/ErrorComponents.js @@ -1,6 +1,7 @@ import Head from 'next/head'; import React from 'react'; -import {Footer, TurniereNavigation} from '../CommonComponents'; +import { TurniereNavigation } from './Navigation'; +import { Footer } from './Footer' import 'bootstrap/dist/css/bootstrap.min.css'; import {Container} from 'reactstrap'; import '../../static/everypage.css'; diff --git a/js/components/Footer.js b/js/components/Footer.js new file mode 100644 index 0000000..9d39ad7 --- /dev/null +++ b/js/components/Footer.js @@ -0,0 +1,19 @@ + + +export function Footer() { + return ( + + ); +} diff --git a/js/components/Login.js b/js/components/Login.js new file mode 100644 index 0000000..13861fa --- /dev/null +++ b/js/components/Login.js @@ -0,0 +1,112 @@ +import { + Container, + Card, + CardBody, + Form, + FormGroup, + Label, + Input, + Button +} from 'reactstrap'; +import React from 'react'; +import { connect } from 'react-redux'; +import { login } from '../api'; + +export function Login(props) { + return ( + + + +

Login

+ + + +
+
+
+ ); +} + +class LoginErrorList extends React.Component { + render() { + const { error, errorMessages } = this.props; + if(error) { + return ( +
    + { errorMessages.map((message, index) => +
  • + + {message} +
  • + + ) } +
+ ); + } else { + return null; + } + } +} + +const mapStateToErrorMessages = (state) => { + const { errorMessages, error } = state.userinfo; + return { errorMessages, error }; +}; + +const VisibleLoginErrorList = connect( + mapStateToErrorMessages +)(LoginErrorList); + +class LoginForm extends React.Component { + + constructor(props) { + super(props); + + this.state = { + email : '', + password : '' + }; + } + + render() { + return ( +
+ + + + + + + + + + + + ); + } + + handlePasswordInput(input) { + this.setState({ password : input.target.value }); + } + + handleEmailInput(input) { + this.setState({ email : input.target.value }); + } +} + +function Hint(props) { + if(props.hint != null) { + return ( +

{ props.hint }

+ ); + } else { + return null; + } +} diff --git a/js/components/Navigation.js b/js/components/Navigation.js new file mode 100644 index 0000000..69a5e11 --- /dev/null +++ b/js/components/Navigation.js @@ -0,0 +1,97 @@ +import { + Badge, + Button, + ButtonGroup, + Collapse, + Nav, + Navbar, + NavbarBrand, + NavbarToggler, + NavItem, + NavLink +} from 'reactstrap'; +import { connect } from 'react-redux'; +import React from 'react'; +import { login, logout } from '../api'; + +export class TurniereNavigation extends React.Component { + + constructor(props) { + super(props); + + this.toggle = this.toggle.bind(this); + + this.state = { + collapsed: true + }; + } + + toggle() { + this.setState({ + collapsed: !this.state.collapsed + }); + } + + render() { + return ( + + turnie.re + + + + + + + + ); + } +} + +function Navlink(props) { + return ( + + {props.text} + + ); +} + +function Betabadge() { + return (BETA); +} + +class InvisibleLoginLogoutButtons extends React.Component { + + render() { + const { isSignedIn, username } = this.props; + + if(isSignedIn) { + return ( + + + + + ); + } else { + return ( + + + + + ); + } + } +} + +const mapStateToLoginLogoutButtonProperties = (state) => { + const { isSignedIn, username } = state.userinfo; + return { isSignedIn, username }; +}; + +const LoginLogoutButtons = connect( + mapStateToLoginLogoutButtonProperties +)(InvisibleLoginLogoutButtons); + diff --git a/js/components/UserRestrictor.js b/js/components/UserRestrictor.js new file mode 100644 index 0000000..84daeb7 --- /dev/null +++ b/js/components/UserRestrictor.js @@ -0,0 +1,51 @@ +import React from 'react'; + +/** + * This component works just like a switch statement, although the conditions of the first items + * are checked first, and the first component with a condition that is true will be shown. + * + * For single conditions and options any kind of component can be taken, while the Option-component + * is dedicated for this job. The only important thing is that this component has to have a condition property. + * + * You should also give a default option with a condition that always evaluates to true. + * + * A quick example would be some content that is only to be shown when the user is logged in: + * + * function SomeRestrictedContent(props) { + * const { isSignedIn } = props; + * + * return ( + * + * + * + * + * ); + * } + * + * In the example you'll have to note that the default option is at the bottom of all the options + * since it would always be taken otherwise (the options' conditions are checked from top to bottom) + */ +export class UserRestrictor extends React.Component { + + render() { + const { children } = this.props; + + for(var i in children) { + var c = children[i]; + + if(c.props.condition) { + return c; + } + } + + return null; + } +} + +export function Option(props) { + return props.children; +} diff --git a/pages/create.js b/pages/create.js index 3a25a0b..6fb0992 100644 --- a/pages/create.js +++ b/pages/create.js @@ -1,6 +1,9 @@ import Head from 'next/head'; import '../static/everypage.css'; -import { Footer, TurniereNavigation, UserRestrictor, Option, Login } from '../js/CommonComponents'; +import { TurniereNavigation } from '../js/components/Navigation'; +import { Footer } from '../js/components/Footer.js'; +import { UserRestrictor, Option } from '../js/components/UserRestrictor'; +import { Login } from '../js/components/Login.js'; import React from 'react'; import { connect } from 'react-redux'; diff --git a/pages/faq.js b/pages/faq.js index d747e7d..b00056b 100644 --- a/pages/faq.js +++ b/pages/faq.js @@ -2,7 +2,9 @@ import Head from 'next/head'; import React from 'react'; import {Col, Container, Row} from 'reactstrap'; import 'bootstrap/dist/css/bootstrap.min.css'; -import { BigImage, Footer, TurniereNavigation } from '../js/CommonComponents.js'; +import { TurniereNavigation } from '../js/components/Navigation'; +import { BigImage } from '../js/components/BigImage'; +import { Footer } from '../js/components/Footer.js'; import '../static/everypage.css'; import { diff --git a/pages/imprint.js b/pages/imprint.js index 34fb942..c0e7628 100644 --- a/pages/imprint.js +++ b/pages/imprint.js @@ -2,7 +2,9 @@ import Head from 'next/head'; import React from 'react'; import {Container} from 'reactstrap'; import 'bootstrap/dist/css/bootstrap.min.css'; -import {BigImage, Footer, TurniereNavigation} from '../js/CommonComponents.js'; +import { TurniereNavigation } from '../js/components/Navigation'; +import { BigImage } from '../js/components/BigImage'; +import { Footer } from '../js/components/Footer.js'; import '../static/everypage.css'; import { diff --git a/pages/index.js b/pages/index.js index b49f80d..3bcbbd1 100644 --- a/pages/index.js +++ b/pages/index.js @@ -5,7 +5,9 @@ import { Alert, Button, Card, CardBody } from 'reactstrap'; import 'bootstrap/dist/css/bootstrap.min.css'; -import { BigImage, Footer, TurniereNavigation } from '../js/CommonComponents.js'; +import { TurniereNavigation } from '../js/components/Navigation'; +import { BigImage } from '../js/components/BigImage'; +import { Footer } from '../js/components/Footer.js'; import '../static/everypage.css'; import '../static/css/index.css'; diff --git a/pages/list.js b/pages/list.js index 200e412..9a3c015 100644 --- a/pages/list.js +++ b/pages/list.js @@ -2,7 +2,8 @@ import Head from 'next/head'; import React from 'react'; import { Card, CardBody, Container } from 'reactstrap'; -import { Footer, TurniereNavigation } from '../js/CommonComponents'; +import { TurniereNavigation } from '../js/components/Navigation'; +import { Footer } from '../js/components/Footer.js'; import { getRequest, getState, diff --git a/pages/login.js b/pages/login.js index aa43fa5..6edb1dd 100644 --- a/pages/login.js +++ b/pages/login.js @@ -1,6 +1,8 @@ import Head from 'next/head'; import '../static/everypage.css'; -import { Footer, TurniereNavigation, Login } from '../js/CommonComponents'; +import { TurniereNavigation } from '../js/components/Navigation'; +import { Footer } from '../js/components/Footer.js'; +import { Login } from '../js/components/Login.js'; import React from 'react'; import { diff --git a/pages/privacy.js b/pages/privacy.js index e4263eb..a5c4250 100644 --- a/pages/privacy.js +++ b/pages/privacy.js @@ -2,7 +2,9 @@ import Head from 'next/head'; import React from 'react'; import {Container} from 'reactstrap'; import 'bootstrap/dist/css/bootstrap.min.css'; -import { BigImage, Footer, TurniereNavigation } from '../js/CommonComponents.js'; +import { TurniereNavigation } from '../js/components/Navigation'; +import { BigImage } from '../js/components/BigImage'; +import { Footer } from '../js/components/Footer.js'; import '../static/everypage.css'; import { diff --git a/pages/register.js b/pages/register.js index 096d6c1..a5ce015 100644 --- a/pages/register.js +++ b/pages/register.js @@ -1,6 +1,7 @@ import Head from 'next/head'; import '../static/everypage.css'; -import {Footer, TurniereNavigation} from '../js/CommonComponents'; +import { TurniereNavigation } from '../js/components/Navigation'; +import { Footer } from '../js/components/Footer.js'; import React from 'react'; import { Button, Card, CardBody, Container, Form, FormGroup, FormText, Input, Label } from 'reactstrap'; import { register } from '../js/api'; diff --git a/pages/tournament-edit.js b/pages/tournament-edit.js index 1d147c1..2614b19 100644 --- a/pages/tournament-edit.js +++ b/pages/tournament-edit.js @@ -5,7 +5,11 @@ import { connect } from 'react-redux'; import { notify } from 'react-notify-toast'; import { requestTournament } from '../js/api'; -import { BigImage, Footer, TurniereNavigation, Login, UserRestrictor, Option } from '../js/CommonComponents.js'; +import { TurniereNavigation } from '../js/components/Navigation'; +import { BigImage } from '../js/components/BigImage'; +import { UserRestrictor, Option } from '../js/components/UserRestrictor.js'; +import { Footer } from '../js/components/Footer.js'; +import { Login } from '../js/components/Login.js'; import { ErrorPageComponent } from '../js/components/ErrorComponents.js'; import { diff --git a/pages/tournament.js b/pages/tournament.js index 779a0ba..d753724 100644 --- a/pages/tournament.js +++ b/pages/tournament.js @@ -19,8 +19,10 @@ import { Table } from 'reactstrap'; import { ErrorPageComponent } from '../js/components/ErrorComponents.js'; +import { Footer } from '../js/components/Footer.js'; import 'bootstrap/dist/css/bootstrap.min.css'; -import {BigImage, Footer, TurniereNavigation} from '../js/CommonComponents.js'; +import { TurniereNavigation } from '../js/components/Navigation'; +import { BigImage } from '../js/components/BigImage'; import '../static/everypage.css'; import '../static/css/tournament.css'; import { connect } from 'react-redux'; From c4ce39f353c294151a0872ab2157ba6a5684590d Mon Sep 17 00:00:00 2001 From: JP1998 Date: Tue, 9 Apr 2019 09:29:27 +0200 Subject: [PATCH 2/5] Move EditableStringList into the component folder --- js/{ => components}/EditableStringList.js | 0 pages/create.js | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename js/{ => components}/EditableStringList.js (100%) diff --git a/js/EditableStringList.js b/js/components/EditableStringList.js similarity index 100% rename from js/EditableStringList.js rename to js/components/EditableStringList.js diff --git a/pages/create.js b/pages/create.js index 6fb0992..af79e00 100644 --- a/pages/create.js +++ b/pages/create.js @@ -24,7 +24,7 @@ import { verifyCredentials } from '../js/api'; -import EditableStringList from '../js/EditableStringList'; +import EditableStringList from '../js/components/EditableStringList'; class PrivateCreatePage extends React.Component { From f1e206db0b085539081b36925ceb69f0c7076272 Mon Sep 17 00:00:00 2001 From: JP1998 Date: Tue, 9 Apr 2019 09:51:15 +0200 Subject: [PATCH 3/5] Clean imports in all the javascript files --- js/api.js | 11 +++++++--- js/components/EditableStringList.js | 8 +++++++- js/components/ErrorComponents.js | 11 ++++++---- js/components/Login.js | 5 +++-- js/components/Navigation.js | 5 +++-- js/redux/reduxStoreBinder.js | 2 +- pages/_app.js | 11 +++++----- pages/_error.js | 8 +++----- pages/create.js | 22 ++++++++++---------- pages/faq.js | 22 ++++++++++---------- pages/imprint.js | 21 ++++++++++--------- pages/index.js | 30 +++++++++++++++------------- pages/list.js | 12 +++++++---- pages/login.js | 17 ++++++++-------- pages/privacy.js | 22 ++++++++++---------- pages/register.js | 31 +++++++++++++++++++---------- pages/tournament-edit.js | 27 ++++++++++++------------- pages/tournament-fullscreen.js | 2 +- pages/tournament.js | 22 ++++++++++---------- 19 files changed, 158 insertions(+), 131 deletions(-) diff --git a/js/api.js b/js/api.js index 92b9753..84ae430 100644 --- a/js/api.js +++ b/js/api.js @@ -1,7 +1,12 @@ -import { createStore, applyMiddleware, combineReducers } from 'redux'; +import { + createStore, + applyMiddleware, + combineReducers +} from 'redux'; import { composeWithDevTools } from 'redux-devtools-extension'; -import thunkMiddleware from 'redux-thunk'; -import { errorMessages } from './constants'; +import thunkMiddleware from 'redux-thunk'; + +import { errorMessages } from './constants'; const axios = require('axios'); diff --git a/js/components/EditableStringList.js b/js/components/EditableStringList.js index 64ef704..08bf284 100644 --- a/js/components/EditableStringList.js +++ b/js/components/EditableStringList.js @@ -1,5 +1,11 @@ import React from 'react'; -import { Alert, Button, Input, InputGroup, InputGroupAddon } from 'reactstrap'; +import { + Alert, + Button, + Input, + InputGroup, + InputGroupAddon +} from 'reactstrap'; export default class EditableStringList extends React.Component { constructor(props) { diff --git a/js/components/ErrorComponents.js b/js/components/ErrorComponents.js index 8515ec2..beb7a0d 100644 --- a/js/components/ErrorComponents.js +++ b/js/components/ErrorComponents.js @@ -1,9 +1,12 @@ -import Head from 'next/head'; -import React from 'react'; +import Head from 'next/head'; +import React from 'react'; +import { Container } from 'reactstrap'; + import { TurniereNavigation } from './Navigation'; -import { Footer } from './Footer' +import { Footer } from './Footer'; + import 'bootstrap/dist/css/bootstrap.min.css'; -import {Container} from 'reactstrap'; + import '../../static/everypage.css'; import '../../static/css/error.css'; diff --git a/js/components/Login.js b/js/components/Login.js index 13861fa..f447f90 100644 --- a/js/components/Login.js +++ b/js/components/Login.js @@ -8,9 +8,10 @@ import { Input, Button } from 'reactstrap'; -import React from 'react'; +import React from 'react'; import { connect } from 'react-redux'; -import { login } from '../api'; + +import { login } from '../api'; export function Login(props) { return ( diff --git a/js/components/Navigation.js b/js/components/Navigation.js index 69a5e11..b9d0775 100644 --- a/js/components/Navigation.js +++ b/js/components/Navigation.js @@ -11,8 +11,9 @@ import { NavLink } from 'reactstrap'; import { connect } from 'react-redux'; -import React from 'react'; -import { login, logout } from '../api'; +import React from 'react'; + +import { logout } from '../api'; export class TurniereNavigation extends React.Component { diff --git a/js/redux/reduxStoreBinder.js b/js/redux/reduxStoreBinder.js index 179d2a0..fe4499e 100644 --- a/js/redux/reduxStoreBinder.js +++ b/js/redux/reduxStoreBinder.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React from 'react'; import { initializeStore } from '../api'; const isServer = typeof window === 'undefined'; diff --git a/pages/_app.js b/pages/_app.js index 39529b0..ba56534 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -1,8 +1,9 @@ -import App, {Container} from 'next/app'; -import React from 'react'; -import { Provider } from 'react-redux'; -import withReduxStore from '../js/redux/reduxStoreBinder'; -import Notifications from 'react-notify-toast'; +import { App, Container } from 'next/app'; +import React from 'react'; +import { Provider } from 'react-redux'; +import Notifications from 'react-notify-toast'; + +import withReduxStore from '../js/redux/reduxStoreBinder'; class TurniereApp extends App { diff --git a/pages/_error.js b/pages/_error.js index c0babdc..29a2c44 100644 --- a/pages/_error.js +++ b/pages/_error.js @@ -1,9 +1,7 @@ -import { ErrorPageComponent } from '../js/components/ErrorComponents.js'; -import React from 'react'; +import React from 'react'; -import { - verifyCredentials -} from '../js/api'; +import { ErrorPageComponent } from '../js/components/ErrorComponents'; +import { verifyCredentials } from '../js/api'; export default class Error extends React.Component { static getInitialProps({ res, err }) { diff --git a/pages/create.js b/pages/create.js index af79e00..b8ad288 100644 --- a/pages/create.js +++ b/pages/create.js @@ -1,11 +1,6 @@ -import Head from 'next/head'; -import '../static/everypage.css'; -import { TurniereNavigation } from '../js/components/Navigation'; -import { Footer } from '../js/components/Footer.js'; -import { UserRestrictor, Option } from '../js/components/UserRestrictor'; -import { Login } from '../js/components/Login.js'; -import React from 'react'; -import { connect } from 'react-redux'; +import Head from 'next/head'; +import React from 'react'; +import { connect } from 'react-redux'; import { Button, @@ -20,11 +15,14 @@ import { Label } from 'reactstrap'; -import { - verifyCredentials -} from '../js/api'; +import { TurniereNavigation } from '../js/components/Navigation'; +import { Footer } from '../js/components/Footer'; +import { UserRestrictor, Option } from '../js/components/UserRestrictor'; +import { Login } from '../js/components/Login'; +import { verifyCredentials } from '../js/api'; +import EditableStringList from '../js/components/EditableStringList'; -import EditableStringList from '../js/components/EditableStringList'; +import '../static/everypage.css'; class PrivateCreatePage extends React.Component { diff --git a/pages/faq.js b/pages/faq.js index b00056b..c861b13 100644 --- a/pages/faq.js +++ b/pages/faq.js @@ -1,15 +1,15 @@ -import Head from 'next/head'; -import React from 'react'; -import {Col, Container, Row} from 'reactstrap'; -import 'bootstrap/dist/css/bootstrap.min.css'; -import { TurniereNavigation } from '../js/components/Navigation'; -import { BigImage } from '../js/components/BigImage'; -import { Footer } from '../js/components/Footer.js'; -import '../static/everypage.css'; +import Head from 'next/head'; +import React from 'react'; +import { Col, Container, Row } from 'reactstrap'; -import { - verifyCredentials -} from '../js/api'; +import { TurniereNavigation } from '../js/components/Navigation'; +import { BigImage } from '../js/components/BigImage'; +import { Footer } from '../js/components/Footer'; +import { verifyCredentials } from '../js/api'; + +import 'bootstrap/dist/css/bootstrap.min.css'; + +import '../static/everypage.css'; function Main() { return ( diff --git a/pages/imprint.js b/pages/imprint.js index c0e7628..40d58a9 100644 --- a/pages/imprint.js +++ b/pages/imprint.js @@ -1,15 +1,14 @@ -import Head from 'next/head'; -import React from 'react'; -import {Container} from 'reactstrap'; -import 'bootstrap/dist/css/bootstrap.min.css'; -import { TurniereNavigation } from '../js/components/Navigation'; -import { BigImage } from '../js/components/BigImage'; -import { Footer } from '../js/components/Footer.js'; -import '../static/everypage.css'; +import Head from 'next/head'; +import React from 'react'; +import { Container } from 'reactstrap'; -import { - verifyCredentials -} from '../js/api'; +import { TurniereNavigation } from '../js/components/Navigation'; +import { BigImage } from '../js/components/BigImage'; +import { Footer } from '../js/components/Footer'; +import { verifyCredentials } from '../js/api'; + +import 'bootstrap/dist/css/bootstrap.min.css'; +import '../static/everypage.css'; function Main() { return ( diff --git a/pages/index.js b/pages/index.js index 3bcbbd1..77c93eb 100644 --- a/pages/index.js +++ b/pages/index.js @@ -1,23 +1,25 @@ -import Head from 'next/head'; -import React from 'react'; - -import { Alert, Button, Card, CardBody } from 'reactstrap'; - -import 'bootstrap/dist/css/bootstrap.min.css'; +import Head from 'next/head'; +import React from 'react'; +import { connect } from 'react-redux'; +import { + Alert, + Button, + Card, + CardBody +} from 'reactstrap'; import { TurniereNavigation } from '../js/components/Navigation'; -import { BigImage } from '../js/components/BigImage'; -import { Footer } from '../js/components/Footer.js'; - -import '../static/everypage.css'; -import '../static/css/index.css'; - -import { connect } from 'react-redux'; - +import { BigImage } from '../js/components/BigImage'; +import { Footer } from '../js/components/Footer'; import { verifyCredentials } from '../js/api'; +import 'bootstrap/dist/css/bootstrap.min.css'; + +import '../static/everypage.css'; +import '../static/css/index.css'; + function Main() { return (
diff --git a/pages/list.js b/pages/list.js index 9a3c015..7e9f018 100644 --- a/pages/list.js +++ b/pages/list.js @@ -1,9 +1,13 @@ -import Head from 'next/head'; -import React from 'react'; -import { Card, CardBody, Container } from 'reactstrap'; +import Head from 'next/head'; +import React from 'react'; +import { + Card, + CardBody, + Container +} from 'reactstrap'; import { TurniereNavigation } from '../js/components/Navigation'; -import { Footer } from '../js/components/Footer.js'; +import { Footer } from '../js/components/Footer'; import { getRequest, getState, diff --git a/pages/login.js b/pages/login.js index 6edb1dd..4bed1e0 100644 --- a/pages/login.js +++ b/pages/login.js @@ -1,13 +1,12 @@ -import Head from 'next/head'; -import '../static/everypage.css'; -import { TurniereNavigation } from '../js/components/Navigation'; -import { Footer } from '../js/components/Footer.js'; -import { Login } from '../js/components/Login.js'; -import React from 'react'; +import Head from 'next/head'; +import React from 'react'; -import { - verifyCredentials -} from '../js/api'; +import { TurniereNavigation } from '../js/components/Navigation'; +import { Footer } from '../js/components/Footer'; +import { Login } from '../js/components/Login'; +import { verifyCredentials } from '../js/api'; + +import '../static/everypage.css'; export default class LoginPage extends React.Component { diff --git a/pages/privacy.js b/pages/privacy.js index a5c4250..42dca7f 100644 --- a/pages/privacy.js +++ b/pages/privacy.js @@ -1,15 +1,15 @@ -import Head from 'next/head'; -import React from 'react'; -import {Container} from 'reactstrap'; -import 'bootstrap/dist/css/bootstrap.min.css'; -import { TurniereNavigation } from '../js/components/Navigation'; -import { BigImage } from '../js/components/BigImage'; -import { Footer } from '../js/components/Footer.js'; -import '../static/everypage.css'; +import Head from 'next/head'; +import React from 'react'; +import { Container } from 'reactstrap'; -import { - verifyCredentials -} from '../js/api'; +import { TurniereNavigation } from '../js/components/Navigation'; +import { BigImage } from '../js/components/BigImage'; +import { Footer } from '../js/components/Footer'; +import { verifyCredentials } from '../js/api'; + +import 'bootstrap/dist/css/bootstrap.min.css'; + +import '../static/everypage.css'; function Main() { return ( diff --git a/pages/register.js b/pages/register.js index a5ce015..91ebc81 100644 --- a/pages/register.js +++ b/pages/register.js @@ -1,15 +1,24 @@ -import Head from 'next/head'; -import '../static/everypage.css'; -import { TurniereNavigation } from '../js/components/Navigation'; -import { Footer } from '../js/components/Footer.js'; -import React from 'react'; -import { Button, Card, CardBody, Container, Form, FormGroup, FormText, Input, Label } from 'reactstrap'; -import { register } from '../js/api'; -import { connect } from 'react-redux'; - +import Head from 'next/head'; +import React from 'react'; +import { connect } from 'react-redux'; import { - verifyCredentials -} from '../js/api'; + Button, + Card, + CardBody, + Container, + Form, + FormGroup, + FormText, + Input, + Label +} from 'reactstrap'; + +import { TurniereNavigation } from '../js/components/Navigation'; +import { Footer } from '../js/components/Footer'; +import { register } from '../js/api'; +import { verifyCredentials } from '../js/api'; + +import '../static/everypage.css'; export default class RegisterPage extends React.Component { diff --git a/pages/tournament-edit.js b/pages/tournament-edit.js index 2614b19..8b0dfae 100644 --- a/pages/tournament-edit.js +++ b/pages/tournament-edit.js @@ -1,17 +1,7 @@ -import Head from 'next/head'; -import React from 'react'; -import 'bootstrap/dist/css/bootstrap.min.css'; -import { connect } from 'react-redux'; -import { notify } from 'react-notify-toast'; - -import { requestTournament } from '../js/api'; -import { TurniereNavigation } from '../js/components/Navigation'; -import { BigImage } from '../js/components/BigImage'; -import { UserRestrictor, Option } from '../js/components/UserRestrictor.js'; -import { Footer } from '../js/components/Footer.js'; -import { Login } from '../js/components/Login.js'; -import { ErrorPageComponent } from '../js/components/ErrorComponents.js'; - +import Head from 'next/head'; +import React from 'react'; +import { connect } from 'react-redux'; +import { notify } from 'react-notify-toast'; import { Container, Button, @@ -20,11 +10,20 @@ import { Table } from 'reactstrap'; +import { requestTournament } from '../js/api'; +import { TurniereNavigation } from '../js/components/Navigation'; +import { BigImage } from '../js/components/BigImage'; +import { UserRestrictor, Option } from '../js/components/UserRestrictor'; +import { Footer } from '../js/components/Footer'; +import { Login } from '../js/components/Login'; +import { ErrorPageComponent } from '../js/components/ErrorComponents'; import { verifyCredentials, updateTeamName } from '../js/api'; +import 'bootstrap/dist/css/bootstrap.min.css'; + import '../static/everypage.css'; import '../static/css/index.css'; diff --git a/pages/tournament-fullscreen.js b/pages/tournament-fullscreen.js index 21fddff..a7b79d3 100644 --- a/pages/tournament-fullscreen.js +++ b/pages/tournament-fullscreen.js @@ -1,4 +1,4 @@ -import Head from 'next/head'; +import Head from 'next/head'; import React from 'react'; import { diff --git a/pages/tournament.js b/pages/tournament.js index d753724..1b12687 100644 --- a/pages/tournament.js +++ b/pages/tournament.js @@ -1,5 +1,6 @@ -import Head from 'next/head'; -import React from 'react'; +import Head from 'next/head'; +import React from 'react'; +import { connect } from 'react-redux'; import { Button, Card, @@ -18,21 +19,22 @@ import { Row, Table } from 'reactstrap'; -import { ErrorPageComponent } from '../js/components/ErrorComponents.js'; -import { Footer } from '../js/components/Footer.js'; -import 'bootstrap/dist/css/bootstrap.min.css'; -import { TurniereNavigation } from '../js/components/Navigation'; -import { BigImage } from '../js/components/BigImage'; -import '../static/everypage.css'; -import '../static/css/tournament.css'; -import { connect } from 'react-redux'; +import { ErrorPageComponent } from '../js/components/ErrorComponents'; +import { Footer } from '../js/components/Footer'; +import { TurniereNavigation } from '../js/components/Navigation'; +import { BigImage } from '../js/components/BigImage'; import { getRequest, getState, verifyCredentials } from '../js/api'; +import 'bootstrap/dist/css/bootstrap.min.css'; + +import '../static/everypage.css'; +import '../static/css/tournament.css'; + class TournamentPage extends React.Component { render() { From 5f1a8877dfd273d448f78b979529d2606be2171c Mon Sep 17 00:00:00 2001 From: JP1998 Date: Tue, 9 Apr 2019 09:55:45 +0200 Subject: [PATCH 4/5] Fix a bug causing the server to always create an error --- pages/_app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/_app.js b/pages/_app.js index ba56534..1ea11b4 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -1,4 +1,4 @@ -import { App, Container } from 'next/app'; +import App, { Container } from 'next/app'; import React from 'react'; import { Provider } from 'react-redux'; import Notifications from 'react-notify-toast'; From 73fa9213b848c39ffc65fd07e2e524176dccafbe Mon Sep 17 00:00:00 2001 From: JP1998 Date: Tue, 9 Apr 2019 10:18:55 +0200 Subject: [PATCH 5/5] Add the favicon to all pages --- package.json | 1 + pages/_app.js | 2 ++ static/icons/favicon.ico | Bin 0 -> 1150 bytes yarn.lock | 5 +++++ 4 files changed, 8 insertions(+) create mode 100644 static/icons/favicon.ico diff --git a/package.json b/package.json index 601fd1b..ae3ad3d 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "next": "^7.0.2", "react": "^16.6.1", "react-dom": "^16.6.1", + "react-favicon": "^0.0.14", "react-notify-toast": "^0.5.0", "react-redux": "^5.1.1", "reactstrap": "^6.5.0", diff --git a/pages/_app.js b/pages/_app.js index 39529b0..892f891 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -3,6 +3,7 @@ import React from 'react'; import { Provider } from 'react-redux'; import withReduxStore from '../js/redux/reduxStoreBinder'; import Notifications from 'react-notify-toast'; +import Favicon from 'react-favicon'; class TurniereApp extends App { @@ -11,6 +12,7 @@ class TurniereApp extends App { return ( + diff --git a/static/icons/favicon.ico b/static/icons/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..ed8c89ae90633b3c4fda950d105440eaf871c507 GIT binary patch literal 1150 zcmZXTe@qi+7{?!MSCyfw%8x+kuaqhv0wXMQ|FA!{>E`A?&WXtulSNTyqKRk>X3n&_ zx$LJ23Cj|)O$=k35lG=$+Jd$I7zotO1)M`98q+Kb2;7xkTUyF@&$W{=cbCuI^FHtM zdGCGiy(3EFQ>!Ju8fm|pD4U218BTE~mFF7~_pNz4MY6rp*|(bM>;uVIs{li%cS$4AKfRWp;&gbDW{`2DcnFdqODp z%BZ{=h1ny+><-0rZGW~d|IBOBHr*v!k-IR4#T%o7%klI)L25F%LMU(tQQAF&O}!Cp z?T?|nCkPAYcns(-2HNRZi&k^0GwIh3JR)uD1nC{pn>vRSF?Iz}<`z-ypT*%jKdH zdWQ&uFnM3|p+l#(+G)#;7;U;Smu~2sx@2(8U_H-q`!5O9aQ(sGfkVt*j;n70rQR^~ z{EU42gr929tx_FrqCI|@==1=Ygh`vu$$i2!s;)=z7T3T1TM8w9sec~%4qiL2G3&>N z^~%dvRo5l=V4XWi8@hu*mMQRanFhw&G&2AN=rM?@Q*N8$1C2139XQ1#y388*1;jD#XpIYc3wh`4C|33tK z)K*Gnc5Xd(IrmpXA&s0>eCCU_GJ#h(=X>x=v=KUhlSQ>C!-rYy$CZKdyl0@p>k JUU43Ke*@~o`;q_v literal 0 HcmV?d00001 diff --git a/yarn.lock b/yarn.lock index aa16d47..ad27f6d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6431,6 +6431,11 @@ react-error-overlay@4.0.0: resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-4.0.0.tgz#d198408a85b4070937a98667f500c832f86bd5d4" integrity sha512-FlsPxavEyMuR6TjVbSSywovXSEyOg6ZDj5+Z8nbsRl9EkOzAhEIcS+GLoQDC5fz/t9suhUXWmUrOBrgeUvrMxw== +react-favicon@^0.0.14: + version "0.0.14" + resolved "https://registry.yarnpkg.com/react-favicon/-/react-favicon-0.0.14.tgz#3c9c7b999d106e6e112f729ab929b8dbec05b280" + integrity sha512-dE1Q13jgc5/Z49G3O3LSdJ87XGK6I4sIYmx3+ROYOEkt0wcrdP9J5wf2oDLtq7D9bOm0j62HAWP+DoofjsHNJQ== + react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1: version "16.8.6" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.6.tgz#5bbc1e2d29141c9fbdfed456343fe2bc430a6a16"