Sent.js 1.7 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 RequireHealthOverlay from '../../RequireHealthOverlay';
import check from '../../assets/img/icons/check.svg';
import loading from '../../assets/img/icons/loading.svg';
import withTokens from '../../utils/withTokens';
  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;

      <RequireHealthOverlay require='connected' fullscreen>
        <div className='window_content'>
          <SentModal
            confirmationsCount={sendStore.confirmations}
            chainName={chainName}
            check={check}
            handleGoToHomepage={this.handleGoToHomepage}
            loading={loading}
            token={token}
            txStatus={sendStore.txStatus}
          />
        </div>
      </RequireHealthOverlay>
    );
  }
}

export default Sent;