diff --git a/client/package.json b/client/package.json index 3e764bdf9..32c519b93 100644 --- a/client/package.json +++ b/client/package.json @@ -1,7 +1,7 @@ { "name": "@advancedalgos/users-client", "description": "Advanced Algos Users client-side web app", - "version": "0.0.15", + "version": "0.0.16", "main": "src/index.js", "dependencies": { "@material-ui/core": "^3.2.0", diff --git a/client/src/components/Browse.js b/client/src/components/Browse.js index 2231b1f8b..7ee0100dd 100644 --- a/client/src/components/Browse.js +++ b/client/src/components/Browse.js @@ -1,14 +1,51 @@ -import React from 'react' +import React, { Component } from 'react' import UserList from './UserList' import CssBaseline from '@material-ui/core/CssBaseline' -const Browse = () => { - return ( - - - - - ) +class Browse extends Component { + + componentDidMount () { + window.dispatchEvent(new Event('load')) // This is a workaround to solve the problem that the slider does not show up + } + + render () { + return ( + + +
+
+
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    Users Directory

    +

    +
    Everyone involved in Advanced Algos is here. +

    +
    +
    +
    +
    +
    +
  • +
+
+
+
+
+
+ + +
+ ) + } } export default Browse diff --git a/client/src/components/Home.js b/client/src/components/Home.js index bb829f8dd..f9437e5d1 100644 --- a/client/src/components/Home.js +++ b/client/src/components/Home.js @@ -1,98 +1,52 @@ import React, { Component } from 'react' import { compose } from 'recompose' import { withStyles } from '@material-ui/core/styles' -import Grid from '@material-ui/core/Grid' -import Typography from '@material-ui/core/Typography' import CssBaseline from '@material-ui/core/CssBaseline' const styles = theme => ({ - root: { - flexGrow: 1, - padding: 100 - }, - grid: { - margin: theme.spacing.unit, - width: '50%' - }, - typography: { - width: '100%', - marginTop: 20, - marginBottom: 20 - }, - '@global': { - body: { - backgroundColor: theme.palette.common.white - } - }, - layout: { - width: 'auto', - marginLeft: theme.spacing.unit * 3, - marginRight: theme.spacing.unit * 3, - [theme.breakpoints.up(900 + theme.spacing.unit * 3 * 2)]: { - width: 900, - marginLeft: 'auto', - marginRight: 'auto' - } - }, - heroContent: { - maxWidth: 600, - margin: '0 auto', - padding: `${theme.spacing.unit * 8}px 0 ${theme.spacing.unit * 6}px` - } + }) class Home extends Component { + componentDidMount () { + window.dispatchEvent(new Event('load')) // This is a workaround to solve the problem that the slider does not show up + } + render () { const { classes } = this.props return ( - -
-
- - Collaborate. Innovate. Evolve. - - - Welcome to Advanced Algos Users Module - + +
+
+
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    Users Module

    +

    +
    Responsible for all human users of the Advanced Algos Platform. +

    +
    +
    +
    +
    +
    +
  • +
+
+
+
-
- - - - - Intro - - - This module is responsible for managing users across the Advanced Algos system. Here you can browse the Users Directory, search for users and get to their profiles. You can create your own User profile if you sign up, or manage it if you already have one by logging in. - - - Development Status - - - This module is is currently under development. Implementation started 1st of September 2018 and this is the result of the 3rd sprint of 2 weeks of work each. - - - What can you do? - - - Currently you can use the Browse section to list all registered users. At the Search page you can searh for users by name. Clicking on View Profile you can see some more info about that user. You can signup with your Github account and manage your profile information while logged in. While loggedin, you can edit your profile info, define your referrer and view your descendants. You will find all features under develpment with a dialog indicating it is not ready. - - - - - +
) diff --git a/client/src/components/LoggedInUser.js b/client/src/components/LoggedInUser.js index 933394e43..156ba0d17 100644 --- a/client/src/components/LoggedInUser.js +++ b/client/src/components/LoggedInUser.js @@ -11,6 +11,16 @@ import IconButton from '@material-ui/core/IconButton' import UserIcon from '@material-ui/icons/Person' import { Link } from 'react-router-dom' +import ProfileSheetIcon from '@material-ui/icons/Create' +import ProfileImagesIcon from '@material-ui/icons/Wallpaper' +import YourReferrerIcon from '@material-ui/icons/AccessibilityNew' +import DescendentsIcon from '@material-ui/icons/DeviceHub' + +const ProfileSheetLink = props => +const ProfileImagesLink = props => +const YourReferrerLink = props => +const YourDescendentsLink = props => + const UserLink = props => const styles = theme => ({ @@ -79,7 +89,7 @@ class LoggedInUser extends Component { let identityProvider = authArray[0] return ( -
+
  • -
  • + Your Profile + + + + ) } else { return ( @@ -114,9 +175,9 @@ class LoggedInUser extends Component { } return ( -
    + {this.displayLoggedInUser()} -
    + ) } } diff --git a/client/src/components/Menu.js b/client/src/components/Menu.js new file mode 100644 index 000000000..503e4ee34 --- /dev/null +++ b/client/src/components/Menu.js @@ -0,0 +1,142 @@ +import React, { Component } from 'react' +import PropTypes from 'prop-types' +import { withStyles } from '@material-ui/core/styles' +import classNames from 'classnames' +import AppBar from '@material-ui/core/AppBar' +import Toolbar from '@material-ui/core/Toolbar' +import Typography from '@material-ui/core/Typography' +import Button from '@material-ui/core/Button' + +// icons +import UsersIcon from '@material-ui/icons/People' +import BrowseIcon from '@material-ui/icons/ImportContacts' +import SearchIcon from '@material-ui/icons/Search' +import ContactIcon from '@material-ui/icons/ContactMail' +import BugReportIcon from '@material-ui/icons/BugReport' + +import { Link } from 'react-router-dom' + +// components +import LoggedInUser from './LoggedInUser' + +const HomeLink = props => +const BrowseLink = props => +const SearchLink = props => + +const styles = theme => ({ + cssRoot: { + color: '#FFFFFF', + backgroundColor: theme.palette.secondary, + '&:hover': { + backgroundColor: theme.palette.dark + }, + whiteSpace: 'nowrap', + paddingRight: 2 * theme.spacing.unit, + paddingLeft: 2 * theme.spacing.unit + }, + button: { + margin: theme.spacing.unit + }, + leftIcon: { + marginRight: theme.spacing.unit + }, + iconSmall: { + fontSize: 20 + } +}) + +class Menu extends Component { + + constructor (props) { + super(props) + this.state = { + authId: null + } + } + + componentDidMount () { + let user = localStorage.getItem('user') + let authId + + if (user !== null && user !== undefined && user !== 'undefined') { + user = JSON.parse(user) + authId = user.authId + } + + if (authId !== null && authId !== undefined && authId !== 'undefined') { + this.setState({ authId: authId }) + } + } + + render () { + const { classes, user } = this.props + const match = { + url: '/users' + } + + return ( + + ) + } +} + +Menu.propTypes = { + classes: PropTypes.object.isRequired, + user: PropTypes.object, + match: PropTypes.object +} + +export default withStyles(styles)(Menu) diff --git a/client/src/components/ProfileImages.js b/client/src/components/ProfileImages.js index 268efeaee..8e5c100e6 100644 --- a/client/src/components/ProfileImages.js +++ b/client/src/components/ProfileImages.js @@ -1,52 +1,58 @@ -import React from 'react' -import Button from '@material-ui/core/Button' -import Dialog from '@material-ui/core/Dialog' -import DialogActions from '@material-ui/core/DialogActions' -import DialogContent from '@material-ui/core/DialogContent' -import DialogContentText from '@material-ui/core/DialogContentText' -import DialogTitle from '@material-ui/core/DialogTitle' +import React, { Component } from 'react' +import { compose } from 'recompose' +import { withStyles } from '@material-ui/core/styles' import CssBaseline from '@material-ui/core/CssBaseline' -class Contact extends React.Component { - state = { - open: true - } +const styles = theme => ({ - handleClickOpen = () => { - this.setState({ open: true }) - } +}) - handleClose = () => { - this.setState({ open: false }) +class ProfileImages extends Component { + + componentDidMount () { + window.dispatchEvent(new Event('load')) // This is a workaround to solve the problem that the slider does not show up } render () { + const { classes } = this.props return ( - - - - - {"Section under development."} - - - - The functionality of this section has not been developed yet. We expect to have it for November 2018. Thanks for your understanding. - - - - - - + +
    +
    +
    +
    +
    +
      +
    • + +
      +
      +
      +
      +
      +

      Profile Images

      +

      +
      Comming Soon. +

      +
      +
      +
      +
      +
      +
    • +
    +
    +
    +
    +
    +
    + ) } } -export default Contact +export default compose( + withStyles(styles) +)(ProfileImages) diff --git a/client/src/components/ProfileSheet.js b/client/src/components/ProfileSheet.js index b603fa224..4bc2eb00e 100644 --- a/client/src/components/ProfileSheet.js +++ b/client/src/components/ProfileSheet.js @@ -31,7 +31,8 @@ const styles = theme => ({ flexGrow: 1, padding: 10, marginLeft: '25%', - marginTop: '2%' + marginTop: '5%', + marginBottom: '10%' }, inputField: { width: '80%', @@ -312,18 +313,54 @@ class ProfileSheet extends Component { } } - render () { + componentDidMount () { + window.dispatchEvent(new Event('load')) // This is a workaround to solve the problem that the slider does not show up + } + + addSlider () { + return ( +
    +
    +
    +
    +
    +
      +
    • + +
      +
      +
      +
      +
      +

      Profile Sheet

      +

      +
      Manage here your basic profile info. +

      +
      +
      +
      +
      +
      +
    • +
    +
    +
    +
    +
    +
    + ) + } + + addForm () { const { classes } = this.props return ( - - Profile Sheet - +
    - Use this form to control the information you keep at the Advanced Algos system about yourself. - + Use this form to control the information you keep at the Advanced Algos system about yourself. + @@ -332,8 +369,8 @@ class ProfileSheet extends Component { - This is your basic information we have gotten from the identity provider you used to sign up. This information can not be changed. - + This is your basic information we have gotten from the identity provider you used to sign up. This information can not be changed. + - } + /> + } label='Email Verified' - /> + /> @@ -371,8 +408,8 @@ class ProfileSheet extends Component { - Complete your profile with the following optional information. Providing your real name might help other users trust you more. - + Complete your profile with the following optional information. Providing your real name might help other users trust you more. + + /> + /> + /> - If you wish, you can add a short paragraph with your Bio or anything you would like to communicate to whoever finds your user profile. - + If you wish, you can add a short paragraph with your Bio or anything you would like to communicate to whoever finds your user profile. + + /> - Check the following options to enable specialized tools designed for each role. You can allways come back and change these settings later. - + Check the following options to enable specialized tools designed for each role. You can allways come back and change these settings later. + @@ -433,10 +470,10 @@ class ProfileSheet extends Component { onChange={this.handleCheckBoxes.bind(this)} checked={this.rightCheckboxValue(this.state.isDeveloper)} color='secondary' - /> - } + /> + } label='Developer' - /> + /> - } + /> + } label='Trader' - /> + /> - } + /> + } label='Data Analyst' - /> + /> @@ -473,8 +510,8 @@ class ProfileSheet extends Component { - Current Role - + Current Role + Select from the list your current role @@ -498,12 +535,19 @@ class ProfileSheet extends Component { className={classes.button} onClick={this.submitForm.bind(this)} disabled={this.state.updated} - >{this.displayButtonTitle()} + >{this.displayButtonTitle()}
    - + ) + } + render () { + return ( + + {this.addSlider()} + {this.addForm()} + ) } } diff --git a/client/src/components/Search.js b/client/src/components/Search.js index ae9d9562e..880c8ef09 100644 --- a/client/src/components/Search.js +++ b/client/src/components/Search.js @@ -14,7 +14,8 @@ const styles = theme => ({ flexGrow: 1, padding: 10, marginLeft: '25%', - marginTop: '2%' + marginTop: '5%', + marginBottom: '10%' } }) @@ -29,6 +30,35 @@ class Search extends Component { const { classes } = this.props return ( +
    +
    +
    +
    +
    +
      +
    • + +
      +
      +
      +
      +
      +

      Users Search

      +

      +
      Find anyone involved in Advanced Algos here. +

      +
      +
      +
      +
      +
      +
    • +
    +
    +
    +
    +
    +
    diff --git a/client/src/components/UserSearch.js b/client/src/components/UserSearch.js index 1cc71b62c..2520134b3 100644 --- a/client/src/components/UserSearch.js +++ b/client/src/components/UserSearch.js @@ -196,13 +196,18 @@ class UserSearch extends Component { } } + componentDidMount () { + window.dispatchEvent(new Event('load')) // This is a workaround to solve the problem that the slider does not show up + } + render () { const { classes } = this.props return ( +
    - + Use any of these fileds to search for users. {this.selectText()} @@ -257,6 +262,7 @@ class UserSearch extends Component { {this.displayUsers()}
    + ) } } diff --git a/client/src/components/YourDescendents.js b/client/src/components/YourDescendents.js index dd5f4aec4..db03f60b7 100644 --- a/client/src/components/YourDescendents.js +++ b/client/src/components/YourDescendents.js @@ -17,7 +17,8 @@ const styles = theme => ({ flexGrow: 1, padding: 10, marginLeft: '25%', - marginTop: '2%' + marginTop: '5%', + marginBottom: '10%' }, typography: { width: '80%', @@ -59,14 +60,48 @@ class YourDescendents extends Component { } } - render () { - const { classes } = this.props + componentDidMount () { + window.dispatchEvent(new Event('load')) // This is a workaround to solve the problem that the slider does not show up + } + addSlider () { + return ( +
    +
    +
    +
    +
    +
      +
    • + +
      +
      +
      +
      +
      +

      Your Descendents

      +

      +
      Explore here generations of people that discovered Advanced Algos because of you. +

      +
      +
      +
      +
      +
      +
    • +
    +
    +
    +
    +
    +
    + ) + } + + addForm () { + const { classes } = this.props return ( - - Your Descendents - These are your decendents within the project. Your children referred you as the one who brought them to the project, while @@ -79,6 +114,15 @@ class YourDescendents extends Component { ) } + + render () { + return ( + + {this.addSlider()} + {this.addForm()} + + ) + } } export default compose( diff --git a/client/src/components/YourReferrer.js b/client/src/components/YourReferrer.js index 6a658ea4d..57ae6a3d2 100644 --- a/client/src/components/YourReferrer.js +++ b/client/src/components/YourReferrer.js @@ -19,7 +19,8 @@ const styles = theme => ({ flexGrow: 1, padding: 10, marginLeft: '25%', - marginTop: '2%' + marginTop: '5%', + marginBottom: '10%' }, typography: { width: '80%', @@ -125,18 +126,61 @@ class YourReferrer extends Component { } } - render () { + componentDidMount () { + window.dispatchEvent(new Event('load')) // This is a workaround to solve the problem that the slider does not show up + } + + addSlider () { + return ( +
    +
    +
    +
    +
    +
      +
    • + +
      +
      +
      +
      +
      +

      Your Referrer

      +

      +
      It is important to know who introduced you to Advanced Algos. +

      +
      +
      +
      +
      +
      +
    • +
    +
    +
    +
    +
    +
    + ) + } + + addForm () { const { classes } = this.props return ( - - Your Referrer - - {this.renderMode()} ) } + + render () { + return ( + + {this.addSlider()} + {this.addForm()} + + ) + } } export default compose( diff --git a/client/src/index.js b/client/src/index.js index 66f52879e..8594ffbef 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -6,12 +6,15 @@ import { hot } from 'react-hot-loader' import { withStyles } from '@material-ui/core/styles' // Components -import NavBar from './components/NavBar' import Home from './components/Home' import User from './components/User' import Browse from './components/Browse' import Search from './components/Search' -import Contact from './components/Contact' +import ProfileSheet from './components/ProfileSheet' +import ProfileImages from './components/ProfileImages' +import YourReferrer from './components/YourReferrer' +import YourDescendents from './components/YourDescendents' +import UsersMenu from './components/Menu' import { getItem } from './utils/local-storage' import { @@ -36,12 +39,10 @@ class App extends Component { } render () { - const { match } = this.props - + const match = {path: '/users'} return (
    - } /> - + } + /> + } + /> + } + /> + } + />
    @@ -77,4 +97,8 @@ App.propTypes = { } const StyledApp = withStyles(globalStyles)(App) +export { + StyledApp, + UsersMenu +} export default hot(module)(StyledApp)