2018-01-29 20:47:12 +01:00
import React from 'react' ;
2018-02-02 23:24:46 +01:00
import { withRouter } from 'react-router-dom' ;
2018-02-23 03:05:00 +01:00
import Helmet from 'react-helmet' ;
2018-01-29 20:47:12 +01:00
import NavBar from 'containers/NavBar' ;
2018-01-29 21:44:46 +01:00
import ChannelLoginForm from 'containers/ChannelLoginForm' ;
import ChannelCreateForm from 'containers/ChannelCreateForm' ;
2018-01-29 20:47:12 +01:00
2018-02-23 03:05:00 +01:00
const { site : { title , host } } = require ( '../../../config/speechConfig.js' ) ;
class LoginPage extends React . Component {
2018-02-02 23:24:46 +01:00
componentWillReceiveProps ( newProps ) {
// re-route the user to the homepage if the user is logged in
if ( newProps . loggedInChannelName !== this . props . loggedInChannelName ) {
console . log ( 'user logged into new channel:' , newProps . loggedInChannelName ) ;
this . props . history . push ( ` / ` ) ;
}
}
2018-01-29 20:47:12 +01:00
render ( ) {
return (
< div >
2018-02-23 03:05:00 +01:00
< Helmet >
< title > { title } - Login < / title >
< link rel = 'canonical' href = { ` ${ host } /login ` } / >
< / Helmet >
< NavBar / >
< div className = 'row row--padded' >
< div className = 'column column--5 column--med-10 align-content-top' >
< div className = 'column column--8 column--med-10' >
< p > Channels allow you to publish and group content under an identity . You can create a channel for yourself , or share one with like - minded friends . You can create 1 channel , or 100 , so whether you 're <a className=' link -- primary ' target=' _blank ' href=' / @ catalonia2017 : 43 dcf47163caa21d8404d9fe9b30f78ef3e146a8 '>documenting important events</a>, or making a public repository for <a className=' link -- primary ' target=' _blank ' href=' / @ catGifs '>cat gifs</a> (password: ' 1234 ' ) , try creating a channel for it ! < / p >
< / div >
< / div > < div className = 'column column--5 column--med-10 align-content-top' >
< div className = 'column column--8 column--med-10' >
< h3 className = 'h3--no-bottom' > Log in to an existing channel : < / h3 >
< ChannelLoginForm / >
< h3 className = 'h3--no-bottom' > Create a brand new channel : < / h3 >
< ChannelCreateForm / >
2018-01-29 21:44:46 +01:00
< / div >
< / div >
< / div >
2018-01-29 20:47:12 +01:00
< / div >
) ;
}
} ;
2018-02-23 03:05:00 +01:00
export default withRouter ( LoginPage ) ;