Create blank fullscreen page with header
This commit is contained in:
parent
ab7d6e93a6
commit
9e5ce9d1d6
|
|
@ -25,6 +25,15 @@ export function getStage(stageId, successCallback, errorCallback) {
|
||||||
.catch(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) {
|
function convertTournament(apiTournament) {
|
||||||
let groupStage = null;
|
let groupStage = null;
|
||||||
const playoffStages = [];
|
const playoffStages = [];
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,74 @@
|
||||||
import Head from 'next/head';
|
import Head from 'next/head';
|
||||||
import React from 'react';
|
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 (<div>
|
||||||
|
<FullscreenPageHeader title={props.tournamentMeta.name} code={props.tournamentMeta.code}/>
|
||||||
|
</div>);
|
||||||
|
}
|
||||||
|
|
||||||
|
function FullscreenPageHeader(props) {
|
||||||
|
return (<Navbar color='light' className='mb-4 border-bottom py-0'>
|
||||||
|
<NavItem className='font-weight-bold'>{props.levelName}</NavItem>
|
||||||
|
<NavbarBrand>{props.title}</NavbarBrand>
|
||||||
|
<NavItem className='text-secondary'>
|
||||||
|
Turnier-Code: <b className='text-primary text-monospace'>{props.code}</b>
|
||||||
|
</NavItem>
|
||||||
|
</Navbar>);
|
||||||
|
}
|
||||||
|
|
||||||
|
class Main extends React.Component {
|
||||||
static async getInitialProps({query}) {
|
static async getInitialProps({query}) {
|
||||||
return {query};
|
return {query};
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
constructor(props) {
|
||||||
return (<div>
|
super(props);
|
||||||
<Head>
|
|
||||||
<title>Turnie.re - Turnieranzeige (Vollbild)</title>
|
this.state = {
|
||||||
</Head>
|
tournamentMeta: null
|
||||||
<p>Turnieranzeige (Vollbild)</p>
|
};
|
||||||
<p>Code: {this.props.query.code}</p>
|
this.onTournamentRequestSuccess = this.onTournamentRequestSuccess.bind(this);
|
||||||
</div>);
|
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});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default FullscreenTournamentPage;
|
|
||||||
|
render() {
|
||||||
|
const {metaStatus, tournamentMeta} = this.state;
|
||||||
|
if (metaStatus === 200) {
|
||||||
|
return (<div>
|
||||||
|
<Head>
|
||||||
|
<title>{tournamentMeta.name}: turnie.re</title>
|
||||||
|
</Head>
|
||||||
|
<FullscreenPage tournamentMeta={tournamentMeta}/>
|
||||||
|
</div>);
|
||||||
|
} else {
|
||||||
|
return <ErrorPageComponent code={metaStatus}/>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Main;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
nav li {
|
||||||
|
list-style-type: none;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue