diff --git a/src/client/app/components/Home.jsx b/src/client/app/components/Home.jsx index d390f21..6b8a0e8 100644 --- a/src/client/app/components/Home.jsx +++ b/src/client/app/components/Home.jsx @@ -1,22 +1,74 @@ import React, {Component} from 'react'; import ReactDOM from 'react-dom'; -import LogginForm from './LogginForm.jsx'; -import MenuAppBar from './MenuAppBar.jsx'; -import PropTypes from 'prop-types'; import Grid from 'material-ui/Grid'; +import LoginForm from './LoginForm.jsx'; +import MenuAppBar from './MenuAppBar.jsx'; +import RecordingCenter from './RecordingCenter.jsx'; + +const homeTitle = "Home"; +const recordingCenterTitle = "Recording Center"; + +function DisplayLoginForm(isLoggedIn, callback) { + return ( + + + + + + + + ) +} + +function DisplayRecordingCenter() { + return ( + + + + + + + + ) +}; class Home extends React.Component { + constructor(props){ + super(props); + this.state = { + isLoggedIn : false, + title: homeTitle, + }; + this.handdleUserLogin = this.handdleUserLogin.bind(this); + } + + handdleUserLogin(firstName, lastName) { + this.setState({ + isLoggedIn: true, + title: recordingCenterTitle, + }); + } + render() { + const isLoggedIn = this.state.isLoggedIn; + var externalGrid = 4 + var mainGrid = 4; + var display = + if (isLoggedIn) { + externalGrid = 2; + mainGrid = 8; + display = ; + } + return (
- -














+ - - - + + + {display} - +
); diff --git a/src/client/app/components/LogginForm.jsx b/src/client/app/components/LogginForm.jsx deleted file mode 100644 index 85ba41d..0000000 --- a/src/client/app/components/LogginForm.jsx +++ /dev/null @@ -1,91 +0,0 @@ -import React, {Component} from 'react'; -import ReactDOM from 'react-dom'; -import RecordingCenter from './RecordingCenter.jsx'; -import Button from 'material-ui/Button'; -import Input, { InputLabel } from 'material-ui/Input'; -import { FormControl, FormHelperText } from 'material-ui/Form'; -import Grid from 'material-ui/Grid'; -import Paper from 'material-ui/Paper'; - - -class LogginForm extends React.Component { - constructor(props){ - super(props); - this.state = { - id : null, - firstName : "", - lastName : "", - logginRedirection : false - }; - - this.handleInputChange = this.handleInputChange.bind(this); - this.handleSubmit = this.handleSubmit.bind(this); - } - - handleInputChange(event) { - const target = event.target; - - this.setState({ - [target.name]: target.value - }); - } - - - handleSubmit(event) { - // TODO Add validation form - console.log("handleSubmit"); - if (this.state.firstName.length > 2 && this.state.lastName.length > 2) { - this.setState({ - logginRedirection: true - }); - console.log("Form accepted => redirection enable"); - } - - event.preventDefault(); - } - - render() { - const { classes } = this.props; - if (this.state.logginRedirection) - return - else { - return ( - - - - - - Firstname - - - - - - - - - Lastname - - - - - - - - - - - - ); - } - } -} - -export default LogginForm; \ No newline at end of file diff --git a/src/client/app/components/LoginForm.jsx b/src/client/app/components/LoginForm.jsx new file mode 100644 index 0000000..3164559 --- /dev/null +++ b/src/client/app/components/LoginForm.jsx @@ -0,0 +1,88 @@ +import React, {Component} from 'react'; +import ReactDOM from 'react-dom'; +import Button from 'material-ui/Button'; +import Input, { InputLabel } from 'material-ui/Input'; +import { FormControl, FormHelperText } from 'material-ui/Form'; +import Grid from 'material-ui/Grid'; +import Paper from 'material-ui/Paper'; +import Send from 'material-ui-icons/Send'; + +const iconStyle = { + marginLeft: 4, +}; + + +class LoginForm extends React.Component { + constructor(props){ + super(props); + this.state = { + id: null, + firstName: "", + lastName: "", + isLoggedIn: this.props.isLoggedIn + }; + + this.handleInputChange = this.handleInputChange.bind(this); + this.handleSubmit = this.handleSubmit.bind(this); + } + + handleInputChange(event) { + const target = event.target; + + this.setState({ + [target.name]: target.value + }); + } + + + handleSubmit(event) { + // TODO Add validation form + if (this.state.firstName.length > 2 && this.state.lastName.length > 2) { + this.props.callback(this.state.firstName, this.state.lastName); + console.log("Form accepted => redirection enable"); + } + event.preventDefault(); + } + + render() { + return ( +
+ + + + + + Firstname + + + + + + + + + Lastname + + + + + + + + + + + +
+ ); + } +} + +export default LoginForm; \ No newline at end of file diff --git a/src/client/app/components/MenuAppBar.jsx b/src/client/app/components/MenuAppBar.jsx index 46e7d96..3864d95 100644 --- a/src/client/app/components/MenuAppBar.jsx +++ b/src/client/app/components/MenuAppBar.jsx @@ -57,7 +57,7 @@ class MenuAppBar extends React.Component { - Home + {this.props.title} {auth && (
@@ -90,6 +90,7 @@ class MenuAppBar extends React.Component { )} +














); }