-
Notifications
You must be signed in to change notification settings - Fork 4
/
ICOCard.js
146 lines (141 loc) · 3.85 KB
/
ICOCard.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { graphql } from 'react-apollo';
import numeral from 'numeral';
import { Box, Anchor } from 'grommet';
import { PagingTable, Card } from 'grommet-controls';
import { shortDate } from 'grommet-controls/utils';
import Coin, { hasICO } from './Coin';
import { icoDetailsQuery } from '../../graphql/coins';
import DoubleTitle from '../DoubleTitle';
class ICOCard extends Component {
renderTable() {
const { data: { coin } } = this.props;
if (coin) {
const rows = [
{
label: 'Blog',
value: (
<Anchor href={coin.icoBlogURL} target='_blank' label={coin.icoBlogURL} />
),
}, {
label: 'Web site',
value: (
<Anchor href={coin.icoWebsiteURL} target='_blank' label={coin.icoWebsiteURL} />
),
}, {
label: 'White paper',
value: (
<Anchor href={coin.icoWhitePaperURL} target='_blank' label={coin.icoWhitePaperURL} />
),
}, {
label: 'Date',
value: shortDate(coin.icoDate),
}, {
label: 'End date',
value: coin.icoEndDate ? shortDate(coin.icoEndDate) : 'N/A',
}, {
label: 'Features',
value: (
<Box>
{coin.icoFeatures}
</Box>
),
}, {
label: 'Token type',
value: coin.icoTokenType,
}, {
label: 'Funding target',
value: coin.icoFundingTarget,
}, {
label: 'Payment',
value: (
<Box >
{coin.icoPaymentMethod}
</Box>
),
}, {
label: 'Start price',
value: coin.icoStartPrice,
}, {
label: 'Start crypto',
value: coin.icoStartPriceCurrency,
}, {
label: 'Funds raised',
value: coin.icoFundsRaisedList,
}, {
label: '% for investors',
value: coin.icoTokenPercentageForInvestors,
}, {
label: 'Reserve split',
value: (
<Box>
{coin.icoTokenReserveSplit}
</Box>
),
}, {
label: 'Token supply',
value: coin.icoTokenSupply,
}, {
label: 'Supply post ICO',
value: coin.icoTokenSupplyPostICO,
}, {
label: 'Funding cap',
value: coin.icoFundingCap,
}, {
label: 'Funds raised (USD)',
value: numeral(coin.icoFundsRaisedUSD).format('$0,0.00'),
}, {
label: 'Jurisdiction',
value: coin.icoJurisdiction,
}, {
label: 'Legal advisers',
value: coin.icoLegalAdvisers,
}, {
label: 'Legal form',
value: coin.icoLegalForm,
},
];
return (
<Box full='horizontal'>
<PagingTable
data={rows}
sortable={false}
resizable={false}
showPagination={false}
columns={[
{ accessor: 'label', width: 200 },
{ accessor: 'value' },
]}
/>
</Box>
);
}
return null;
}
render() {
const { data: { coin } } = this.props;
if (!coin || !hasICO(coin)) {
return null;
}
return (
<Card>
<Card.CardTitle>
<DoubleTitle>
{coin && <Coin coin={coin} />}
{coin && coin.icoStatus}
</DoubleTitle>
</Card.CardTitle>
<Card.CardContent>
{this.renderTable()}
</Card.CardContent>
</Card>
);
}
}
ICOCard.propTypes = {
// eslint-disable-next-line react/no-unused-prop-types
symbol: PropTypes.string.isRequired,
};
export default graphql(icoDetailsQuery,
{ options: props => ({ variables: { symbol: props.symbol } }) })(ICOCard);