aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/pages/settings/contact-list-tab/my-accounts/my-accounts.component.js
blob: f43b59e07e8e03f98bc0b46e62131bc6752414f5 (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
import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import ContactList from '../../../../components/app/contact-list'
import { CONTACT_MY_ACCOUNTS_VIEW_ROUTE } from '../../../../helpers/constants/routes'

export default class ViewContact extends PureComponent {

  static contextTypes = {
    t: PropTypes.func,
  }

  static propTypes = {
    myAccounts: PropTypes.array,
    history: PropTypes.object,
  }

  renderMyAccounts () {
    const { myAccounts, history } = this.props

    return (
      <div>
        <ContactList
          searchForMyAccounts={() => myAccounts}
          selectRecipient={(address) => {
            history.push(`${CONTACT_MY_ACCOUNTS_VIEW_ROUTE}/${address}`)
          }}
        />
      </div>
    )
  }

  render () {
    return (
      <div className="address-book">
        { this.renderMyAccounts() }
      </div>
    )
  }
}