From 0ddd33c643a99be51f32ff02859fe953811092b0 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Tue, 29 Nov 2016 16:55:59 +0100 Subject: [PATCH] Trim unused components --- .../TransactionFinished.css | 54 ------ .../TransactionFinished.js | 120 ------------ .../components/TransactionFinished/index.js | 17 -- .../TransactionMainDetails.js | 2 - .../TransactionPending/TransactionPending.js | 5 +- .../TransactionSecondaryDetails.css | 90 --------- .../TransactionSecondaryDetails.js | 178 ------------------ .../TransactionSecondaryDetails/index.js | 1 - .../containers/RequestsPage/RequestsPage.js | 42 +---- 9 files changed, 2 insertions(+), 507 deletions(-) delete mode 100644 js/src/views/Signer/components/TransactionFinished/TransactionFinished.css delete mode 100644 js/src/views/Signer/components/TransactionFinished/TransactionFinished.js delete mode 100644 js/src/views/Signer/components/TransactionFinished/index.js delete mode 100644 js/src/views/Signer/components/TransactionSecondaryDetails/TransactionSecondaryDetails.css delete mode 100644 js/src/views/Signer/components/TransactionSecondaryDetails/TransactionSecondaryDetails.js delete mode 100644 js/src/views/Signer/components/TransactionSecondaryDetails/index.js diff --git a/js/src/views/Signer/components/TransactionFinished/TransactionFinished.css b/js/src/views/Signer/components/TransactionFinished/TransactionFinished.css deleted file mode 100644 index 3617f666a..000000000 --- a/js/src/views/Signer/components/TransactionFinished/TransactionFinished.css +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright 2015, 2016 Ethcore (UK) Ltd. -/* This file is part of Parity. -/* -/* Parity is free software: you can redistribute it and/or modify -/* it under the terms of the GNU General Public License as published by -/* the Free Software Foundation, either version 3 of the License, or -/* (at your option) any later version. -/* -/* Parity is distributed in the hope that it will be useful, -/* but WITHOUT ANY WARRANTY; without even the implied warranty of -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -/* GNU General Public License for more details. -/* -/* You should have received a copy of the GNU General Public License -/* along with Parity. If not, see . -*/ - -@import '../../_layout.css'; - -.container { - display: flex; - padding: 1.5em 0 1em; - - & > * { - vertical-align: middle; - min-height: $finishedHeight; - } -} - -.statusContainer { - box-sizing: border-box; - float: right; - padding: 0 1em; - flex: 0 0 $statusWidth; -} - -.transactionDetails { - width: 100%; - box-sizing: border-box; -} - -.isConfirmed { - color: green; -} - -.isRejected { - opacity: 0.5; - padding-top: 2em; -} - -.txHash { - display: block; - word-break: break-all; -} diff --git a/js/src/views/Signer/components/TransactionFinished/TransactionFinished.js b/js/src/views/Signer/components/TransactionFinished/TransactionFinished.js deleted file mode 100644 index f24481e57..000000000 --- a/js/src/views/Signer/components/TransactionFinished/TransactionFinished.js +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright 2015, 2016 Ethcore (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -import React, { Component, PropTypes } from 'react'; -import { observer } from 'mobx-react'; - -import { TxHash } from '../../../../ui'; - -import TransactionMainDetails from '../TransactionMainDetails'; -import TxHashLink from '../TxHashLink'; -import TransactionSecondaryDetails from '../TransactionSecondaryDetails'; - -import styles from './TransactionFinished.css'; - -import * as tUtil from '../util/transaction'; -import { capitalize } from '../util/util'; - -@observer -export default class TransactionFinished extends Component { - static propTypes = { - id: PropTypes.object.isRequired, - from: PropTypes.string.isRequired, - value: PropTypes.object.isRequired, // wei hex - gasPrice: PropTypes.object.isRequired, // wei hex - gas: PropTypes.object.isRequired, // hex - status: PropTypes.string.isRequired, // rejected, confirmed - date: PropTypes.instanceOf(Date).isRequired, - to: PropTypes.string, // undefined if it's a contract - txHash: PropTypes.string, // undefined if transacation is rejected - className: PropTypes.string, - data: PropTypes.string, - isTest: PropTypes.bool.isRequired, - store: PropTypes.object.isRequired - }; - - componentWillMount () { - const { from, to, gas, gasPrice, value, store } = this.props; - const fee = tUtil.getFee(gas, gasPrice); // BigNumber object - const totalValue = tUtil.getTotalValue(fee, value); - - this.setState({ totalValue }); - store.fetchBalances([from, to]); - } - - render () { - const { className, date, id, from, to, store } = this.props; - - const fromBalance = store.balances[from]; - const toBalance = store.balances[to]; - - return ( -
- - - -
- { this.renderStatus() } -
-
- ); - } - - renderStatus () { - const { status, txHash } = this.props; - - if (status !== 'confirmed') { - return ( -
- { capitalize(status) } -
- ); - } - - return ( - - ); - } - - renderTxHash () { - const { txHash, isTest } = this.props; - - if (!txHash) { - return; - } - - return ( -
- Transaction hash: - -
- ); - } -} diff --git a/js/src/views/Signer/components/TransactionFinished/index.js b/js/src/views/Signer/components/TransactionFinished/index.js deleted file mode 100644 index fe606e1d4..000000000 --- a/js/src/views/Signer/components/TransactionFinished/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015, 2016 Ethcore (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -export default from './TransactionFinished'; diff --git a/js/src/views/Signer/components/TransactionMainDetails/TransactionMainDetails.js b/js/src/views/Signer/components/TransactionMainDetails/TransactionMainDetails.js index fb10392d3..ca2061791 100644 --- a/js/src/views/Signer/components/TransactionMainDetails/TransactionMainDetails.js +++ b/js/src/views/Signer/components/TransactionMainDetails/TransactionMainDetails.js @@ -32,9 +32,7 @@ export default class TransactionMainDetails extends Component { value: PropTypes.object.isRequired, // wei hex totalValue: PropTypes.object.isRequired, // wei BigNumber isTest: PropTypes.bool.isRequired, - to: PropTypes.string, // undefined if it's a contract transaction: PropTypes.object.isRequired, - toBalance: PropTypes.object, // eth BigNumber - undefined if it's a contract or until it's fetched children: PropTypes.node }; diff --git a/js/src/views/Signer/components/TransactionPending/TransactionPending.js b/js/src/views/Signer/components/TransactionPending/TransactionPending.js index 98c83be3b..4fba02826 100644 --- a/js/src/views/Signer/components/TransactionPending/TransactionPending.js +++ b/js/src/views/Signer/components/TransactionPending/TransactionPending.js @@ -65,11 +65,10 @@ export default class TransactionPending extends Component { render () { const { className, id, transaction, store } = this.props; - const { from, to, value } = transaction; + const { from, value } = transaction; const { totalValue } = this.state; const fromBalance = store.balances[from]; - const toBalance = store.balances[to]; return (
@@ -78,8 +77,6 @@ export default class TransactionPending extends Component { value={ value } from={ from } fromBalance={ fromBalance } - to={ to } - toBalance={ toBalance } className={ styles.transactionDetails } transaction={ transaction } totalValue={ totalValue } /> diff --git a/js/src/views/Signer/components/TransactionSecondaryDetails/TransactionSecondaryDetails.css b/js/src/views/Signer/components/TransactionSecondaryDetails/TransactionSecondaryDetails.css deleted file mode 100644 index ae71b1004..000000000 --- a/js/src/views/Signer/components/TransactionSecondaryDetails/TransactionSecondaryDetails.css +++ /dev/null @@ -1,90 +0,0 @@ -/* Copyright 2015, 2016 Ethcore (UK) Ltd. -/* This file is part of Parity. -/* -/* Parity is free software: you can redistribute it and/or modify -/* it under the terms of the GNU General Public License as published by -/* the Free Software Foundation, either version 3 of the License, or -/* (at your option) any later version. -/* -/* Parity is distributed in the hope that it will be useful, -/* but WITHOUT ANY WARRANTY; without even the implied warranty of -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -/* GNU General Public License for more details. -/* -/* You should have received a copy of the GNU General Public License -/* along with Parity. If not, see . -*/ - -.container { - display: block; -} - -.iconsContainer { - display: block; - text-align: center; - font-size: .8em; - opacity: 0.5; - padding: 1em 0 0 0; -} - -.iconsContainer > * { - margin-right: 3px; - display: inline-block; -} - -.iconsContainer:after { - clear: both; -} - -.hasInfoIcon svg, -.miningTime svg, -.gasPrice svg, -.data svg, -.date svg { - width: 16px !important; - height: 16px !important; - position: relative; - bottom: -3px; - margin: 0 0.25rem 0 0.75rem; -} - -/* TODO [ToDr] composes was handling weird errors when linking from other app */ -.miningTime { - /* composes: hasInfoIcon; */ -} - -.gasPrice { - /* composes: hasInfoIcon; */ -} - -.data { - /* composes: hasInfoIcon; */ - cursor: pointer; -} - -.data.noData { - cursor: text; -} - - -.dataTooltip { - word-wrap: break-word; - max-width: 400px; -} - -.expandedData { - display: block; - padding: 15px; - background: gray; - word-wrap: break-word; - color: #fff; -} - -.expandedContainer { - padding: 10px; - border-radius: 4px; -} - -.expandedContainer:empty { - padding: 0; -} diff --git a/js/src/views/Signer/components/TransactionSecondaryDetails/TransactionSecondaryDetails.js b/js/src/views/Signer/components/TransactionSecondaryDetails/TransactionSecondaryDetails.js deleted file mode 100644 index 283712ed0..000000000 --- a/js/src/views/Signer/components/TransactionSecondaryDetails/TransactionSecondaryDetails.js +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright 2015, 2016 Ethcore (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -import React, { Component, PropTypes } from 'react'; - -import ReactTooltip from 'react-tooltip'; -import DescriptionIcon from 'material-ui/svg-icons/action/description'; -import GasIcon from 'material-ui/svg-icons/maps/local-gas-station'; -import TimeIcon from 'material-ui/svg-icons/device/access-time'; -import moment from 'moment'; - -import styles from './TransactionSecondaryDetails.css'; - -import * as tUtil from '../util/transaction'; - -export default class TransactionSecondaryDetails extends Component { - static propTypes = { - id: PropTypes.object.isRequired, - date: PropTypes.instanceOf(Date), - data: PropTypes.string, // hex - gasPriceEthmDisplay: PropTypes.string, - gasToDisplay: PropTypes.string, - className: PropTypes.string - }; - - state = { - isDataExpanded: false - }; - - render () { - const className = this.props.className || ''; - - return ( -
-
- { this.renderGasPrice() } - { this.renderData() } - { this.renderDate() } -
-
- { this.renderDataExpanded() } -
-
- ); - } - - renderGasPrice () { - if (!this.props.gasPriceEthmDisplay && !this.props.gasToDisplay) { - return null; - } - - const { id } = this.props; - const { gasPriceEthmDisplay, gasToDisplay } = this.props; - - return ( -
- - - { gasPriceEthmDisplay } ETH/MGAS - - { /* dynamic id required in case there are multple transactions in page */ } - - Cost of 1,000,000 units of gas. This transaction will use up to { gasToDisplay } MGAS. - -
- ); - } - - renderData () { - if (!this.props.data) { - return null; - } - - const { data, id } = this.props; - let dataToDisplay = this.noData() ? 'no data' : tUtil.getShortData(data); - const noDataClass = this.noData() ? styles.noData : ''; - - return ( -
- - { dataToDisplay } - { /* dynamic id required in case there are multple transactions in page */ } - - Extra data for the transaction: -
- { dataToDisplay }. -
- { this.noData() ? '' : Click to expand. } -
-
- ); - } - - renderDate () { - const { date, id } = this.props; - - const dateToDisplay = moment(date).fromNow(); - const fullDate = moment(date).format('LL LTS'); - - return ( -
- - { dateToDisplay } - { /* dynamic id required in case there are multple transactions in page */ } - - Date of the request: -
- { fullDate } -
-
- ); - } - - renderDataExpanded () { - if (!this.props.data) return null; - - const { isDataExpanded } = this.state; - const { data } = this.props; - - if (!isDataExpanded) { - return; - } - - return ( -
-

Transaction's Data

- { data } -
- ); - } - - noData () { - return this.props.data === '0x'; - } - - toggleDataExpanded = () => { - if (this.noData()) { - return; - } - this.setState({ - isDataExpanded: !this.state.isDataExpanded - }); - } - -} diff --git a/js/src/views/Signer/components/TransactionSecondaryDetails/index.js b/js/src/views/Signer/components/TransactionSecondaryDetails/index.js deleted file mode 100644 index 4b352c41a..000000000 --- a/js/src/views/Signer/components/TransactionSecondaryDetails/index.js +++ /dev/null @@ -1 +0,0 @@ -export default from './TransactionSecondaryDetails'; diff --git a/js/src/views/Signer/containers/RequestsPage/RequestsPage.js b/js/src/views/Signer/containers/RequestsPage/RequestsPage.js index ae2ba05fb..a15cb537d 100644 --- a/js/src/views/Signer/containers/RequestsPage/RequestsPage.js +++ b/js/src/views/Signer/containers/RequestsPage/RequestsPage.js @@ -24,7 +24,7 @@ import Store from '../../store'; import * as RequestsActions from '../../../../redux/providers/signerActions'; import { Container, Page, TxList } from '../../../../ui'; -import { RequestPending, RequestFinished } from '../../components'; +import { RequestPending } from '../../components'; import styles from './RequestsPage.css'; @@ -57,7 +57,6 @@ class RequestsPage extends Component {
{ this.renderPendingRequests() }
{ this.renderLocalQueue() }
-
{ this.renderFinishedRequests() }
); } @@ -106,24 +105,6 @@ class RequestsPage extends Component { ); } - renderFinishedRequests () { - const { finished } = this.props.signer; - - if (!finished.length) { - return; - } - - const items = finished.sort(this._sortRequests).map(this.renderFinished); - - return ( - -
- { items } -
-
- ); - } - renderPending = (data) => { const { actions, isTest } = this.props; const { payload, id, isSending, date } = data; @@ -143,27 +124,6 @@ class RequestsPage extends Component { /> ); } - - renderFinished = (data) => { - const { isTest } = this.props; - const { payload, id, result, msg, status, error, date } = data; - - return ( - - ); - } } function mapStateToProps (state) {