From d6349356c8bc29fb8f8c9d9ec8bfe6fe9b11c485 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Thu, 29 Mar 2018 11:32:07 +0200 Subject: [PATCH] removed old files --- src/js/components/wallet/summary/Summary.1.js | 248 ------------------ src/js/reducers/SendFormReducer.1.js | 199 -------------- 2 files changed, 447 deletions(-) delete mode 100644 src/js/components/wallet/summary/Summary.1.js delete mode 100644 src/js/reducers/SendFormReducer.1.js diff --git a/src/js/components/wallet/summary/Summary.1.js b/src/js/components/wallet/summary/Summary.1.js deleted file mode 100644 index 463c41c1..00000000 --- a/src/js/components/wallet/summary/Summary.1.js +++ /dev/null @@ -1,248 +0,0 @@ -/* @flow */ -'use strict'; - -import React, { Component } from 'react'; -import BigNumber from 'bignumber.js'; -import ColorHash from 'color-hash'; -import ScaleText from 'react-scale-text'; -import Blockies from 'react-blockies'; -import { Async } from 'react-select'; -import { resolveAfter } from '../../../utils/promiseUtils'; -import AbstractAccount from '../account/AbstractAccount'; -import { Notification } from '../Notification'; - - -export default class Summary extends AbstractAccount { - - componentDidMount() { - super.componentDidMount(); - //this.props.summaryActions.init(); - } - - componentWillUpdate(newProps: any) { - super.componentWillUpdate(newProps); - //if (newProps.location.pathname !== this.props.location.pathname || (!newProps.summary.loaded && !this.props.summary.loaded)) { - //if (newProps.router.pathname !== this.props.router.pathname || (!newProps.summary.loaded && !this.props.summary.loaded)) { - // this.props.summaryActions.init(); - //} - } - - componentWillUnmount() { - super.componentWillUnmount(); - //this.props.summaryActions.dispose(); - } - - render() { - return _render(this.props); - } -} - -const _render = (props: any): any => { - - const currentAccount = props.account; - const fiatRate = props.fiatRate || '1030'; - - const { - loaded, - address, - summary, - addForm, - search, - customAddress, - customName, - customShortcut, - customDecimal, - - selectedToken - } = props.summary; - - if (currentAccount.deviceStateError) { - return ( -
- -
- ); - } - - - // if (!loaded) return null; - - const { - onSummaryToggle, - onTokenSearch, - onCustomTokenToggle, - onCustomTokenAddressChange, - onCustomTokenNameChange, - onCustomTokenShortcutChange, - onCustomTokenDecimalChange, - onCustomTokenAdd - } = props.summaryActions; - - const tokens = props.tokens.filter(t => t.ethAddress === address); - - - let summaryClassName: string = "summary closed"; - let summaryContent = null; - if (summary) { - summaryClassName = "summary"; - if (currentAccount && currentAccount.balance) { - - const balance = new BigNumber(currentAccount.balance); - const fiat = balance.times(fiatRate).toFixed(2); - - summaryContent = ( -
-
-
Balance
-
${ fiat }
-
{ currentAccount.balance } ETH
-
-
-
Rate
-
${ fiatRate }
-
1.00 ETH
-
-
- ) - } else { - summaryContent = ( -
-
-
Balance
-
Loading...
-
Loading...
-
-
-
Rate
-
${ fiatRate }
-
1.00 ETH
-
-
- ) - } - - } - - let addFormClassName = "add-token-form closed"; - let addFormContent = null; - if (addForm) { - addFormClassName = "add-token-form"; - addFormContent = ( -
-
- - onCustomTokenAddressChange(event.target.value) } /> -
-
- - onCustomTokenNameChange(event.target.value) } /> -
-
- - onCustomTokenShortcutChange(event.target.value) } /> -
-
- - onCustomTokenDecimalChange(event.target.value) } /> -
-
- -
-
- ) - } - - const bg = new ColorHash({lightness: 0.7}); - //const colorHash2 = new ColorHash({lightness: 0.5}); - const colorHash2 = new ColorHash(); - - console.log("SUM", tokens, address, props.tokens) - //let tokensContent = null; - let tokensContent = tokens.map((t, i) => { - - // if (search.length > 0) { - // if (t.name.toLowerCase().indexOf(search) < 0 && t.shortcut.toLowerCase().indexOf(search) < 0) return null; - // } - let iconColor = { - color: colorHash2.hex(t.name), - background: bg.hex(t.name), - borderColor: bg.hex(t.name) - } - return ( -
-
-
-

{ t.symbol }

