diff --git a/client/src/index.js b/client/src/index.js index 366f95c98..51349a3b0 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -45,6 +45,11 @@ class App extends Component { path={`/teams/manage-teams`} render={props => } /> + } + /> } /> - + ) diff --git a/client/src/views/manage-teams/components/CreateTeamDialog.js b/client/src/views/manage-teams/components/CreateTeamDialog.js index a46652833..d99eaa966 100644 --- a/client/src/views/manage-teams/components/CreateTeamDialog.js +++ b/client/src/views/manage-teams/components/CreateTeamDialog.js @@ -3,6 +3,7 @@ import PropTypes from 'prop-types' import { Mutation } from 'react-apollo' import { withStyles } from '@material-ui/core/styles' +import Grid from '@material-ui/core/Grid' import Button from '@material-ui/core/Button' import AddIcon from '@material-ui/icons/Add' import TextField from '@material-ui/core/TextField' @@ -34,14 +35,8 @@ const styles = theme => ({ marginLeft: '20%', marginBottom: 10 }, - buttonRight: { - // position: 'absolute', - // right: '3em' - marginTop: '1em', - marginRight: 'auto', - marginLeft: 'auto', - display: 'block', - lineHeight: '1em' + buttonFab: { + backgroundColor: '#CCCCCC' } }) @@ -93,12 +88,12 @@ export class CreateTeamDialog extends Component { }) } return ( -
+
- + ) }} diff --git a/client/src/views/manage-teams/components/ManageTeamProfile.js b/client/src/views/manage-teams/components/ManageTeamProfile.js new file mode 100644 index 000000000..48c2acb5a --- /dev/null +++ b/client/src/views/manage-teams/components/ManageTeamProfile.js @@ -0,0 +1,170 @@ +import React, { Component } from 'react' +import PropTypes from 'prop-types' + +import Paper from '@material-ui/core/Paper' +import Grid from '@material-ui/core/Grid' +import Button from '@material-ui/core/Button' +import { withStyles } from '@material-ui/core/styles' + +import { Link } from 'react-router-dom' + +import ManageTeamProfileView from './ManageTeamProfileView' +import ManageTeamProfileEdit from './ManageTeamProfileEdit' + +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(800 + theme.spacing.unit * 3 * 2)]: { + width: 800, + marginLeft: 'auto', + marginRight: 'auto' + } + }, + paper: { + marginTop: 0, + marginBottom: theme.spacing.unit * 1, + padding: 0, + [theme.breakpoints.up(800 + theme.spacing.unit * 3 * 2)]: { + marginTop: theme.spacing.unit * 3, + marginBottom: theme.spacing.unit * 2, + padding: `0 0 ${theme.spacing.unit * 2}px` + } + }, + heroContent: { + maxWidth: 800, + margin: '0 auto', + padding: 0 + }, + teamContent: { + margin: `${theme.spacing.unit * 1}px ${theme.spacing.unit * 3}px 0 0` + }, + banner: { + maxWidth: '100%', + height: 'auto' + }, + avatar: { + maxWidth: 100, + height: 100, + margin: `${theme.spacing.unit * 1}px 0 0 ${theme.spacing.unit * 3}px ` + }, + profileButtons: { + width: '90%', + margin: `${theme.spacing.unit * 3}px auto 0`, + padding: `${theme.spacing.unit * 2}px ${theme.spacing.unit * 2}px 0`, + borderTop: '1px solid #CCCCCC' + } +}) + +export class ManageTeamProfile extends Component { + constructor (props) { + super(props) + + this.toggleEdit = this.toggleEdit.bind(this) + this.handleSave = this.handleSave.bind(this) + + this.state = { + edit: false, + save: false + } + } + + render () { + const { classes, team, slug, match } = this.props + + return ( +
+
+ +
+ {!this.state.edit && } + {this.state.edit && + this.toggleEdit} + /> + } + + {!this.state.edit && + + + + + + + + + } + {this.state.edit && + + + + + + + + + } + +
+
+
+
+ ) + } + + toggleEdit () { + this.setState({ edit: !this.state.edit }) + } + + handleSave () { + this.setState({ save: !this.state.edit }) + } +} + +ManageTeamProfile.propTypes = { + classes: PropTypes.object.isRequired, + team: PropTypes.object.isRequired, + match: PropTypes.object.isRequired, + slug: PropTypes.string.isRequired +} + +export default withStyles(styles)(ManageTeamProfile) diff --git a/client/src/views/manage-teams/components/ManageTeamProfileEdit.js b/client/src/views/manage-teams/components/ManageTeamProfileEdit.js new file mode 100644 index 000000000..269d098c2 --- /dev/null +++ b/client/src/views/manage-teams/components/ManageTeamProfileEdit.js @@ -0,0 +1,336 @@ +import React, { Component } from 'react' +import PropTypes from 'prop-types' +import { Mutation } from 'react-apollo' +import { withStyles } from '@material-ui/core/styles' + +import Grid from '@material-ui/core/Grid' +import TextField from '@material-ui/core/TextField' +import Typography from '@material-ui/core/Typography' + +import { ImageUpload } from '@advancedalgos/web-components' + +import UPDATE_TEAM_PROFILE from '../../../graphql/teams/UpdateTeamProfileMutation' +import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery' + +import { checkGraphQLError } from '../../../utils/graphql-errors' +import log from '../../../utils/log' + +const styles = theme => ({ + root: { + flexGrow: 1 + }, + '@global': { + body: { + backgroundColor: theme.palette.common.white + } + }, + layout: { + width: '100%', + marginBottom: theme.spacing.unit * 6, + [theme.breakpoints.up(800 + theme.spacing.unit * 3 * 2)]: { + width: 800, + marginLeft: 'auto', + marginRight: 'auto' + } + }, + paper: { + marginTop: 0, + marginBottom: theme.spacing.unit * 3, + padding: 0, + [theme.breakpoints.up(800 + theme.spacing.unit * 3 * 2)]: { + marginTop: theme.spacing.unit * 3, + marginBottom: theme.spacing.unit * 6, + padding: `0 0 ${theme.spacing.unit * 2}px` + } + }, + heroContent: { + maxWidth: 800, + margin: '0 auto', + padding: `0 0 ${theme.spacing.unit * 2}px` + }, + teamMeta: { + borderRight: '1px solid #CCCCCC', + margin: `${theme.spacing.unit * 3}px 0 0`, + paddingLeft: `${theme.spacing.unit * 2}px`, + textAlign: 'center' + }, + teamContent: { + '& h2': { + padding: `${theme.spacing.unit * 4}px ${theme.spacing.unit * 3}px ${theme.spacing.unit * 2}px` + }, + '& h4': { + padding: `0 ${theme.spacing.unit * 3}px 0` + }, + '& h6': { + padding: `${theme.spacing.unit * 2}px ${theme.spacing.unit * 3}px 0` + } + }, + editInput: { + padding: `0 ${theme.spacing.unit * 3}px ${theme.spacing.unit * 2}px`, + '& label': { + padding: `0 ${theme.spacing.unit * 3}px 0` + } + }, + banner: { + maxWidth: '100%', + height: 'auto', + width: '100%' + }, + avatar: { + maxWidth: 125, + height: 125, + margin: `0 auto ${theme.spacing.unit * 2}px`, + verticalAlign: 'middle', + borderRadius: '50%' + } +}) + +export class ManageTeamEdit extends Component { + constructor (props) { + super(props) + + this.handleClickOpen = this.handleClickOpen.bind(this) + this.handleClose = this.handleClose.bind(this) + this.handleChange = this.handleChange.bind(this) + this.handleSubmit = this.handleSubmit.bind(this) + this.handleAvatar = this.handleAvatar.bind(this) + this.handleBanner = this.handleBanner.bind(this) + + log.debug('ManageTeamEdit', props.team) + const motto = props.team.profile.motto || '' + const description = props.team.profile.description || '' + const avatar = props.team.profile.avatar || null + const banner = props.team.profile.banner || null + + this.state = { + open: false, + motto: motto, + description: description, + avatar: avatar, + banner: banner + } + } + + render () { + const { classes, team, match, save, handleUpdate } = this.props + log.debug('ManageTeamEdit ', this.props, this.props.slug, this.props.team, match) + + const created = new Date(team.createdAt) + + return ( + + {(updateTeamProfile, { loading, error, data }) => { + const AzureStorageUrl = process.env.AZURE_STORAGE_URL_TEAMS + const AzureStorageSAS = process.env.AZURE_STORAGE_SAS_TEAMS + const containerName = team.slug + let avatar = null + if (this.state.avatar === null && team.profile !== null && (team.profile.avatar === undefined || team.profile.avatar === null)) avatar = 'https://aadevelop.blob.core.windows.net/module-teams/module-default/aa-avatar-default.png' + if (team.profile !== null && team.profile.avatar !== undefined && team.profile.avatar !== null) avatar = team.profile.avatar + if (this.state.avatar !== null) avatar = this.state.avatar + + let banner = null + if (this.state.banner === null && team.profile !== null && (team.profile.banner === undefined || team.profile.banner === null)) banner = 'https://aadevelop.blob.core.windows.net/module-teams/module-default/aa-banner-default.png' + if (team.profile !== null && team.profile.banner !== undefined && team.profile.banner !== null) banner = team.profile.banner + if (this.state.banner !== null) banner = this.state.banner + log.debug('team images: ', avatar, banner) + + if (save) { + this.handleSubmit(updateTeamProfile, team.slug, handleUpdate) + } + + let errors + let loader + if (loading) { + loader = ( + Submitting team... + ) + } + if (error) { + errors = error.graphQLErrors.map(({ message }, i) => { + const displayMessage = checkGraphQLError(message) + log.debug('updateTeamProfile error:', displayMessage) + return ( + + {message} + + ) + }) + } + return ( + + + + + + + + Members: {team.members.length} + + + Financial Beings: 1 + + + Created: {created.toLocaleDateString()} + + + + + + + {team.name} + + + Motto: + + + + Description: + + + + + {loader} + {errors} + + + ) + }} + + ) + } + + handleClickOpen () { + this.setState({ open: true }) + } + + handleClose () { + this.setState({ open: false }) + } + + handleChange (e) { + switch (e.target.id) { + case 'motto': + this.setState({ motto: e.target.value }) + break + case 'description': + this.setState({ description: e.target.value }) + break + default: + } + } + + handleAvatar (avatarUrl) { + log.debug('handleAvatar: ', avatarUrl) + this.setState({ avatar: `${avatarUrl}?${Math.random()}` }) + } + + handleBanner (bannerUrl) { + log.debug('handleBanner: ', bannerUrl) + this.setState({ banner: `${bannerUrl}?${Math.random()}` }) + } + + async handleSubmit (updateTeamProfile, slug, handleUpdate) { + log.debug('handleSubmit: ', this.state) + + await updateTeamProfile({ + variables: { + slug, + owner: this.authId, + description: this.state.description, + motto: this.state.motto, + avatar: this.state.avatar, + banner: this.state.banner + } + }) + window.canvasApp.eventHandler.raiseEvent('User Profile Changed') + this.setState({ description: '', motto: '', open: false }) + handleUpdate() + } +} + +ManageTeamEdit.propTypes = { + classes: PropTypes.object.isRequired, + slug: PropTypes.string.isRequired, + team: PropTypes.object, + match: PropTypes.object, + save: PropTypes.bool, + handleUpdate: PropTypes.func +} + +export default withStyles(styles)(ManageTeamEdit) diff --git a/client/src/views/manage-teams/components/ManageTeamProfileView.js b/client/src/views/manage-teams/components/ManageTeamProfileView.js new file mode 100644 index 000000000..ef64986dc --- /dev/null +++ b/client/src/views/manage-teams/components/ManageTeamProfileView.js @@ -0,0 +1,133 @@ +import React from 'react' +import PropTypes from 'prop-types' + +import Typography from '@material-ui/core/Typography' +import Grid from '@material-ui/core/Grid' +import { withStyles } from '@material-ui/core/styles' + +const styles = theme => ({ + root: { + flexGrow: 1 + }, + '@global': { + body: { + backgroundColor: theme.palette.common.white + } + }, + layout: { + width: '100%', + marginBottom: theme.spacing.unit * 6, + [theme.breakpoints.up(800 + theme.spacing.unit * 3 * 2)]: { + width: 800, + marginLeft: 'auto', + marginRight: 'auto' + } + }, + paper: { + marginTop: 0, + marginBottom: theme.spacing.unit * 3, + padding: 0, + [theme.breakpoints.up(800 + theme.spacing.unit * 3 * 2)]: { + marginTop: theme.spacing.unit * 3, + marginBottom: theme.spacing.unit * 6, + padding: `0 0 ${theme.spacing.unit * 2}px` + } + }, + heroContent: { + maxWidth: 800, + margin: '0 auto', + padding: `0 0 ${theme.spacing.unit * 2}px` + }, + teamMeta: { + borderRight: '1px solid #CCCCCC', + margin: `${theme.spacing.unit * 3}px 0 0`, + paddingLeft: `${theme.spacing.unit * 2}px`, + textAlign: 'center' + }, + teamContent: { + '& h2': { + padding: `${theme.spacing.unit * 4}px ${theme.spacing.unit * 3}px ${theme.spacing.unit * 2}px` + }, + '& h4': { + padding: `0 ${theme.spacing.unit * 3}px ${theme.spacing.unit * 2}px` + }, + '& h6': { + padding: `0 ${theme.spacing.unit * 3}px 0` + } + }, + banner: { + maxWidth: '100%', + height: 'auto', + width: '100%' + }, + avatar: { + maxWidth: 125, + height: 125, + margin: `0 auto ${theme.spacing.unit * 2}px`, + verticalAlign: 'middle', + borderRadius: '50%' + }, + backLink: { + display: 'block', + textDecoration: 'none', + margin: `${theme.spacing.unit * 3}px 0 0`, + color: theme.palette.secondary.main + } +}) + +const ManageTeamProfileView = ({ classes, team }) => { + let avatar = team.profile.avatar || 'https://aadevelop.blob.core.windows.net/module-teams/module-default/aa-avatar-default.png' + let banner = team.profile.banner || 'https://aadevelop.blob.core.windows.net/module-teams/module-default/aa-banner-default.png' + + const created = new Date(team.createdAt) + + return ( + + {team.name} + + + + {team.name} + + Members: {team.members.length} + + + Financial Beings: 1 + + + Created: {created.toLocaleDateString()} + + + + + + + {team.name} + + + Motto: {team.profile.motto} + + + Description: {team.profile.description} + + + + + + ) +} + +ManageTeamProfileView.propTypes = { + classes: PropTypes.object.isRequired, + team: PropTypes.object.isRequired +} + +export default withStyles(styles)(ManageTeamProfileView) diff --git a/client/src/views/manage-teams/components/ManageTeamsCreateTeam.js b/client/src/views/manage-teams/components/ManageTeamsCreateTeam.js new file mode 100644 index 000000000..967bd3ae1 --- /dev/null +++ b/client/src/views/manage-teams/components/ManageTeamsCreateTeam.js @@ -0,0 +1,121 @@ +import React, { Component } from 'react' +import PropTypes from 'prop-types' + +import Paper from '@material-ui/core/Paper' +import Grid from '@material-ui/core/Grid' +import Button from '@material-ui/core/Button' +import { withStyles } from '@material-ui/core/styles' + +import { Link } from 'react-router-dom' + +import CreateTeamForm from './CreateTeamForm' + +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(800 + theme.spacing.unit * 3 * 2)]: { + width: 800, + marginLeft: 'auto', + marginRight: 'auto' + } + }, + paper: { + marginTop: 0, + marginBottom: theme.spacing.unit * 3, + padding: 0, + [theme.breakpoints.up(800 + theme.spacing.unit * 3 * 2)]: { + marginTop: theme.spacing.unit * 3, + marginBottom: theme.spacing.unit * 6, + padding: `0 0 ${theme.spacing.unit * 6}px` + } + }, + heroContent: { + maxWidth: 800, + margin: '0 auto', + padding: 0 + }, + teamContent: { + margin: `${theme.spacing.unit * 1}px ${theme.spacing.unit * 3}px 0 0` + }, + banner: { + maxWidth: '100%', + height: 'auto' + }, + avatar: { + maxWidth: 100, + height: 100, + margin: `${theme.spacing.unit * 1}px 0 0 ${theme.spacing.unit * 3}px ` + }, + backLink: { + display: 'block', + textDecoration: 'none', + margin: `${theme.spacing.unit * 3}px 0 0`, + color: theme.palette.secondary.main + } +}) + +export class ManageTeamProfile extends Component { + constructor (props) { + super(props) + + this.toggleEdit = this.toggleEdit.bind(this) + this.handleSave = this.handleSave.bind(this) + + this.state = { + edit: false, + save: false + } + } + + render () { + const { classes, team, slug, match } = this.props + + return ( +
+ + + + + You don’t have any teams. Create one! + + + To begin developing on the Advanced Algos platform, as well as participate in Algobot competitions, + you'll need to create a team. A default trading algobot will be cloned and added to your team so + that you can begin experimenting right away. + + + + + +
+ ) + } + + toggleEdit () { + this.setState({ edit: !this.state.edit }) + } + + handleSave () { + this.setState({ save: !this.state.edit }) + } +} + +ManageTeamProfile.propTypes = { + classes: PropTypes.object.isRequired, + team: PropTypes.object.isRequired, + match: PropTypes.object.isRequired, + slug: PropTypes.string.isRequired +} + +export default withStyles(styles)(ManageTeamProfile) diff --git a/client/src/views/manage-teams/components/ManageTeamsItem.js b/client/src/views/manage-teams/components/ManageTeamsItem.js index a4522a4d3..7ec8dc9f7 100644 --- a/client/src/views/manage-teams/components/ManageTeamsItem.js +++ b/client/src/views/manage-teams/components/ManageTeamsItem.js @@ -7,14 +7,16 @@ import CardActions from '@material-ui/core/CardActions' import CardContent from '@material-ui/core/CardContent' import CardMedia from '@material-ui/core/CardMedia' import Typography from '@material-ui/core/Typography' +import Button from '@material-ui/core/Button' +import EditIcon from '@material-ui/icons/Edit' + +import { Link } from 'react-router-dom' -import ManageTeamDetails from './ManageTeamDetails' import ManageTeamDelete from './ManageTeamDelete' -import ManageTeamEdit from './ManageTeamEdit' import log from '../../../utils/log' -export const ManageTeamsItem = ({ classes, team, ...props }) => { +export const ManageTeamsItem = ({ classes, team, match, ...props }) => { log.debug('ManageTeamsItem', team, team.profile, team.profile.avatar) let avatar if (team.profile.avatar !== undefined && team.profile.avatar !== 'a') { @@ -36,13 +38,22 @@ export const ManageTeamsItem = ({ classes, team, ...props }) => { {team.name} - {team.createdAt} | Members: {team.members.length} + Members: {team.members.length} | Financial Beings: {1} - - - + + + + @@ -52,7 +63,8 @@ export const ManageTeamsItem = ({ classes, team, ...props }) => { ManageTeamsItem.propTypes = { classes: PropTypes.object.isRequired, - team: PropTypes.object.isRequired + team: PropTypes.object.isRequired, + match: PropTypes.object } export default ManageTeamsItem diff --git a/client/src/views/manage-teams/components/ManageTeamsList.js b/client/src/views/manage-teams/components/ManageTeamsList.js index 2975d6bc9..1c93dcaf8 100644 --- a/client/src/views/manage-teams/components/ManageTeamsList.js +++ b/client/src/views/manage-teams/components/ManageTeamsList.js @@ -5,20 +5,28 @@ import { Query } from 'react-apollo' import Grid from '@material-ui/core/Grid' import Paper from '@material-ui/core/Paper' import Typography from '@material-ui/core/Typography' -import Card from '@material-ui/core/Card' -import CardContent from '@material-ui/core/CardContent' import { MessageCard } from '@advancedalgos/web-components' import { withStyles } from '@material-ui/core/styles' +import { isEmpty } from '../../../utils/js-helpers' + import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery' import ManageTeamsItem from './ManageTeamsItem' +import ManageTeamProfile from './ManageTeamProfile' import CreateTeamForm from './CreateTeamForm' -import CreateTeamDialog from './CreateTeamDialog' import log from '../../../utils/log' const styles = theme => ({ + root: { + flexGrow: 1 + }, + heroContent: { + maxWidth: 800, + margin: `${theme.spacing.unit * 4}px auto`, + padding: 0 + }, cardGrid: { padding: `${theme.spacing.unit * 8}px 0` }, @@ -45,13 +53,15 @@ const styles = theme => ({ } }) -export const ManageTeamsList = ({ classes, user = null, ...props }) => ( +export const ManageTeamsList = ({ classes, match, ...props }) => ( {({ loading, error, data }) => { log.debug('GET_TEAMS_BY_OWNER: ', loading, error, data) + let slug = null + if (!isEmpty(match.params) && match.params.slug) slug = match.params.slug let errors = null if (error) { @@ -62,63 +72,77 @@ export const ManageTeamsList = ({ classes, user = null, ...props }) => ( if (!loading && !error) { if (data.teams_TeamsByOwner.length > 0) { return ( - - {!loading && - data.teams_TeamsByOwner.map(team => ( - - ))} - {errors} - - -
- - - -
-
-
-
+
+
+ + {!loading && + data.teams_TeamsByOwner.map(team => { + if (slug === team.slug) { + return ( + + ) + } else { + return ( + + ) + } + })} + {errors} + +
+
) } else { return ( - - - - - You don’t have any teams. Create one! - - - To begin developing on the Advanced Algos platform, as well as participate in Algobot competitions, - you'll need to create a team. A default trading algobot will be cloned and added to your team so - that you can begin experimenting right away. - - +
+ + + + + You don’t have any teams. Create one! + + + To begin developing on the Advanced Algos platform, as well as participate in Algobot competitions, + you'll need to create a team. A default trading algobot will be cloned and added to your team so + that you can begin experimenting right away. + + + - - + +
) } } else { return ( - - - {errors === null && - - Loading... - - } - {errors !== null && - - {errors} - - } +
+ + + {errors === null && + + Loading... + + } + {errors !== null && + + {errors} + + } + - +
) } }} @@ -127,7 +151,8 @@ export const ManageTeamsList = ({ classes, user = null, ...props }) => ( ManageTeamsList.propTypes = { user: PropTypes.any, - classes: PropTypes.object.isRequired + classes: PropTypes.object.isRequired, + match: PropTypes.object } export default withStyles(styles)(ManageTeamsList) diff --git a/client/src/views/manage-teams/index.js b/client/src/views/manage-teams/index.js index 82e0a6e1c..67c48f3ee 100644 --- a/client/src/views/manage-teams/index.js +++ b/client/src/views/manage-teams/index.js @@ -4,17 +4,23 @@ import PropTypes from 'prop-types' import { BannerTopBar } from '../common' import ManageTeamsList from './components/ManageTeamsList' -const ManageTeams = ({ classes, ...props }) => ( +const ManageTeams = ({ classes, match, ...props }) => (
- +
- +
) ManageTeams.propTypes = { - classes: PropTypes.object.isRequired + classes: PropTypes.object.isRequired, + match: PropTypes.object } export default ManageTeams diff --git a/client/src/views/teams/components/TeamsDetails.js b/client/src/views/teams/components/TeamsDetails.js index 6d1ec3c96..02418d3fd 100644 --- a/client/src/views/teams/components/TeamsDetails.js +++ b/client/src/views/teams/components/TeamsDetails.js @@ -1,7 +1,6 @@ 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 Grid from '@material-ui/core/Grid' @@ -19,9 +18,7 @@ const styles = theme => ({ } }, layout: { - width: 'auto', - marginLeft: theme.spacing.unit * 3, - marginRight: theme.spacing.unit * 3, + width: '100%', marginBottom: theme.spacing.unit * 6, [theme.breakpoints.up(800 + theme.spacing.unit * 3 * 2)]: { width: 800, @@ -36,25 +33,42 @@ const styles = theme => ({ [theme.breakpoints.up(800 + theme.spacing.unit * 3 * 2)]: { marginTop: theme.spacing.unit * 3, marginBottom: theme.spacing.unit * 6, - padding: `0 0 ${theme.spacing.unit * 6}px` + padding: `0 0 ${theme.spacing.unit * 2}px` } }, heroContent: { maxWidth: 800, margin: '0 auto', - padding: `0 0 ${theme.spacing.unit * 6}px` + padding: `0 0 ${theme.spacing.unit * 2}px` + }, + teamMeta: { + borderRight: '1px solid #CCCCCC', + margin: `${theme.spacing.unit * 3}px 0 0`, + paddingLeft: `${theme.spacing.unit * 2}px`, + textAlign: 'center' }, teamContent: { - margin: `${theme.spacing.unit * 1}px ${theme.spacing.unit * 3}px 0 0` + '& h2': { + padding: `${theme.spacing.unit * 4}px ${theme.spacing.unit * 3}px ${theme.spacing.unit * 2}px` + }, + '& h4': { + padding: `0 ${theme.spacing.unit * 3}px ${theme.spacing.unit * 2}px` + }, + '& h6': { + padding: `0 ${theme.spacing.unit * 3}px 0` + } }, banner: { maxWidth: '100%', - height: 'auto' + height: 'auto', + width: '100%' }, avatar: { - maxWidth: 100, - height: 100, - margin: `${theme.spacing.unit * 1}px 0 0 ${theme.spacing.unit * 3}px ` + maxWidth: 125, + height: 125, + margin: `0 auto ${theme.spacing.unit * 2}px`, + verticalAlign: 'middle', + borderRadius: '50%' }, backLink: { display: 'block', @@ -69,25 +83,38 @@ const TeamsDetails = ({ classes, team }) => { if (team.profile.avatar !== undefined && team.profile.avatar !== null) { avatar = team.profile.avatar } else { - avatar = 'data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%22288%22%20height%3D%22225%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20288%20225%22%20preserveAspectRatio%3D%22none%22%3E%3Cdefs%3E%3Cstyle%20type%3D%22text%2Fcss%22%3E%23holder_164edaf95ee%20text%20%7B%20fill%3A%23eceeef%3Bfont-weight%3Abold%3Bfont-family%3AArial%2C%20Helvetica%2C%20Open%20Sans%2C%20sans-serif%2C%20monospace%3Bfont-size%3A14pt%20%7D%20%3C%2Fstyle%3E%3C%2Fdefs%3E%3Cg%20id%3D%22holder_164edaf95ee%22%3E%3Crect%20width%3D%22288%22%20height%3D%22225%22%20fill%3D%22%2355595c%22%3E%3C%2Frect%3E%3Cg%3E%3Ctext%20x%3D%2296.32500076293945%22%20y%3D%22118.8%22%3EThumbnail%3C%2Ftext%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E' + avatar = 'https://aadevelop.blob.core.windows.net/module-teams/module-default/aa-avatar-default.png' } let banner if (team.profile.banner !== undefined && team.profile.banner !== null) { banner = team.profile.banner } else { - banner = 'data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%22288%22%20height%3D%22225%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20288%20225%22%20preserveAspectRatio%3D%22none%22%3E%3Cdefs%3E%3Cstyle%20type%3D%22text%2Fcss%22%3E%23holder_164edaf95ee%20text%20%7B%20fill%3A%23eceeef%3Bfont-weight%3Abold%3Bfont-family%3AArial%2C%20Helvetica%2C%20Open%20Sans%2C%20sans-serif%2C%20monospace%3Bfont-size%3A14pt%20%7D%20%3C%2Fstyle%3E%3C%2Fdefs%3E%3Cg%20id%3D%22holder_164edaf95ee%22%3E%3Crect%20width%3D%22288%22%20height%3D%22225%22%20fill%3D%22%2355595c%22%3E%3C%2Frect%3E%3Cg%3E%3Ctext%20x%3D%2296.32500076293945%22%20y%3D%22118.8%22%3EThumbnail%3C%2Ftext%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E' + banner = 'https://aadevelop.blob.core.windows.net/module-teams/module-default/aa-banner-default.png' } + + const created = new Date(team.createdAt) + return ( - - +
- ← Back to all teams + ← Back to all teams
{team.name} - {team.name} + + {team.name} + + Members: {team.members.length} + + + Financial Beings: 1 + + + Created: {created.toLocaleDateString()} + + @@ -98,25 +125,23 @@ const TeamsDetails = ({ classes, team }) => { > {team.name} - - {team.createdAt} - - + Motto: {team.profile.motto} - + Description: {team.profile.description} - - Members: {team.members.length} -
- +
) } TeamsDetails.propTypes = { diff --git a/client/src/views/teams/components/TeamsItem.js b/client/src/views/teams/components/TeamsItem.js index b0f22a411..767c9eb4f 100644 --- a/client/src/views/teams/components/TeamsItem.js +++ b/client/src/views/teams/components/TeamsItem.js @@ -4,14 +4,39 @@ import PropTypes from 'prop-types' import Grid from '@material-ui/core/Grid' import Card from '@material-ui/core/Card' import CardActionArea from '@material-ui/core/CardActionArea' -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 { withStyles } from '@material-ui/core/styles' import { Link } from 'react-router-dom' // const TeamDetailsLink = ({ teamSlug, ...props }) => + +const styles = theme => ({ + card: { + height: '100%', + display: 'flex', + flexDirection: 'column' + }, + cardMedia: { + paddingTop: '25%', // 16:9 + width: '100%' + }, + cardContent: { + flexGrow: 1 + }, + avatar: { + maxWidth: 65, + height: 65, + margin: '0 0.875em 0 0', + borderRadius: '50%', + verticalAlign: 'middle' + }, + buttonRight: { + textDecoration: 'none' + } +}) + export const TeamsItem = ({ classes, team }) => { let avatar if (team.profile.avatar !== undefined && team.profile.avatar !== 'a') { @@ -28,7 +53,7 @@ export const TeamsItem = ({ classes, team }) => { return ( - + { /> - + {team.name} - - {team.name} - - - Members: 1 - - - Now recruiting! - + + + + {team.name} + + + + + + + Members: 1 + + + + + Financial Beings: 1 + + + + + - - - - - ) @@ -70,4 +100,4 @@ TeamsItem.propTypes = { team: PropTypes.object.isRequired } -export default TeamsItem +export default withStyles(styles)(TeamsItem) diff --git a/client/src/views/teams/components/TeamsList.js b/client/src/views/teams/components/TeamsList.js index cefd21ed7..db813ea27 100644 --- a/client/src/views/teams/components/TeamsList.js +++ b/client/src/views/teams/components/TeamsList.js @@ -16,32 +16,8 @@ import TeamsItem from './TeamsItem' import TeamsDetails from './TeamsDetails' const styles = theme => ({ - heroContent: { - maxWidth: 600, - margin: '0 auto', - padding: `${theme.spacing.unit * 8}px 0 ${theme.spacing.unit * 6}px` - }, - cardGrid: { - padding: `${theme.spacing.unit * 8}px 0` - }, - card: { - height: '100%', - display: 'flex', - flexDirection: 'column' - }, - cardMedia: { - paddingTop: '25%' // 16:9 - }, - cardContent: { - flexGrow: 1 - }, - avatar: { - maxWidth: 50, - height: 50, - margin: '0 1em 1em 0' - }, - buttonRight: { - textDecoration: 'none' + teamListsContainer: { + margin: `${theme.spacing.unit * 3}px 0 ${theme.spacing.unit * 6}px` } }) @@ -67,7 +43,7 @@ export const TeamsList = ({ classes, match }) => ( if (data.teams_Teams.edges.length > 0) { if (slug !== null) { return ( - + {!loading && data.teams_Teams.edges.map(team => { if (team.node.slug === slug) { @@ -82,32 +58,31 @@ export const TeamsList = ({ classes, match }) => ( ) } else { return ( - - +
+ {!loading && data.teams_Teams.edges.map(team => ( ))} {queryLoader} {errors} - +
) } } else { return ( - + ) } } else { return ( - + {queryLoader} {errors}