'use strict'; import React from 'react'; import { History } from 'react-router'; import WhitelabelActions from '../../../../../actions/whitelabel_actions'; import WhitelabelStore from '../../../../../stores/whitelabel_store'; import Button from 'react-bootstrap/lib/Button'; import LinkContainer from 'react-router-bootstrap/lib/LinkContainer'; import UserStore from '../../../../../stores/user_store'; import UserActions from '../../../../../actions/user_actions'; import { mergeOptions } from '../../../../../utils/general_utils'; import { getLangText } from '../../../../../utils/lang_utils'; let CylandLanding = React.createClass({ mixins: [History], getInitialState() { return mergeOptions( UserStore.getState(), WhitelabelStore.getState() ); }, componentDidMount() { UserStore.listen(this.onChange); UserActions.fetchCurrentUser(); WhitelabelStore.listen(this.onChange); WhitelabelActions.fetchWhitelabel(); }, componentWillUnmount() { UserStore.unlisten(this.onChange); WhitelabelStore.unlisten(this.onChange); }, 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, '/pieces'), 0); } }, render() { return (
{getLangText('Submissions to Cyland Archive are powered by')} ascribe

{getLangText('Existing ascribe user?')}

{getLangText('Do you need an account?')}

); } }); export default CylandLanding;