From 9124edc3f23f75389acc374e221a30e85ff60754 Mon Sep 17 00:00:00 2001 From: JP1998 Date: Sun, 9 Dec 2018 23:46:21 +0100 Subject: [PATCH] Fix all the styling issues in all the files --- .eslintrc.json | 2 + js/CommonComponents.js | 14 +- js/EditableStringList.js | 20 +- js/components/BigImage.js | 2 +- js/constants.js | 2 +- js/redux/reduxStoreBinder.js | 34 +- next.config.js | 4 +- pages/_app.js | 38 +- pages/_error.js | 92 ++-- pages/create.js | 33 +- pages/faq.js | 146 ++--- pages/imprint.js | 122 ++--- pages/index.js | 21 +- pages/list.js | 4 +- pages/login.js | 19 +- pages/privacy.js | 969 ++++++++++++++++----------------- pages/register.js | 19 +- pages/tournament-fullscreen.js | 7 +- pages/tournament.js | 9 +- server.js | 56 +- 20 files changed, 798 insertions(+), 815 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 6efdb03..60df449 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -16,6 +16,8 @@ } }, "rules": { + "react/jsx-uses-react": "error", + "react/jsx-uses-vars": "error", "indent": [ "error", 4 diff --git a/js/CommonComponents.js b/js/CommonComponents.js index 1ed65ed..408ab37 100644 --- a/js/CommonComponents.js +++ b/js/CommonComponents.js @@ -11,11 +11,11 @@ import { NavLink } from 'reactstrap'; -import { connect } from 'react-redux' +import { connect } from 'react-redux'; -import React from "react"; +import React from 'react'; -import { logout } from './api' +import { logout } from './api'; export function BigImage(props) { return ( @@ -77,7 +77,7 @@ function Betabadge() { class InvisibleLoginLogoutButtons extends React.Component { render() { - const { isSignedIn, username } = this.props + const { isSignedIn, username } = this.props; if(isSignedIn) { return ( @@ -100,12 +100,12 @@ class InvisibleLoginLogoutButtons extends React.Component { const mapStateToLoginLogoutButtonProperties = (state) => { const { isSignedIn, username } = state.userinfo; - return { isSignedIn, username } -} + return { isSignedIn, username }; +}; const LoginLogoutButtons = connect( mapStateToLoginLogoutButtonProperties -)(InvisibleLoginLogoutButtons) +)(InvisibleLoginLogoutButtons); export function Footer() { return ( diff --git a/js/EditableStringList.js b/js/EditableStringList.js index a7cfda0..64ef704 100644 --- a/js/EditableStringList.js +++ b/js/EditableStringList.js @@ -1,5 +1,5 @@ -import React from "react"; -import {Alert, Button, Input, InputGroup, InputGroupAddon} from "reactstrap"; +import React from 'react'; +import { Alert, Button, Input, InputGroup, InputGroupAddon } from 'reactstrap'; export default class EditableStringList extends React.Component { constructor(props) { @@ -31,17 +31,14 @@ export default class EditableStringList extends React.Component { if ((typeof this.state.entries !== 'undefined') && this.state.entries.length > 0) { return (
- - {this.state.entries.map((text) => )} + + {this.state.entries.map((text) => )}
); } else { return (
- + {this.props.placeholder}
); @@ -64,8 +61,7 @@ class StringInput extends React.Component { render() { return ( - { + { if (e.key === 'Enter') { this.submit(); return false; @@ -73,10 +69,10 @@ class StringInput extends React.Component { }}/> + onClick={() => this.submit()}>{this.props.addButtonText} - ) + ); } submit() { diff --git a/js/components/BigImage.js b/js/components/BigImage.js index e442ab7..b89f6ff 100644 --- a/js/components/BigImage.js +++ b/js/components/BigImage.js @@ -1,4 +1,4 @@ -import React from "react"; +import React from 'react'; export function BigImage(props) { return ( diff --git a/js/constants.js b/js/constants.js index a0bc2e2..80ed3d7 100644 --- a/js/constants.js +++ b/js/constants.js @@ -7,5 +7,5 @@ export const errorMessages = { login_errorunknown : { en : 'An unknown error prevented a successful login.' } -} +}; diff --git a/js/redux/reduxStoreBinder.js b/js/redux/reduxStoreBinder.js index e685a1f..179d2a0 100644 --- a/js/redux/reduxStoreBinder.js +++ b/js/redux/reduxStoreBinder.js @@ -1,20 +1,20 @@ -import React from 'react' -import { initializeStore } from '../api' +import React from 'react'; +import { initializeStore } from '../api'; -const isServer = typeof window === 'undefined' -const __NEXT_REDUX_STORE__ = '__NEXT_REDUX_STORE__' +const isServer = typeof window === 'undefined'; +const __NEXT_REDUX_STORE__ = '__NEXT_REDUX_STORE__'; function getOrCreateStore (initialState) { // Always make a new store if server, otherwise state is shared between requests if (isServer) { - return initializeStore(initialState) + return initializeStore(initialState); } // Create store if unavailable on the client and set it on the window object if (!window[__NEXT_REDUX_STORE__]) { - window[__NEXT_REDUX_STORE__] = initializeStore(initialState) + window[__NEXT_REDUX_STORE__] = initializeStore(initialState); } - return window[__NEXT_REDUX_STORE__] + return window[__NEXT_REDUX_STORE__]; } export default (App) => { @@ -22,29 +22,29 @@ export default (App) => { static async getInitialProps (appContext) { // Get or Create the store with `undefined` as initialState // This allows you to set a custom default initialState - const reduxStore = getOrCreateStore() + const reduxStore = getOrCreateStore(); // Provide the store to getInitialProps of pages - appContext.ctx.reduxStore = reduxStore + appContext.ctx.reduxStore = reduxStore; - let appProps = {} + let appProps = {}; if (typeof App.getInitialProps === 'function') { - appProps = await App.getInitialProps(appContext) + appProps = await App.getInitialProps(appContext); } return { ...appProps, initialReduxState: reduxStore.getState() - } + }; } constructor (props) { - super(props) - this.reduxStore = getOrCreateStore(props.initialReduxState) + super(props); + this.reduxStore = getOrCreateStore(props.initialReduxState); } render () { - return + return ; } - } -} + }; +}; diff --git a/next.config.js b/next.config.js index f8bd78a..f332296 100644 --- a/next.config.js +++ b/next.config.js @@ -1,3 +1,3 @@ -const withCSS = require('@zeit/next-css') -module.exports = withCSS() \ No newline at end of file +const withCSS = require('@zeit/next-css'); +module.exports = withCSS(); \ No newline at end of file diff --git a/pages/_app.js b/pages/_app.js index 9edc4f4..3bf91cd 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -1,25 +1,25 @@ -import App, {Container} from 'next/app' -import React from 'react' -import { Provider } from 'react-redux' -import withReduxStore from '../js/redux/reduxStoreBinder' -import { verifyCredentials } from '../js/api' +import App, {Container} from 'next/app'; +import React from 'react'; +import { Provider } from 'react-redux'; +import withReduxStore from '../js/redux/reduxStoreBinder'; +import { verifyCredentials } from '../js/api'; class TurniereApp extends App { - componentDidMount() { - verifyCredentials(); - } + componentDidMount() { + verifyCredentials(); + } - render () { - const {Component, pageProps, reduxStore} = this.props - return ( - - - - - - ) - } + render () { + const {Component, pageProps, reduxStore} = this.props; + return ( + + + + + + ); + } } -export default withReduxStore(TurniereApp) +export default withReduxStore(TurniereApp); diff --git a/pages/_error.js b/pages/_error.js index 300cb4a..202f1ca 100644 --- a/pages/_error.js +++ b/pages/_error.js @@ -1,15 +1,15 @@ -import Head from 'next/head' -import React from 'react' -import {Footer, TurniereNavigation} from "../js/CommonComponents"; +import Head from 'next/head'; +import React from 'react'; +import {Footer, TurniereNavigation} from '../js/CommonComponents'; import 'bootstrap/dist/css/bootstrap.min.css'; -import {Container} from "reactstrap"; -import '../static/everypage.css' -import '../static/css/error.css' +import {Container} from 'reactstrap'; +import '../static/everypage.css'; +import '../static/css/error.css'; export default class Error extends React.Component { static getInitialProps({ res, err }) { const statusCode = res ? res.statusCode : err ? err.statusCode : 400; - return { statusCode } + return { statusCode }; } render() { @@ -22,7 +22,7 @@ export default class Error extends React.Component {