-
-
-
{ t.name }
-
{ t.balance }
-
- ) - }); - - let ethIcon = null; - if (currentAccount) { - ethIcon = ( - - ); - } - - return ( - -
-

{ ethIcon } Address #{ parseInt(props.match.params.address) + 1 }

- -
- { summaryContent } -
-
- -
- {/* onTokenSearch(event.target.value) } /> */} - 0x58cda554935e4a1f2acbe15f8757400af275e084 - { - console.log("FILTERRR", opt, str, values); - return opt; - } - } - - - value={ selectedToken } - onChange={ props.summaryActions.selectToken } - valueKey="symbol" - labelKey="symbol" - placeholder="Search for token" - loadOptions={ props.summaryActions.loadTokens } - backspaceRemoves={true} /> - -
- -
-
- Add token -
- { addFormContent } -
- -
- { tokensContent } -
-
- - ); -} - -const onChange = () => { -} - -const gotoUser = () => { -} \ No newline at end of file diff --git a/src/js/reducers/SendFormReducer.1.js b/src/js/reducers/SendFormReducer.1.js deleted file mode 100644 index 693d27c3..00000000 --- a/src/js/reducers/SendFormReducer.1.js +++ /dev/null @@ -1,199 +0,0 @@ -/* @flow */ -'use strict'; - -import { LOCATION_CHANGE } from 'react-router-redux'; -import * as SEND from '../actions/constants/SendForm'; -import * as WEB3 from '../actions/constants/Web3'; -import * as ADDRESS from '../actions/constants/Address'; -import EthereumjsUnits from 'ethereumjs-units'; -import BigNumber from 'bignumber.js'; -import { getFeeLevels } from '../actions/SendFormActions'; - -export type State = { - +senderAddress: ?string; - +coin: string; - token: string; - balance: string; - tokenBalance: string; - balanceNeedUpdate: boolean; - - - // form fields - advanced: boolean; - untouched: boolean; // set to true when user made some changes in form - touched: {[k: string]: boolean}; - address: string; - amount: string; - setMax: boolean; - feeLevels: Array; - selectedFeeLevel: ?FeeLevel; - recommendedGasPrice: string; - gasPriceNeedsUpdate: boolean; - gasLimit: string; - gasPrice: string; - data: string; - nonce: string; - total: string; - sending: boolean; - sendingStatus: ?SendStatus; - errors: {[k: string]: string}; - warnings: {[k: string]: string}; - infos: {[k: string]: string}; -} - -export type FeeLevel = { - label: string; - gasPrice: string; - value: string; -} - -type SendStatus = { - success: boolean; - message: string; -} - -export const initialState: State = { - senderAddress: null, - coin: '', - token: '', - advanced: false, - untouched: true, - touched: {}, - balance: '0', - tokenBalance: '0', - balanceNeedUpdate: false, - //address: '', - address: '0x574BbB36871bA6b78E27f4B4dCFb76eA0091880B', - amount: '', - setMax: false, - feeLevels: [], - selectedFeeLevel: null, - recommendedGasPrice: '0', - gasPriceNeedsUpdate: false, - gasLimit: '0', - gasPrice: '0', - data: '', - nonce: '0', - total: '0', - sending: false, - sendingStatus: null, - errors: {}, - warnings: {}, - infos: {}, -} - - -const onGasPriceUpdated = (state: State, action: any): State => { - - function getRandomInt(min, max) { - return Math.floor(Math.random() * (max - min + 1)) + min; - } - const newPrice = getRandomInt(10, 50).toString(); - //const newPrice = EthereumjsUnits.convert(action.gasPrice, 'wei', 'gwei'); - if (action.coin === state.coin && newPrice !== state.recommendedGasPrice) { - const newState: State = { ...state }; - if (!state.untouched) { - newState.gasPriceNeedsUpdate = true; - newState.recommendedGasPrice = newPrice; - } else { - const newFeeLevels = getFeeLevels(state.coin, newPrice, state.gasLimit); - const selectedFeeLevel = newFeeLevels.find(f => f.value === 'Normal'); - newState.recommendedGasPrice = newPrice; - newState.feeLevels = newFeeLevels; - newState.selectedFeeLevel = selectedFeeLevel; - newState.gasPrice = selectedFeeLevel.gasPrice; - } - return newState; - } - return state; -} - -const onBalanceUpdated = (state: State, action: any): State => { - // balanceNeedUpdate - if (state.senderAddress === action.address) { - return { - ...state, - balance: '1' - } - } - return state; -} - - -export default (state: State = initialState, action: any): State => { - - switch (action.type) { - - case SEND.INIT : - return action.state; - - case SEND.DISPOSE : - return initialState; - - // this will be called right after Web3 instance initialization before any view is shown - // and async during app live time - case WEB3.GAS_PRICE_UPDATED : - return onGasPriceUpdated(state, action); - - case ADDRESS.SET_BALANCE : - return onBalanceUpdated(state, action); - - case SEND.TOGGLE_ADVANCED : - return { - ...state, - advanced: !state.advanced - } - - - // user actions - case SEND.ADDRESS_CHANGE : - case SEND.AMOUNT_CHANGE : - case SEND.SET_MAX : - case SEND.CURRENCY_CHANGE : - case SEND.FEE_LEVEL_CHANGE : - case SEND.UPDATE_FEE_LEVELS : - case SEND.GAS_PRICE_CHANGE : - case SEND.GAS_LIMIT_CHANGE : - case SEND.DATA_CHANGE : - return action.state; - - case SEND.SEND : - return { - ...state, - sending: true, - sendingStatus: null, - } - - case SEND.TX_COMPLETE : - return { - ...state, - sending: false, - sendingStatus: { - success: true, - message: action.txid - } - } - case SEND.TX_ERROR : - return { - ...state, - sending: false, - sendingStatus: { - success: false, - message: action.response - } - } - - - case SEND.VALIDATION : - return { - ...state, - errors: action.errors, - warnings: action.warnings, - infos: action.infos, - } - - default: - return state; - } - -} \ No newline at end of file