1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-24 10:16:29 +02:00
onion/js/components/whitelabel/wallet/components/cyland/cyland_landing.js

102 lines
3.6 KiB
JavaScript
Raw Normal View History

2015-08-19 13:54:45 +02:00
'use strict';
import React from 'react';
import { History } from 'react-router';
2015-08-19 13:54:45 +02:00
2015-08-19 14:48:22 +02:00
import WhitelabelActions from '../../../../../actions/whitelabel_actions';
import WhitelabelStore from '../../../../../stores/whitelabel_store';
2015-10-01 14:00:56 +02:00
import Button from 'react-bootstrap/lib/Button';
import LinkContainer from 'react-router-bootstrap/lib/LinkContainer';
2015-08-19 13:54:45 +02:00
import UserStore from '../../../../../stores/user_store';
import UserActions from '../../../../../actions/user_actions';
2015-11-03 10:39:01 +01:00
import AscribeSpinner from '../../../../ascribe_spinner';
2015-08-19 13:54:45 +02:00
import { mergeOptions } from '../../../../../utils/general_utils';
2015-08-24 11:22:44 +02:00
import { getLangText } from '../../../../../utils/lang_utils';
2015-10-13 17:29:53 +02:00
import { setDocumentTitle } from '../../../../../utils/dom_utils';
2015-08-19 13:54:45 +02:00
2015-11-03 10:39:01 +01:00
2015-08-19 13:54:45 +02:00
let CylandLanding = React.createClass({
mixins: [History],
2015-08-19 13:54:45 +02:00
getInitialState() {
return mergeOptions(
2015-08-19 14:48:22 +02:00
UserStore.getState(),
WhitelabelStore.getState()
2015-08-19 13:54:45 +02:00
);
},
componentDidMount() {
UserStore.listen(this.onChange);
UserActions.fetchCurrentUser();
2015-08-19 14:48:22 +02:00
WhitelabelStore.listen(this.onChange);
WhitelabelActions.fetchWhitelabel();
2015-08-19 13:54:45 +02:00
},
componentWillUnmount() {
UserStore.unlisten(this.onChange);
2015-08-19 14:48:22 +02:00
WhitelabelStore.unlisten(this.onChange);
2015-08-19 13:54:45 +02:00
},
onChange(state) {
this.setState(state);
// if user is already logged in, redirect him to piece list
if(this.state.currentUser && this.state.currentUser.email) {
// FIXME: hack to redirect out of the dispatch cycle
window.setTimeout(() => this.history.replaceState(null, '/collection'), 0);
2015-08-19 13:54:45 +02:00
}
},
render() {
2015-10-13 17:29:53 +02:00
setDocumentTitle('CYLAND MediaArtLab');
2015-08-19 13:54:45 +02:00
return (
<div className="container ascribe-form-wrapper cyland-landing">
2015-08-19 13:54:45 +02:00
<div className="row">
<div className="col-xs-12">
2015-08-19 14:48:22 +02:00
<div className="row" style={{border: '1px solid #CCC', padding: '2em'}}>
<img src={this.state.whitelabel.logo} width="400px"/>
<div style={{marginTop: '1em'}}>
2015-11-03 10:39:01 +01:00
{getLangText('Submissions to Cyland Archive are powered by') + ' '}
2015-08-19 14:48:22 +02:00
<span>
2015-11-03 10:39:01 +01:00
<span className="icon-ascribe-logo"></span>
2015-08-19 14:48:22 +02:00
</span>
</div>
2015-08-19 13:54:45 +02:00
</div>
2015-08-19 14:48:22 +02:00
<div className="row" style={{border: '1px solid #CCC', borderTop: 'none', padding: '2em'}}>
2015-08-19 13:54:45 +02:00
<div className="col-sm-6">
2015-08-19 14:48:22 +02:00
<p>
2015-08-24 11:22:44 +02:00
{getLangText('Existing ascribe user?')}
2015-08-19 14:48:22 +02:00
</p>
2015-10-01 14:00:56 +02:00
<LinkContainer to="/login">
<Button>
{getLangText('Log in')}
</Button>
</LinkContainer>
2015-08-19 13:54:45 +02:00
</div>
<div className="col-sm-6">
2015-08-19 14:48:22 +02:00
<p>
2015-08-24 11:22:44 +02:00
{getLangText('Do you need an account?')}
2015-08-19 14:48:22 +02:00
</p>
2015-10-01 14:00:56 +02:00
<LinkContainer to="/signup">
<Button>
{getLangText('Sign up')}
</Button>
</LinkContainer>
2015-08-19 13:54:45 +02:00
</div>
</div>
</div>
</div>
</div>
);
}
});
export default CylandLanding;