Sent.js 1.63 KiB
Newer Older
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
// This file is part of Parity.
//
Amaury Martiny's avatar
Amaury Martiny committed
// SPDX-License-Identifier: BSD-3-Clause

import React, { Component } from 'react';
import { chainName$, withoutLoading } from '@parity/light.js';
import { inject, observer } from 'mobx-react';
import light from '@parity/light.js-react';
import { withProps } from 'recompose';

import check from '../../assets/img/icons/check.svg';
import loading from '../../assets/img/icons/loading.svg';
import withTokens from '../../utils/withTokens';
import { blockscoutTxUrl } from '../../utils/blockscout';
  chainName: () => chainName$().pipe(withoutLoading())
})
@inject('sendStore')
@withTokens
@withProps(({ match: { params: { tokenAddress } }, tokens }) => ({
  token: tokens[tokenAddress]
}))
@observer
class Sent extends Component {
Amaury Martiny's avatar
Amaury Martiny committed
  componentWillMount () {
Luke Schoen's avatar
Luke Schoen committed
    // If we refresh on this page, return to homepage
    if (!this.props.sendStore.txStatus) {
      this.handleGoToHomepage();
    }
  handleGoToHomepage = () => {
    const { history, sendStore } = this.props;
    sendStore.clear();
    history.push('/');
  };

  render () {
Luke Schoen's avatar
Luke Schoen committed
    const { chainName, sendStore, token } = this.props;

      <div className='window_content'>
Luke Schoen's avatar
Luke Schoen committed
        <SentModal
          blockscoutTxUrl={blockscoutTxUrl}
          confirmationsCount={sendStore.confirmations}
Luke Schoen's avatar
Luke Schoen committed
          chainName={chainName}
          check={check}
Luke Schoen's avatar
Luke Schoen committed
          handleGoToHomepage={this.handleGoToHomepage}
Luke Schoen's avatar
Luke Schoen committed
          loading={loading}
          token={token}
Luke Schoen's avatar
Luke Schoen committed
        />
      </div>
    );
  }
}

export default Sent;