diff --git a/src/components/projects/Project.jsx b/src/components/projects/Project.jsx index bd3add8..d16f52c 100644 --- a/src/components/projects/Project.jsx +++ b/src/components/projects/Project.jsx @@ -1,3 +1,4 @@ +/*eslint complexity: ["error", 25]*/ /*global web3*/ import React, { useMemo, Fragment } from 'react' import { Link } from 'react-router-dom' @@ -21,6 +22,9 @@ import { getFiles } from '../../utils/ipfs' import { getImageType } from '../../utils/images' import { useProjectData } from './hooks' +const ROOT_PATH = '/root/' +const DEFAULT_AVATAR = 'https://our.status.im/content/images/2018/07/status_logo_blue_1--2-.png' + const styles = theme => ({ root: { display: 'grid', @@ -173,6 +177,7 @@ const getMediaSrc = assets => { const getAvatarSrc = assets => { if (!assets) return null const { avatar } = getProjectManifest(assets) + if (!avatar || avatar === ROOT_PATH) return DEFAULT_AVATAR if (avatar.includes('http')) return avatar const type = getImageType(avatar) return formatAvatar( @@ -200,6 +205,7 @@ function Project({ classes, match, profile, transfers, pledges, projectAddedEven const addr = profile[0] ? profile[0].addr.toUpperCase() : null const accountUpper = account ? account.toUpperCase() : account const userIsOwner = addr === accountUpper + const mediaSrc = mediaUrl || DEFAULT_AVATAR console.log({profile, projectAssets, mediaUrl, mediaType, amountsPledged, pledges, transfers, match}) return ( {!projectAssets && } @@ -223,11 +229,11 @@ function Project({ classes, match, profile, transfers, pledges, projectAddedEven component="img" alt="video" className={classes.media} - src={mediaUrl} + src={mediaSrc} title="media-description" />}
- {mediaUrl ?