import React, { CSSProperties } from 'react'; import { Redirect } from 'react-router-dom'; import classnames from 'classnames'; import { Progress, Tag } from 'antd'; import { Proposal, STATUS } from 'types'; import Card from 'components/Card'; import UserAvatar from 'components/UserAvatar'; import UnitDisplay from 'components/UnitDisplay'; import { formatUsd } from 'utils/formatters'; import './style.less'; export class ProposalCard extends React.Component { state = { redirect: '' }; render() { if (this.state.redirect) { return ; } const { title, proposalAddress, proposalUrlId, datePublished, dateCreated, team, target, contributionMatching, isVersionTwo, funded, percentFunded, acceptedWithFunding, status, fundedByZomg, } = this.props; // pulled from `variables.less` const infoColor = '#1890ff'; const secondaryColor = '#2D2A26'; let tagColor = ''; let tagMessage = ''; if (isVersionTwo && status === STATUS.DISCUSSION) { tagColor = infoColor; tagMessage = 'Open for Public Review'; } if (isVersionTwo && status === STATUS.LIVE) { if (acceptedWithFunding) { tagColor = secondaryColor; if (!fundedByZomg) { tagMessage = 'Funded by ZF'; } else { tagMessage = 'Funded by ZOMG'; } } else { tagColor = infoColor; tagMessage = 'Not Funded'; } } const tagStyle: CSSProperties = { marginRight: 0, lineHeight: '1.25rem', height: '1.35rem', fontSize: '0.75rem', ...(!tagMessage ? { opacity: 0 } : {}), }; const cardTitle = (
{title}
{[...team].reverse().map((u, idx) => ( ))}
); return ( {contributionMatching > 0 && (
x2 matching
)} {isVersionTwo && (
{formatUsd(target.toString(10))}
)} {!isVersionTwo && ( <>
raised of{' '} goal
= 100, })} > {percentFunded}%
= 100 ? 'success' : 'active'} showInfo={false} /> )}
{team[0].displayName}{' '} {team.length > 1 && +{team.length - 1} other}
{isVersionTwo && ( {tagMessage} )}
{proposalAddress}
); } } export default ProposalCard;