blob: 63d171127e0e3ec5182108e1d8f40c3d44e04b0b (
plain) (
blame)
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
|
import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import TransactionListItem from '../transaction-list-item'
export default class TransactionList extends PureComponent {
static contextTypes = {
t: PropTypes.func,
}
static defaultProps = {
pendingTransactions: [],
completedTransactions: [],
}
static propTypes = {
pendingTransactions: PropTypes.array,
completedTransactions: PropTypes.array,
}
renderTransactions () {
const { t } = this.context
const { pendingTransactions, completedTransactions } = this.props
return (
<div className="transaction-list__transactions">
{
pendingTransactions.length > 0 && (
<div className="transaction-list__pending-transactions">
<div className="transaction-list__header">
{ `${t('pending')} (${pendingTransactions.length})` }
</div>
{
pendingTransactions.map(transaction => {
return (
<TransactionListItem
transaction={transaction}
key={transaction.id}
/>
)
})
}
</div>
)
}
<div className="transaction-list__completed-transactions">
<div className="transaction-list__header">
{ t('history') }
</div>
{
completedTransactions.length > 0
? (
completedTransactions.map(transaction => {
return (
<TransactionListItem
transaction={transaction}
key={transaction.id}
/>
)
})
)
: this.renderEmpty()
}
</div>
</div>
)
}
renderEmpty () {
return (
<div className="transaction-list__empty">
<div className="transaction-list__empty-text">
{ this.context.t('noTransactions') }
</div>
</div>
)
}
render () {
return (
<div className="transaction-list">
{
this.renderTransactions()
// pendingTransactions.length + completedTransactions.length > 0
// ? this.renderTransactions()
// : this.renderEmpty()
}
</div>
)
}
}
|