zcash-grant-system/frontend/client/components/Proposal/Contributors/index.tsx

54 lines
1.5 KiB
TypeScript
Raw Normal View History

import React from 'react';
import { Spin } from 'antd';
import AddressRow from 'components/AddressRow';
2018-09-17 08:55:20 -07:00
import Placeholder from 'components/Placeholder';
import UnitDisplay from 'components/UnitDisplay';
const ContributorsBlock = () => {
// TODO: Get contributors from proposal
console.warn('TODO: Get contributors from proposal for Proposal/Contributors/index.tsx');
const proposal = { contributors: [] as any };
let content;
if (proposal) {
if (proposal.contributors.length) {
content = proposal.contributors.map((contributor: any) => (
<AddressRow
2018-09-16 12:59:32 -07:00
key={contributor.address}
address={contributor.address}
2018-12-27 09:41:26 -08:00
secondary={
<UnitDisplay value={contributor.contributionAmount} symbol="ZEC" />
}
2018-09-16 12:59:32 -07:00
/>
));
} else {
2018-09-17 08:53:50 -07:00
content = (
<Placeholder
style={{ minHeight: '220px' }}
title="No contributors found"
subtitle={`
2018-09-17 09:01:01 -07:00
No contributions have been made to this proposal.
Check back later once there's been at least one contribution.
2018-09-17 08:53:50 -07:00
`}
/>
);
2018-09-16 12:59:32 -07:00
}
} else {
content = <Spin />;
}
return (
<div className="Proposal-top-side-block">
{proposal.contributors.length ? (
2018-09-16 12:59:32 -07:00
<>
<h1 className="Proposal-top-main-block-title">Contributors</h1>
<div className="Proposal-top-main-block">{content}</div>
2018-09-16 12:59:32 -07:00
</>
) : (
content
)}
</div>
);
};
export default ContributorsBlock;