-
Notifications
You must be signed in to change notification settings - Fork 4
/
ICOList.js
181 lines (176 loc) · 4.5 KB
/
ICOList.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
import React, { Component } from 'react';
import { Box, Markdown, Anchor } from 'grommet';
import { shortDate } from 'grommet-controls/utils';
import connect from '../../redux';
import Coin from './Coin';
import ICOCard from './ICOCard';
import PagingGraphqlList, { withGraphQLList } from '../PagingGraphqlList';
import { allICOCoinsQuery } from '../../graphql/coins';
class ICOList extends Component {
onExpand = ({ row }) => (
<Box direction='row-responsive' pad='small' gap='medium'>
{row.icoDescription && (
<Box width='400px'>
<Markdown >
{row.icoDescription}
</Markdown>
</Box>
)}
<Box>
<ICOCard
symbol={row.symbol}
/>
</Box>
</Box>
);
render() {
const { data, loadMoreEntries } = this.props;
const columns = [
{
title: 'Coin',
name: 'name',
formatter: ({ row }) => (
<Coin
coin={row}
toCoin={{ symbol: this.props.defaultCurrency }}
exchange={this.props.defaultExchange}
level={4}
border={null}
/>
),
}, {
title: 'Status',
name: 'icoStatus',
}, {
title: 'Start date',
name: 'icoDate',
formatter: ({ value }) => (shortDate(value)),
}, {
title: 'End date',
name: 'icoEndDate',
formatter: ({ value }) => (value ? shortDate(value) : 'N/A'),
}, {
title: 'Token type',
name: 'icoTokenType',
}, {
title: 'Funding target',
name: 'icoFundingTarget',
align: 'right',
},
{
title: 'Description',
name: 'icoDescription',
visibility: 'hidden',
},
{
title: 'Blog',
name: 'icoBlogURL',
visibility: 'hidden',
formatter: ({ value }) => <Anchor href={value} target='_blank'>{value}</Anchor>,
},
{
title: 'Website',
name: 'icoWebsiteURL',
visibility: 'hidden',
formatter: ({ value }) => <Anchor href={value} target='_blank'>{value}</Anchor>,
},
{
title: 'ICO page',
name: 'icoWhitePaperURL',
visibility: 'hidden',
formatter: ({ value }) => <Anchor href={value} target='_blank'>{value}</Anchor>,
},
{
title: 'Features',
name: 'icoFeatures',
visibility: 'hidden',
},
{
title: 'Start price',
name: 'icoStartPrice',
visibility: 'hidden',
align: 'right',
},
{
title: 'Currency',
name: 'icoStartPriceCurrency',
visibility: 'hidden',
},
{
title: 'Funds raised',
name: 'icoFundsRaisedList',
visibility: 'hidden',
align: 'right',
},
{
title: '% Investors',
name: 'icoTokenPercentageForInvestors',
visibility: 'hidden',
formatter: ({ value }) => `${value}%`,
align: 'right',
},
{
title: 'Reserve split',
name: 'icoTokenReserveSplit',
visibility: 'hidden',
},
{
title: 'Reserve split',
name: 'icoTokenSupply',
visibility: 'hidden',
},
{
title: 'Post ICO supply',
name: 'icoTokenSupplyPostICO',
visibility: 'hidden',
},
{
title: 'Funding Cap',
name: 'icoFundingCap',
visibility: 'hidden',
},
{
title: 'Raised USD',
name: 'icoFundsRaisedUSD',
visibility: 'hidden',
align: 'right',
},
{
title: 'Jurisdiction',
name: 'icoJurisdiction',
visibility: 'hidden',
},
{
title: 'Legal advisors',
name: 'icoLegalAdvisers',
visibility: 'hidden',
},
{
title: 'Legal form',
name: 'icoLegalForm',
visibility: 'hidden',
},
{
title: 'Payment method',
name: 'icoPaymentMethod',
visibility: 'hidden',
},
];
return (
<PagingGraphqlList
columns={columns}
loadMoreEntries={loadMoreEntries}
data={data}
onExpand={this.onExpand}
sorting={[{ columnName: 'icoDate', direction: 'desc' }]}
gqlProps={{ hasICO: true }}
/>
);
}
}
const mapStateToProps = state => ({
defaultCurrency: state.settings.defaultCurrency,
exchange: state.settings.aggregatedExchange,
defaultExchange: state.settings.defaultExchange,
});
export default withGraphQLList(allICOCoinsQuery, connect(mapStateToProps)(ICOList));