diff --git a/js/redux/tournamentApi.js b/js/redux/tournamentApi.js index 84e1085..746a176 100644 --- a/js/redux/tournamentApi.js +++ b/js/redux/tournamentApi.js @@ -25,6 +25,15 @@ export function getStage(stageId, successCallback, errorCallback) { .catch(errorCallback); } +export function getTournamentMeta(tournamentId, successCallback, errorCallback) { + getRequest(getState(), '/tournaments/' + tournamentId + '?simple=true') + .then(response => { + successCallback(response.status, response.data); + }) + .catch(errorCallback); +} + + function convertTournament(apiTournament) { let groupStage = null; const playoffStages = []; diff --git a/pages/tournament-fullscreen.js b/pages/tournament-fullscreen.js index 3df8089..9f8b83e 100644 --- a/pages/tournament-fullscreen.js +++ b/pages/tournament-fullscreen.js @@ -1,20 +1,74 @@ import Head from 'next/head'; import React from 'react'; +import {ErrorPageComponent} from '../js/components/ErrorComponents'; +import 'bootstrap/dist/css/bootstrap.min.css'; +import '../static/css/everypage.css'; +import '../static/css/tournament-fullscreen.css'; +import {getTournamentMeta} from '../js/redux/tournamentApi'; +import {Navbar, NavbarBrand, NavItem} from 'reactstrap'; -class FullscreenTournamentPage extends React.Component { + +function FullscreenPage(props) { + return (
+ +
); +} + +function FullscreenPageHeader(props) { + return ( + {props.levelName} + {props.title} + + Turnier-Code: {props.code} + + ); +} + +class Main extends React.Component { static async getInitialProps({query}) { return {query}; } + constructor(props) { + super(props); + + this.state = { + tournamentMeta: null + }; + this.onTournamentRequestSuccess = this.onTournamentRequestSuccess.bind(this); + this.onTournamentRequestError = this.onTournamentRequestError.bind(this); + } + + componentDidMount() { + getTournamentMeta(this.props.query.code, this.onTournamentRequestSuccess, this.onTournamentRequestError); + } + + onTournamentRequestSuccess(requestStatus, tournament) { + this.setState({metaStatus: requestStatus, tournamentMeta: tournament}); + } + + onTournamentRequestError(error) { + if (error.response) { + this.setState({metaStatus: error.response.status}); + } else { + this.setState({metaStatus: -1}); + } + } + + render() { - return (
- - Turnie.re - Turnieranzeige (Vollbild) - -

Turnieranzeige (Vollbild)

-

Code: {this.props.query.code}

-
); + const {metaStatus, tournamentMeta} = this.state; + if (metaStatus === 200) { + return (
+ + {tournamentMeta.name}: turnie.re + + +
); + } else { + return ; + } } } -export default FullscreenTournamentPage; +export default Main; diff --git a/public/static/css/tournament-fullscreen.css b/public/static/css/tournament-fullscreen.css new file mode 100644 index 0000000..c606da3 --- /dev/null +++ b/public/static/css/tournament-fullscreen.css @@ -0,0 +1,3 @@ +nav li { + list-style-type: none; +}