From 8858626d8edfd59316fddac84ba00ca1610325da Mon Sep 17 00:00:00 2001 From: Barry Low Date: Sun, 16 Sep 2018 23:50:19 -0700 Subject: [PATCH] Client: Manage Team Details Dialog --- .../dashboard/components/ManageTeamDetails.js | 94 +++++++++++++++++++ .../dashboard/components/ManageTeamEdit.js | 11 ++- .../components/ManageTeamsDetails.js | 89 ------------------ .../dashboard/components/ManageTeamsItem.js | 8 +- 4 files changed, 104 insertions(+), 98 deletions(-) create mode 100644 client/src/views/dashboard/components/ManageTeamDetails.js delete mode 100644 client/src/views/dashboard/components/ManageTeamsDetails.js diff --git a/client/src/views/dashboard/components/ManageTeamDetails.js b/client/src/views/dashboard/components/ManageTeamDetails.js new file mode 100644 index 000000000..b9420b564 --- /dev/null +++ b/client/src/views/dashboard/components/ManageTeamDetails.js @@ -0,0 +1,94 @@ +import React, { Component } from 'react' +import PropTypes from 'prop-types' + +import Button from '@material-ui/core/Button' +import DetailsIcon from '@material-ui/icons/Details' +import Dialog from '@material-ui/core/Dialog' +import DialogActions from '@material-ui/core/DialogActions' +import DialogContent from '@material-ui/core/DialogContent' +import DialogTitle from '@material-ui/core/DialogTitle' +import Typography from '@material-ui/core/Typography' + +export class ManageTeamDetails extends Component { + constructor (props) { + super(props) + + this.handleClickOpen = this.handleClickOpen.bind(this) + this.handleClose = this.handleClose.bind(this) + + this.state = { + open: false + } + } + + render () { + console.log(this.props.team) + const { name, members, profile, createdAt } = this.props.team + return ( +
+ + + {name} Team Details + + + {name} + + + {createdAt} + + + Motto: {profile.motto} + + + Description: {profile.description} + + + Members: {members.length} + + + Team Admin: + { + members.map(member => { + if (member.role === 'OWNER' || member.role === 'ADMIN') { + return member.member.alias + } + }) + } + + + + + + +
+ ) + } + + handleClickOpen () { + this.setState({ open: true }) + } + + handleClose () { + this.setState({ open: false }) + } +} + +ManageTeamDetails.propTypes = { + classes: PropTypes.object.isRequired, + team: PropTypes.any +} + +export default ManageTeamDetails diff --git a/client/src/views/dashboard/components/ManageTeamEdit.js b/client/src/views/dashboard/components/ManageTeamEdit.js index 6fc498144..92def9d44 100644 --- a/client/src/views/dashboard/components/ManageTeamEdit.js +++ b/client/src/views/dashboard/components/ManageTeamEdit.js @@ -28,11 +28,13 @@ export class ManageTeamEdit extends Component { this.handleClose = this.handleClose.bind(this) this.handleChange = this.handleChange.bind(this) this.handleSubmit = this.handleSubmit.bind(this) - + console.log('ManageTeamEdit', props.team) + const motto = props.team.profile.motto + const description = props.team.profile.description this.state = { open: false, - motto: '', - description: '' + motto: motto, + description: description } } @@ -155,7 +157,8 @@ export class ManageTeamEdit extends Component { ManageTeamEdit.propTypes = { classes: PropTypes.object.isRequired, slug: PropTypes.string.isRequired, - authId: PropTypes.string + authId: PropTypes.string, + team: PropTypes.object } export default withRouter(ManageTeamEdit) diff --git a/client/src/views/dashboard/components/ManageTeamsDetails.js b/client/src/views/dashboard/components/ManageTeamsDetails.js deleted file mode 100644 index 65a988215..000000000 --- a/client/src/views/dashboard/components/ManageTeamsDetails.js +++ /dev/null @@ -1,89 +0,0 @@ -import React from 'react' -import PropTypes from 'prop-types' - -import CssBaseline from '@material-ui/core/CssBaseline' -import Typography from '@material-ui/core/Typography' -import Paper from '@material-ui/core/Paper' -import { withStyles } from '@material-ui/core/styles' - -import { Link } from 'react-router-dom' - -const styles = theme => ({ - root: { - flexGrow: 1 - }, - '@global': { - body: { - backgroundColor: theme.palette.common.white - } - }, - layout: { - width: 'auto', - marginLeft: theme.spacing.unit * 3, - marginRight: theme.spacing.unit * 3, - marginBottom: theme.spacing.unit * 6, - [theme.breakpoints.up(900 + theme.spacing.unit * 3 * 2)]: { - width: 900, - marginLeft: 'auto', - marginRight: 'auto' - } - }, - paper: { - marginTop: theme.spacing.unit * 3, - marginBottom: theme.spacing.unit * 3, - padding: theme.spacing.unit * 2, - [theme.breakpoints.up(600 + theme.spacing.unit * 3 * 2)]: { - marginTop: theme.spacing.unit * 6, - marginBottom: theme.spacing.unit * 6, - padding: theme.spacing.unit * 3 - } - }, - heroContent: { - maxWidth: 600, - margin: '0 auto', - padding: `${theme.spacing.unit * 8}px 0 ${theme.spacing.unit * 6}px` - } -}) - -const ManageTeamsDetails = ({ classes, team }) => ( - - -
- -
- ← Back to all teams - - {team.name} - - - {team.createdAt} - - - Members: {team.members.length} - - - Team Admin: - { - team.members.map(member => { - if (member.role === 'OWNER' || member.role === 'ADMIN') { - return member.member.alias - } - }) - } - -
-
-
-
-) -ManageTeamsDetails.propTypes = { - classes: PropTypes.object.isRequired, - team: PropTypes.object.isRequired -} - -export default withStyles(styles)(ManageTeamsDetails) diff --git a/client/src/views/dashboard/components/ManageTeamsItem.js b/client/src/views/dashboard/components/ManageTeamsItem.js index f84fe3d40..8552bfaf5 100644 --- a/client/src/views/dashboard/components/ManageTeamsItem.js +++ b/client/src/views/dashboard/components/ManageTeamsItem.js @@ -6,9 +6,9 @@ import Card from '@material-ui/core/Card' import CardActions from '@material-ui/core/CardActions' import CardContent from '@material-ui/core/CardContent' import CardMedia from '@material-ui/core/CardMedia' -import Button from '@material-ui/core/Button' import Typography from '@material-ui/core/Typography' +import ManageTeamDetails from './ManageTeamDetails' import ManageTeamDelete from './ManageTeamDelete' import ManageTeamEdit from './ManageTeamEdit' @@ -30,10 +30,8 @@ export const ManageTeamsItem = ({ classes, team, authId }) => ( - - + +