update display to handle backing of delegate

This commit is contained in:
Barry Gitarts 2019-05-13 10:06:51 -04:00 committed by Barry G
parent 5fd9c59654
commit e3312c9887
2 changed files with 6 additions and 5 deletions

View File

@ -188,10 +188,10 @@ class PersistentDrawerLeft extends React.Component {
<Route path="/funds-management" render={() => <FundsManagement open={open} />} /> <Route path="/funds-management" render={() => <FundsManagement open={open} />} />
<Route path="/insights" component={TransferGraph} /> <Route path="/insights" component={TransferGraph} />
<Route path="/projects" component={Projects} /> <Route path="/projects" component={Projects} />
<Route path="/project/:id" component={Project} /> <Route path="/(profile|delegate|project)/:id" component={Project} />
<Route path="/create-project/" render={(props) => <CreateProject {...props} />} /> <Route path="/create-project/" render={(props) => <CreateProject {...props} />} />
<Route path="/create-delegate/" render={(props) => <CreateDelegate {...props} />} /> <Route path="/create-delegate/" render={(props) => <CreateDelegate {...props} />} />
<Route path="/back-project/:id" component={BackProject} /> <Route path="/(back-delegate|back-project)/:id" component={BackProject} />
</Switch> </Switch>
{this.props.children} {this.props.children}
</div> </div>

View File

@ -183,6 +183,7 @@ const getAvatarSrc = assets => {
function Project({ classes, match, profile, transfers, pledges, projectAddedEvents }) { function Project({ classes, match, profile, transfers, pledges, projectAddedEvents }) {
const projectId = match.params.id const projectId = match.params.id
const urlName = match.params[0]
const { projectAge, projectAssets, manifest } = useProjectData(projectId, projectAddedEvents) const { projectAge, projectAssets, manifest } = useProjectData(projectId, projectAddedEvents)
const amountsPledged = useMemo(() => getAmountsPledged(pledges), [pledges, projectId]) const amountsPledged = useMemo(() => getAmountsPledged(pledges), [pledges, projectId])
@ -195,7 +196,8 @@ function Project({ classes, match, profile, transfers, pledges, projectAddedEven
(Number(totalPledged) / Number(manifest.goal)) * 100, (Number(totalPledged) / Number(manifest.goal)) * 100,
100 100
) : 0 ) : 0
console.log({profile, projectAssets, mediaUrl, mediaType, amountsPledged, pledges, transfers}) const profileType = profile[0] ? profile[0].type : urlName
console.log({profile, projectAssets, mediaUrl, mediaType, amountsPledged, pledges, transfers, match})
return (<Fragment> return (<Fragment>
{!projectAssets && <Loading/>} {!projectAssets && <Loading/>}
{projectAssets && <div className={classes.root}> {projectAssets && <div className={classes.root}>
@ -247,8 +249,7 @@ function Project({ classes, match, profile, transfers, pledges, projectAddedEven
</div> </div>
<div> <div>
<Link to={`/back-project/${projectId}`} className={classes.link}> <Link to={`/back-project/${projectId}`} className={classes.link}>
<Button color="primary" variant="contained" style={{height: '50px', width: '100%'}}>Back this <Button color="primary" variant="contained" style={{height: '50px', width: '100%'}}>Back this {profileType}</Button>
project</Button>
</Link> </Link>
</div> </div>
</div> </div>