2015-11-06 16:52:08 +01:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
import React from 'react';
|
2015-11-09 17:52:09 +01:00
|
|
|
import { Link, History } from 'react-router';
|
2015-11-06 16:52:08 +01:00
|
|
|
|
|
|
|
import Col from 'react-bootstrap/lib/Col';
|
|
|
|
import Row from 'react-bootstrap/lib/Row';
|
|
|
|
|
|
|
|
import PRRegisterPieceForm from './pr_forms/pr_register_piece_form';
|
|
|
|
|
|
|
|
import { getLangText } from '../../../../../utils/lang_utils';
|
2015-11-09 10:35:23 +01:00
|
|
|
import { setDocumentTitle } from '../../../../../utils/dom_utils';
|
2015-11-09 17:52:09 +01:00
|
|
|
import { getCookie } from '../../../../../utils/fetch_api_utils';
|
2015-11-06 16:52:08 +01:00
|
|
|
|
|
|
|
|
2015-11-09 10:35:23 +01:00
|
|
|
const { object } = React.PropTypes;
|
|
|
|
|
2015-11-06 16:52:08 +01:00
|
|
|
const PRRegisterPiece = React.createClass({
|
2015-11-09 10:35:23 +01:00
|
|
|
propTypes: {
|
2016-01-11 15:14:54 +01:00
|
|
|
// Provided from PrizeApp
|
2016-02-05 11:53:33 +01:00
|
|
|
currentUser: React.PropTypes.object.isRequired,
|
2016-01-11 15:14:54 +01:00
|
|
|
whitelabel: React.PropTypes.object,
|
|
|
|
|
2016-01-11 16:26:36 +01:00
|
|
|
// Provided from router
|
2015-11-09 10:35:23 +01:00
|
|
|
location: object
|
|
|
|
},
|
|
|
|
|
2015-11-09 17:52:09 +01:00
|
|
|
mixins: [History],
|
|
|
|
|
|
|
|
componentDidUpdate() {
|
2016-01-11 15:14:54 +01:00
|
|
|
const { currentUser } = this.props;
|
2016-02-05 11:53:33 +01:00
|
|
|
if (currentUser.email) {
|
2015-11-09 17:52:09 +01:00
|
|
|
const submittedPieceId = getCookie(currentUser.email);
|
2016-01-11 15:14:54 +01:00
|
|
|
if (submittedPieceId) {
|
2016-01-11 17:52:32 +01:00
|
|
|
this.history.push(`/pieces/${submittedPieceId}`);
|
2015-11-09 17:52:09 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2015-11-06 16:52:08 +01:00
|
|
|
render() {
|
2016-01-11 15:14:54 +01:00
|
|
|
const { currentUser, location } = this.props;
|
2015-11-09 10:35:23 +01:00
|
|
|
|
2015-11-10 17:35:57 +01:00
|
|
|
setDocumentTitle(getLangText('Submit to Portfolio Review'));
|
2016-01-11 15:14:54 +01:00
|
|
|
|
2015-11-06 16:52:08 +01:00
|
|
|
return (
|
|
|
|
<Row>
|
2015-11-09 10:35:23 +01:00
|
|
|
<Col xs={6}>
|
2015-11-11 16:27:50 +01:00
|
|
|
<div className="register-piece--info">
|
2015-11-06 16:52:08 +01:00
|
|
|
<h1>Portfolio Review</h1>
|
2015-12-22 10:36:05 +01:00
|
|
|
<h2>{getLangText('Submission closing on %s', ' 27 Dec 2015')}</h2>
|
2015-12-08 10:09:20 +01:00
|
|
|
<p>For more information, visit:
|
|
|
|
<a href="http://www.portfolio-review.de/submission/" target="_blank">
|
|
|
|
portfolio-review.de
|
|
|
|
</a>
|
|
|
|
</p>
|
2015-11-09 17:52:09 +01:00
|
|
|
<p style={{marginTop: '1em'}}>
|
|
|
|
{getLangText("You're submitting as %s. ", currentUser.email)}
|
|
|
|
<Link to="/logout">{getLangText('Change account?')}</Link>
|
|
|
|
</p>
|
2015-11-06 16:52:08 +01:00
|
|
|
</div>
|
|
|
|
</Col>
|
2015-11-09 10:35:23 +01:00
|
|
|
<Col xs={6}>
|
|
|
|
<PRRegisterPieceForm
|
2015-11-09 17:52:09 +01:00
|
|
|
location={location}
|
2016-01-11 15:14:54 +01:00
|
|
|
currentUser={currentUser} />
|
2015-11-06 16:52:08 +01:00
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-12-22 10:36:05 +01:00
|
|
|
export default PRRegisterPiece;
|