diff --git a/README.md b/README.md index 76a35b66e..d148bc8e8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,2 @@ -![alt text](https://github.com/AdvancedAlgos/UsersModule/blob/master/image.png?raw=true "Screenshot") - - diff --git a/client/package.json b/client/package.json index 3e764bdf9..4782b912c 100644 --- a/client/package.json +++ b/client/package.json @@ -1,14 +1,14 @@ { "name": "@advancedalgos/users-client", "description": "Advanced Algos Users client-side web app", - "version": "0.0.15", + "version": "0.0.22", "main": "src/index.js", "dependencies": { "@material-ui/core": "^3.2.0", "@material-ui/icons": "^3.0.1", - "react": "^16.5.2", + "react": "^16.6.1", "react-apollo": "^2.2.4", - "react-dom": "^16.5.2", + "react-dom": "^16.6.1", "react-router-dom": "^4.3.1", "react-scripts": "^2.0.4", "graphql": "^14.0.2", diff --git a/client/src/components/BannerTopBar/index.js b/client/src/components/BannerTopBar/index.js new file mode 100644 index 000000000..255e9888d --- /dev/null +++ b/client/src/components/BannerTopBar/index.js @@ -0,0 +1,18 @@ +import React from 'react' +import Typography from '@material-ui/core/Typography' + +const BannerTopBar = ({ + size, + backgroundUrl, + title, + text +}) => ( +
+
+ {title} + {text} +
+
+) + +export default BannerTopBar diff --git a/client/src/components/Browse.js b/client/src/components/Browse.js index 2231b1f8b..000c8d4b7 100644 --- a/client/src/components/Browse.js +++ b/client/src/components/Browse.js @@ -1,14 +1,24 @@ -import React from 'react' +import React, { Component } from 'react' import UserList from './UserList' -import CssBaseline from '@material-ui/core/CssBaseline' +import BannerTopBar from './BannerTopBar' -const Browse = () => { - return ( - - - - - ) +class Browse extends Component { + + render () { + return ( + + +
+ +
+
+ ) + } } export default Browse diff --git a/client/src/components/Contact.js b/client/src/components/Contact.js deleted file mode 100644 index 268efeaee..000000000 --- a/client/src/components/Contact.js +++ /dev/null @@ -1,52 +0,0 @@ -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 CssBaseline from '@material-ui/core/CssBaseline' - -class Contact extends React.Component { - state = { - open: true - } - - handleClickOpen = () => { - this.setState({ open: true }) - } - - handleClose = () => { - this.setState({ open: false }) - } - - render () { - 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. - - - - - - - - ) - } -} - -export default Contact diff --git a/client/src/components/DescendentsTree.js b/client/src/components/DescendentsTree.js index 9a1cb06ea..8087cd192 100644 --- a/client/src/components/DescendentsTree.js +++ b/client/src/components/DescendentsTree.js @@ -25,7 +25,7 @@ import ExpandMore from '@material-ui/icons/ExpandMore'; import StarBorder from '@material-ui/icons/StarBorder'; // Images -import PortraitImage from '../img/portrait.jpg' +import UserDefaultPicture from '../img/user-default-pic.jpg' const styles = theme => ({ card: { @@ -132,7 +132,7 @@ class DescendentsTree extends Component { @@ -201,7 +201,7 @@ class DescendentsTree extends Component { diff --git a/client/src/components/Home.js b/client/src/components/Home.js index bb829f8dd..c584bbfea 100644 --- a/client/src/components/Home.js +++ b/client/src/components/Home.js @@ -1,104 +1,20 @@ 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` - } -}) +import BannerTopBar from './BannerTopBar' class Home extends Component { render () { - const { classes } = this.props return ( - -
-
- - Collaborate. Innovate. Evolve. - - - Welcome to Advanced Algos Users Module - -
-
- - - - - 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. - - - - - +
- ) } } -export default compose( - withStyles(styles) -)(Home) +export default Home 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/NavBar.js b/client/src/components/NavBar.js deleted file mode 100644 index 20fd77632..000000000 --- a/client/src/components/NavBar.js +++ /dev/null @@ -1,150 +0,0 @@ -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 => ({ - root: { - flexGrow: 1 - }, - flex: { - flexGrow: 1, - marginLeft: 30 - }, - menuButton: { - marginLeft: -12, - marginRight: 20 - }, - 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 - }, - rightIcon: { - marginLeft: theme.spacing.unit - }, - iconSmall: { - fontSize: 20 - } -}) - -class NavBar 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, match } = this.props - return ( -
    - - - - Users - - - - - - - - -
    - ) - } -} - -NavBar.propTypes = { - classes: PropTypes.object.isRequired, - user: PropTypes.object, - match: PropTypes.object -} - -export default withStyles(styles)(NavBar) - diff --git a/client/src/components/ProfileImages.js b/client/src/components/ProfileImages.js index 268efeaee..2a7788304 100644 --- a/client/src/components/ProfileImages.js +++ b/client/src/components/ProfileImages.js @@ -1,52 +1,42 @@ -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 CssBaseline from '@material-ui/core/CssBaseline' +import React, { Component } from 'react' +import { compose } from 'recompose' +import { withStyles } from '@material-ui/core/styles' +import Paper from '@material-ui/core/Paper' +import Typography from '@material-ui/core/Typography' -class Contact extends React.Component { - state = { - open: true +const styles = theme => ({ + root: { + width: '50%', + flexGrow: 1, + padding: 10, + marginLeft: '25%', + marginTop: '5%', + marginBottom: '10%' + }, + typography: { + width: '80%', + marginLeft: '10%', + marginTop: 40, + marginBottom: 40 } +}) - handleClickOpen = () => { - this.setState({ open: true }) - } - - handleClose = () => { - this.setState({ open: false }) - } +class ProfileImages extends Component { 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. - - - - - - + + + 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..3e75bc881 100644 --- a/client/src/components/ProfileSheet.js +++ b/client/src/components/ProfileSheet.js @@ -27,11 +27,11 @@ import AALogo from '../img/aa-logo.png' const styles = theme => ({ root: { - width: '50%', + width: '100%', flexGrow: 1, padding: 10, - marginLeft: '25%', - marginTop: '2%' + marginTop: '5%', + marginBottom: '10%' }, inputField: { width: '80%', @@ -312,19 +312,21 @@ class ProfileSheet extends Component { } } - render () { + addForm () { const { classes } = this.props return ( - - Profile Sheet - +
    - - Use this form to control the information you keep at the Advanced Algos system about yourself. + + Profile Sheet + + Use this form to control the information you keep at the Advanced Algos system about yourself. + + {this.displayIdentityProvider()} @@ -332,8 +334,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 +373,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 +435,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 +475,8 @@ class ProfileSheet extends Component { - Current Role - + Current Role + Select from the list your current role @@ -498,12 +500,20 @@ class ProfileSheet extends Component { className={classes.button} onClick={this.submitForm.bind(this)} disabled={this.state.updated} - >{this.displayButtonTitle()} + >{this.displayButtonTitle()}
    - + ) + } + render () { + return ( + +
    + {this.addForm()} +
    +
    ) } } diff --git a/client/src/components/Search.js b/client/src/components/Search.js index ae9d9562e..c2d6f0ab9 100644 --- a/client/src/components/Search.js +++ b/client/src/components/Search.js @@ -1,8 +1,8 @@ import React, { Component } from 'react' import UserSearch from './UserSearch' import {compose} from 'react-apollo' -import CssBaseline from '@material-ui/core/CssBaseline' import Paper from '@material-ui/core/Paper' +import BannerTopBar from './BannerTopBar' // Materia UI @@ -10,29 +10,31 @@ import { withStyles } from '@material-ui/core/styles' const styles = theme => ({ root: { - width: '50%', + width: '100%', flexGrow: 1, padding: 10, - marginLeft: '25%', - marginTop: '2%' + marginTop: '5%', + marginBottom: '10%' } }) class Search extends Component { - constructor (props) { - super(props) - this.state = { - } - } render () { const { classes } = this.props return ( - - - - + +
    + + + +
    ) } diff --git a/client/src/components/User.js b/client/src/components/User.js index 043f3ddaf..e4eb6976c 100644 --- a/client/src/components/User.js +++ b/client/src/components/User.js @@ -1,11 +1,16 @@ import React from 'react' import UserTabs from './UserTabs' -import CssBaseline from '@material-ui/core/CssBaseline' +import BannerTopBar from './BannerTopBar' const User = () => { return ( - + ) diff --git a/client/src/components/UserList.js b/client/src/components/UserList.js index 4e5751836..462ecd1b4 100644 --- a/client/src/components/UserList.js +++ b/client/src/components/UserList.js @@ -30,13 +30,13 @@ import Slide from '@material-ui/core/Slide'; import UserProfile from './UserProfile'; // Images -import PortraitImage from '../img/portrait.jpg' +import UserDefaultPicture from '../img/user-default-pic.jpg' const styles = theme => ({ root: { - flexGrow: 1, - padding: 60, - margin: 2, + paddingTop:30, + paddingBottom:30, + flexGrow: 1 }, card: { maxWidth: 345, @@ -108,7 +108,7 @@ class UserList extends Component { @@ -167,7 +167,7 @@ class UserList extends Component { const { classes } = this.props; return ( - + {this.displayUsers()} diff --git a/client/src/components/UserProfile.js b/client/src/components/UserProfile.js index 7efc09a8c..a94f23ba5 100644 --- a/client/src/components/UserProfile.js +++ b/client/src/components/UserProfile.js @@ -14,7 +14,7 @@ import Typography from '@material-ui/core/Typography' import Divider from '@material-ui/core/Divider' // Images -import PortraitImage from '../img/portrait.jpg' +import UserDefaultPicture from '../img/user-default-pic.jpg' const styles = theme => ({ root: { @@ -107,7 +107,7 @@ class UserProfile extends Component { diff --git a/client/src/components/UserSearch.js b/client/src/components/UserSearch.js index 1cc71b62c..ffc3334ce 100644 --- a/client/src/components/UserSearch.js +++ b/client/src/components/UserSearch.js @@ -17,7 +17,7 @@ import Grid from '@material-ui/core/Grid' import TextField from '@material-ui/core/TextField' // Images -import PortraitImage from '../img/portrait.jpg' +import UserDefaultPicture from '../img/user-default-pic.jpg' const styles = theme => ({ card: { @@ -170,7 +170,7 @@ class UserSearch extends Component { @@ -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/UserTabs.js b/client/src/components/UserTabs.js index 592bc8da9..7821ed19e 100644 --- a/client/src/components/UserTabs.js +++ b/client/src/components/UserTabs.js @@ -65,7 +65,7 @@ class UserTabs extends React.Component { fullWidth > } /> - } /> + } /> } /> } /> diff --git a/client/src/components/YourDescendents.js b/client/src/components/YourDescendents.js index dd5f4aec4..8427fb313 100644 --- a/client/src/components/YourDescendents.js +++ b/client/src/components/YourDescendents.js @@ -13,11 +13,11 @@ import DescendentsTree from './DescendentsTree' const styles = theme => ({ root: { - width: '50%', + width: '100%', flexGrow: 1, padding: 10, - marginLeft: '25%', - marginTop: '2%' + marginTop: '5%', + marginBottom: '10%' }, typography: { width: '80%', @@ -59,14 +59,14 @@ class YourDescendents extends Component { } } - render () { + addForm () { const { classes } = this.props - return ( - - Your Descendents - + + + Your Decendents + These are your decendents within the project. Your children referred you as the one who brought them to the project, while @@ -79,6 +79,16 @@ class YourDescendents extends Component { ) } + + render () { + return ( + +
    + {this.addForm()} +
    +
    + ) + } } export default compose( diff --git a/client/src/components/YourReferrer.js b/client/src/components/YourReferrer.js index 6a658ea4d..5b9865a89 100644 --- a/client/src/components/YourReferrer.js +++ b/client/src/components/YourReferrer.js @@ -15,11 +15,11 @@ import Typography from '@material-ui/core/Typography' const styles = theme => ({ root: { - width: '50%', + width: '100%', flexGrow: 1, padding: 10, - marginLeft: '25%', - marginTop: '2%' + marginTop: '5%', + marginBottom: '10%' }, typography: { width: '80%', @@ -125,18 +125,27 @@ class YourReferrer extends Component { } } - render () { + addForm () { const { classes } = this.props return ( - - Your Referrer - - + + Your Referrer + {this.renderMode()} ) } + + render () { + return ( + +
    + {this.addForm()} +
    +
    + ) + } } export default compose( diff --git a/client/src/img/portrait.jpg b/client/src/img/portrait.jpg deleted file mode 100644 index 2108ceee8..000000000 Binary files a/client/src/img/portrait.jpg and /dev/null differ diff --git a/client/src/img/user-default-pic.jpg b/client/src/img/user-default-pic.jpg new file mode 100644 index 000000000..4709ae9b1 Binary files /dev/null and b/client/src/img/user-default-pic.jpg differ diff --git a/client/src/index.js b/client/src/index.js index 66f52879e..c2f66af6d 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -1,80 +1,24 @@ -import React, { Component } from 'react' -import PropTypes from 'prop-types' -import { Route, BrowserRouter, Switch } from 'react-router-dom' -import { hot } from 'react-hot-loader' +import React from 'react' +import { Route, Switch } from 'react-router-dom' -import { withStyles } from '@material-ui/core/styles' +import { MuiPickersUtilsProvider } from 'material-ui-pickers' +import LuxonUtils from 'material-ui-pickers/utils/luxon-utils' -// 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 { getItem } from './utils/local-storage' -import { - globalStyles -} from './theme' +const App = () => ( + + + + + + + + +) -class App extends Component { - constructor (props) { - super(props) - this.state = { - user: null - } - } +export default App - async componentDidMount () { - let user = await getItem('user') - - if (user !== null && user !== undefined && user !== 'undefined') { - user = JSON.parse(user) - this.setState({ user: user }) - } - } - - render () { - const { match } = this.props - - return ( - -
    - - - - } - /> - } - /> - } - /> - } - /> - - -
    -
    - ) - } -} - -App.propTypes = { - auth: PropTypes.object -} - -const StyledApp = withStyles(globalStyles)(App) -export default hot(module)(StyledApp)