-
Notifications
You must be signed in to change notification settings - Fork 97
/
accounts.js
61 lines (58 loc) 路 2.2 KB
/
accounts.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
import React, { Fragment } from 'react';
import AccountVisual from '../accountVisual';
import LiskAmount from '../liskAmount';
import styles from './accountsAndDeletegates.css';
const Accounts = ({
accounts, onSelectedRow, t, rowItemIndex, updateRowItemIndex,
}) => {
const isDelegate = accounts.some(account => account.delegate);
return (
<div className={`${styles.wrapper} accounts`}>
<header className={`${styles.header} accounts-header`}>
<label>{t('Accounts')}</label>
<div className={`${styles.subTitles} accounts-subtitle`}>
<label>{t('Address')}</label>
<label>{t('Balance')}</label>
</div>
</header>
<div className={`${styles.content} account-content`}>
{
accounts.map((account, index) => (
<div
key={index}
className={`${styles.accountRow} ${rowItemIndex === index ? styles.active : ''} account-row`}
onClick={() => onSelectedRow(account.address, 'account')}
onMouseEnter={/* istanbul ignore next */ () => updateRowItemIndex(index)}
>
<AccountVisual address={account.address} size={30} />
<div className={styles.accountInformation}>
{
isDelegate
? <Fragment>
<div>
<span className={`${styles.accountTitle} account-title`}>
{account.delegate.username}
</span>
<span className={`${styles.tag} tag`}>
{`#${account.delegate.rank} ${t('Delegate')}`}
</span>
</div>
<span className={styles.accountSubtitle}>{account.address}</span>
</Fragment>
: <span className={`${styles.accountTitle} account-title`}>
{account.address}
</span>
}
</div>
<span className={styles.accountBalance}>
<LiskAmount val={account.balance} />
<span>{t(' LSK')}</span>
</span>
</div>
))
}
</div>
</div>
);
};
export default Accounts;