From 5b5ec4585d6730de3f188588c7a9a039ded7c564 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Tue, 3 Sep 2019 19:51:36 +0300 Subject: [PATCH] 6th iteration: remove unused components --- ui/app/components/bn-as-decimal-input.js | 188 -- ui/app/components/coinbase-form.js | 69 - ui/app/components/editable-label.js | 88 - ui/app/components/ens-input.js | 181 -- ui/app/components/eth-balance.js | 96 - .../export-text-container.component.js | 45 - .../components/export-text-container/index.js | 2 - .../export-text-container/index.scss | 52 - ui/app/components/fiat-value.js | 66 - ui/app/components/info-box/index.js | 2 - ui/app/components/info-box/index.scss | 24 - .../components/info-box/info-box.component.js | 49 - ui/app/components/menu-droppo.js | 134 - .../components/modals/deposit-ether-modal.js | 220 -- ui/app/components/modals/modal.js | 35 - ui/app/components/notice.js | 138 - .../components/pages/home/home.component.js | 77 - .../components/pages/home/home.container.js | 30 - ui/app/components/pages/home/index.js | 1 - .../pages/keychains/restore-vault.js | 189 -- .../components/pages/keychains/reveal-seed.js | 177 -- .../components/sender-to-recipient/index.js | 1 - .../components/sender-to-recipient/index.scss | 120 - .../sender-to-recipient.component.js | 177 -- .../sender-to-recipient.constants.js | 3 - ui/app/components/shapeshift-form.js | 256 -- ui/app/components/shift-list-item.js | 210 -- ui/app/components/tab-bar.js | 33 - ui/app/components/token-cell.js | 160 -- ui/app/components/token-list.js | 188 -- ui/app/img/identicon-tardigrade.png | Bin 106245 -> 0 bytes ui/app/img/identicon-walrus.png | Bin 296234 -> 0 bytes ui/css.js | 26 - ui/design/00-metamask-SignIn.jpg | Bin 52272 -> 0 bytes ui/design/01-metamask-SelectAcc.jpg | Bin 69380 -> 0 bytes ui/design/02-metamask-AccDetails.jpg | Bin 69375 -> 0 bytes .../02a-metamask-AccDetails-OverToken.jpg | Bin 70154 -> 0 bytes ...2a-metamask-AccDetails-OverTransaction.jpg | Bin 73371 -> 0 bytes ui/design/02a-metamask-AccDetails.jpg | Bin 66736 -> 0 bytes ui/design/02b-metamask-AccDetails-Send.jpg | Bin 61461 -> 0 bytes ui/design/03-metamask-Qr.jpg | Bin 59815 -> 0 bytes ui/design/05-metamask-Menu.jpg | Bin 74748 -> 0 bytes .../final_screen_dao_accounts.png | Bin 172174 -> 0 bytes .../final_screen_dao_locked.png | Bin 156879 -> 0 bytes .../final_screen_dao_notification.png | Bin 159936 -> 0 bytes .../final_screen_wei_account.png | Bin 191713 -> 0 bytes .../final_screen_wei_notification.png | Bin 161808 -> 0 bytes ui/design/chromeStorePics/icon-128.png | Bin 4334 -> 0 bytes ui/design/chromeStorePics/icon-64.png | Bin 2726 -> 0 bytes ui/design/chromeStorePics/metamask_icon.ai | 2383 ----------------- ui/design/chromeStorePics/promo1400560.png | Bin 201710 -> 0 bytes ui/design/chromeStorePics/promo440280.png | Bin 43772 -> 0 bytes ui/design/chromeStorePics/promo920680.png | Bin 157825 -> 0 bytes .../chromeStorePics/screen_dao_accounts.png | Bin 292154 -> 0 bytes .../chromeStorePics/screen_dao_locked.png | Bin 165236 -> 0 bytes .../screen_dao_notification.png | Bin 215070 -> 0 bytes .../chromeStorePics/screen_wei_account.png | Bin 416298 -> 0 bytes .../screen_wei_notification.png | Bin 365391 -> 0 bytes ui/design/metamask-logo-eyes.png | Bin 90701 -> 0 bytes ui/design/wireframes/1st_time_use.png | Bin 937556 -> 0 bytes ui/design/wireframes/metamask_wfs_jan_13.pdf | Bin 452413 -> 0 bytes ui/design/wireframes/metamask_wfs_jan_13.png | Bin 299549 -> 0 bytes ui/design/wireframes/metamask_wfs_jan_18.pdf | Bin 612778 -> 0 bytes 63 files changed, 5420 deletions(-) delete mode 100644 ui/app/components/bn-as-decimal-input.js delete mode 100644 ui/app/components/coinbase-form.js delete mode 100644 ui/app/components/editable-label.js delete mode 100644 ui/app/components/ens-input.js delete mode 100644 ui/app/components/eth-balance.js delete mode 100644 ui/app/components/export-text-container/export-text-container.component.js delete mode 100644 ui/app/components/export-text-container/index.js delete mode 100644 ui/app/components/export-text-container/index.scss delete mode 100644 ui/app/components/fiat-value.js delete mode 100644 ui/app/components/info-box/index.js delete mode 100644 ui/app/components/info-box/index.scss delete mode 100644 ui/app/components/info-box/info-box.component.js delete mode 100644 ui/app/components/menu-droppo.js delete mode 100644 ui/app/components/modals/deposit-ether-modal.js delete mode 100644 ui/app/components/notice.js delete mode 100644 ui/app/components/pages/home/home.component.js delete mode 100644 ui/app/components/pages/home/home.container.js delete mode 100644 ui/app/components/pages/home/index.js delete mode 100644 ui/app/components/pages/keychains/restore-vault.js delete mode 100644 ui/app/components/pages/keychains/reveal-seed.js delete mode 100644 ui/app/components/sender-to-recipient/index.js delete mode 100644 ui/app/components/sender-to-recipient/index.scss delete mode 100644 ui/app/components/sender-to-recipient/sender-to-recipient.component.js delete mode 100644 ui/app/components/sender-to-recipient/sender-to-recipient.constants.js delete mode 100644 ui/app/components/shapeshift-form.js delete mode 100644 ui/app/components/shift-list-item.js delete mode 100644 ui/app/components/tab-bar.js delete mode 100644 ui/app/components/token-cell.js delete mode 100644 ui/app/components/token-list.js delete mode 100644 ui/app/img/identicon-tardigrade.png delete mode 100644 ui/app/img/identicon-walrus.png delete mode 100644 ui/css.js delete mode 100644 ui/design/00-metamask-SignIn.jpg delete mode 100644 ui/design/01-metamask-SelectAcc.jpg delete mode 100644 ui/design/02-metamask-AccDetails.jpg delete mode 100644 ui/design/02a-metamask-AccDetails-OverToken.jpg delete mode 100644 ui/design/02a-metamask-AccDetails-OverTransaction.jpg delete mode 100644 ui/design/02a-metamask-AccDetails.jpg delete mode 100644 ui/design/02b-metamask-AccDetails-Send.jpg delete mode 100644 ui/design/03-metamask-Qr.jpg delete mode 100644 ui/design/05-metamask-Menu.jpg delete mode 100644 ui/design/chromeStorePics/final_screen_dao_accounts.png delete mode 100644 ui/design/chromeStorePics/final_screen_dao_locked.png delete mode 100644 ui/design/chromeStorePics/final_screen_dao_notification.png delete mode 100644 ui/design/chromeStorePics/final_screen_wei_account.png delete mode 100644 ui/design/chromeStorePics/final_screen_wei_notification.png delete mode 100644 ui/design/chromeStorePics/icon-128.png delete mode 100644 ui/design/chromeStorePics/icon-64.png delete mode 100644 ui/design/chromeStorePics/metamask_icon.ai delete mode 100644 ui/design/chromeStorePics/promo1400560.png delete mode 100644 ui/design/chromeStorePics/promo440280.png delete mode 100644 ui/design/chromeStorePics/promo920680.png delete mode 100644 ui/design/chromeStorePics/screen_dao_accounts.png delete mode 100644 ui/design/chromeStorePics/screen_dao_locked.png delete mode 100644 ui/design/chromeStorePics/screen_dao_notification.png delete mode 100644 ui/design/chromeStorePics/screen_wei_account.png delete mode 100644 ui/design/chromeStorePics/screen_wei_notification.png delete mode 100644 ui/design/metamask-logo-eyes.png delete mode 100644 ui/design/wireframes/1st_time_use.png delete mode 100644 ui/design/wireframes/metamask_wfs_jan_13.pdf delete mode 100644 ui/design/wireframes/metamask_wfs_jan_13.png delete mode 100644 ui/design/wireframes/metamask_wfs_jan_18.pdf diff --git a/ui/app/components/bn-as-decimal-input.js b/ui/app/components/bn-as-decimal-input.js deleted file mode 100644 index 9a033f893..000000000 --- a/ui/app/components/bn-as-decimal-input.js +++ /dev/null @@ -1,188 +0,0 @@ -const Component = require('react').Component -const PropTypes = require('prop-types') -const h = require('react-hyperscript') -const inherits = require('util').inherits -const ethUtil = require('ethereumjs-util') -const BN = ethUtil.BN -const extend = require('xtend') -const connect = require('react-redux').connect - -BnAsDecimalInput.contextTypes = { - t: PropTypes.func, -} - -module.exports = connect()(BnAsDecimalInput) - - -inherits(BnAsDecimalInput, Component) -function BnAsDecimalInput () { - this.state = { invalid: null } - Component.call(this) -} - -/* Bn as Decimal Input - * - * A component for allowing easy, decimal editing - * of a passed in bn string value. - * - * On change, calls back its `onChange` function parameter - * and passes it an updated bn string. - */ - -BnAsDecimalInput.prototype.render = function () { - const props = this.props - const state = this.state - - const { value, scale, precision, onChange, min, max } = props - - const suffix = props.suffix - const style = props.style - const valueString = value.toString(10) - const newMin = min && this.downsize(min.toString(10), scale) - const newMax = max && this.downsize(max.toString(10), scale) - const newValue = this.downsize(valueString, scale) - - return ( - h('.flex-column', [ - h('.flex-row', { - style: { - alignItems: 'flex-end', - lineHeight: '13px', - fontFamily: 'Montserrat Light', - textRendering: 'geometricPrecision', - }, - }, [ - h('input.hex-input', { - type: 'number', - step: 'any', - required: true, - min: newMin, - max: newMax, - style: extend({ - display: 'block', - textAlign: 'right', - backgroundColor: 'transparent', - border: '1px solid #bdbdbd', - - }, style), - value: newValue, - onBlur: (event) => { - this.updateValidity(event) - }, - onChange: (event) => { - this.updateValidity(event) - const value = (event.target.value === '') ? '' : event.target.value - - - const scaledNumber = this.upsize(value, scale, precision) - const precisionBN = new BN(scaledNumber, 10) - onChange(precisionBN, event.target.checkValidity()) - }, - onInvalid: (event) => { - const msg = this.constructWarning() - if (msg === state.invalid) { - return - } - this.setState({ invalid: msg }) - event.preventDefault() - return false - }, - }), - h('div', { - style: { - color: ' #AEAEAE', - fontSize: '12px', - marginLeft: '5px', - marginRight: '6px', - width: '20px', - }, - }, suffix), - ]), - - state.invalid ? h('span.error', { - style: { - position: 'absolute', - right: '0px', - textAlign: 'right', - transform: 'translateY(26px)', - padding: '3px', - background: 'rgba(255,255,255,0.85)', - zIndex: '1', - textTransform: 'capitalize', - border: '2px solid #E20202', - }, - }, state.invalid) : null, - ]) - ) -} - -BnAsDecimalInput.prototype.setValid = function (message) { - this.setState({ invalid: null }) -} - -BnAsDecimalInput.prototype.updateValidity = function (event) { - const target = event.target - const value = this.props.value - const newValue = target.value - - if (value === newValue) { - return - } - - const valid = target.checkValidity() - - if (valid) { - this.setState({ invalid: null }) - } -} - -BnAsDecimalInput.prototype.constructWarning = function () { - const { name, min, max, scale, suffix } = this.props - const newMin = min && this.downsize(min.toString(10), scale) - const newMax = max && this.downsize(max.toString(10), scale) - let message = name ? name + ' ' : '' - - if (min && max) { - message += this.context.t('betweenMinAndMax', [`${newMin} ${suffix}`, `${newMax} ${suffix}`]) - } else if (min) { - message += this.context.t('greaterThanMin', [`${newMin} ${suffix}`]) - } else if (max) { - message += this.context.t('lessThanMax', [`${newMax} ${suffix}`]) - } else { - message += this.context.t('invalidInput') - } - - return message -} - - -BnAsDecimalInput.prototype.downsize = function (number, scale) { - // if there is no scaling, simply return the number - if (scale === 0) { - return Number(number) - } else { - // if the scale is the same as the precision, account for this edge case. - var adjustedNumber = number - while (adjustedNumber.length < scale) { - adjustedNumber = '0' + adjustedNumber - } - return Number(adjustedNumber.slice(0, -scale) + '.' + adjustedNumber.slice(-scale)) - } -} - -BnAsDecimalInput.prototype.upsize = function (number, scale, precision) { - var stringArray = number.toString().split('.') - var decimalLength = stringArray[1] ? stringArray[1].length : 0 - var newString = stringArray[0] - - // If there is scaling and decimal parts exist, integrate them in. - if ((scale !== 0) && (decimalLength !== 0)) { - newString += stringArray[1].slice(0, precision) - } - - // Add 0s to account for the upscaling. - for (var i = decimalLength; i < scale; i++) { - newString += '0' - } - return newString -} diff --git a/ui/app/components/coinbase-form.js b/ui/app/components/coinbase-form.js deleted file mode 100644 index d5915292e..000000000 --- a/ui/app/components/coinbase-form.js +++ /dev/null @@ -1,69 +0,0 @@ -const Component = require('react').Component -const PropTypes = require('prop-types') -const h = require('react-hyperscript') -const inherits = require('util').inherits -const connect = require('react-redux').connect -const actions = require('../actions') - -CoinbaseForm.contextTypes = { - t: PropTypes.func, -} - -module.exports = connect(mapStateToProps)(CoinbaseForm) - - -function mapStateToProps (state) { - return { - warning: state.appState.warning, - } -} - -inherits(CoinbaseForm, Component) - -function CoinbaseForm () { - Component.call(this) -} - -CoinbaseForm.prototype.render = function () { - var props = this.props - - return h('.flex-column', { - style: { - marginTop: '35px', - padding: '25px', - width: '100%', - }, - }, [ - h('.flex-row', { - style: { - justifyContent: 'space-around', - margin: '33px', - marginTop: '0px', - }, - }, [ - h('button.btn-green', { - onClick: this.toCoinbase.bind(this), - }, this.context.t('continueToCoinbase')), - - h('button.btn-red', { - onClick: () => props.dispatch(actions.goHome()), - }, this.context.t('cancel')), - ]), - ]) -} - -CoinbaseForm.prototype.toCoinbase = function () { - const props = this.props - const address = props.buyView.buyAddress - props.dispatch(actions.buyEth({ network: '1', address, amount: 0 })) -} - -CoinbaseForm.prototype.renderLoading = function () { - return h('img', { - style: { - width: '27px', - marginRight: '-27px', - }, - src: 'images/loading.svg', - }) -} diff --git a/ui/app/components/editable-label.js b/ui/app/components/editable-label.js deleted file mode 100644 index eb41ec50c..000000000 --- a/ui/app/components/editable-label.js +++ /dev/null @@ -1,88 +0,0 @@ -const { Component } = require('react') -const PropTypes = require('prop-types') -const h = require('react-hyperscript') -const classnames = require('classnames') - -class EditableLabel extends Component { - constructor (props) { - super(props) - - this.state = { - isEditing: false, - value: props.defaultValue || '', - } - } - - handleSubmit () { - const { value } = this.state - - if (value === '') { - return - } - - Promise.resolve(this.props.onSubmit(value)) - .then(() => this.setState({ isEditing: false })) - } - - saveIfEnter (event) { - if (event.key === 'Enter') { - this.handleSubmit() - } - } - - renderEditing () { - const { value } = this.state - - return ([ - h('input.large-input.editable-label__input', { - type: 'text', - required: true, - value: this.state.value, - onKeyPress: (event) => { - if (event.key === 'Enter') { - this.handleSubmit() - } - }, - onChange: event => this.setState({ value: event.target.value }), - className: classnames({ 'editable-label__input--error': value === '' }), - }), - h('div.editable-label__icon-wrapper', [ - h('i.fa.fa-check.editable-label__icon', { - onClick: () => this.handleSubmit(), - }), - ]), - ]) - } - - renderReadonly () { - return ([ - h('div.editable-label__value', this.state.value), - h('div.editable-label__icon-wrapper', [ - h('i.fa.fa-pencil.editable-label__icon', { - onClick: () => this.setState({ isEditing: true }), - }), - ]), - ]) - } - - render () { - const { isEditing } = this.state - const { className } = this.props - - return ( - h('div.editable-label', { className: classnames(className) }, - isEditing - ? this.renderEditing() - : this.renderReadonly() - ) - ) - } -} - -EditableLabel.propTypes = { - onSubmit: PropTypes.func.isRequired, - defaultValue: PropTypes.string, - className: PropTypes.string, -} - -module.exports = EditableLabel diff --git a/ui/app/components/ens-input.js b/ui/app/components/ens-input.js deleted file mode 100644 index f538fd555..000000000 --- a/ui/app/components/ens-input.js +++ /dev/null @@ -1,181 +0,0 @@ -const Component = require('react').Component -const PropTypes = require('prop-types') -const h = require('react-hyperscript') -const inherits = require('util').inherits -const extend = require('xtend') -const debounce = require('debounce') -const copyToClipboard = require('copy-to-clipboard') -const ENS = require('ethjs-ens') -const networkMap = require('ethjs-ens/lib/network-map.json') -const ensRE = /.+\..+$/ -const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000' -const connect = require('react-redux').connect -const ToAutoComplete = require('./send/to-autocomplete').default -const log = require('loglevel') -const { isValidENSAddress } = require('../util') - -EnsInput.contextTypes = { - t: PropTypes.func, -} - -module.exports = connect()(EnsInput) - - -inherits(EnsInput, Component) -function EnsInput () { - Component.call(this) -} - -EnsInput.prototype.onChange = function (recipient) { - - const network = this.props.network - const networkHasEnsSupport = getNetworkEnsSupport(network) - - this.props.onChange({ toAddress: recipient }) - - if (!networkHasEnsSupport) return - - if (recipient.match(ensRE) === null) { - return this.setState({ - loadingEns: false, - ensResolution: null, - ensFailure: null, - toError: null, - }) - } - - this.setState({ - loadingEns: true, - }) - this.checkName(recipient) -} - -EnsInput.prototype.render = function () { - const props = this.props - const opts = extend(props, { - list: 'addresses', - onChange: this.onChange.bind(this), - qrScanner: true, - }) - return h('div', { - style: { width: '100%', position: 'relative' }, - }, [ - h(ToAutoComplete, { ...opts }), - this.ensIcon(), - ]) -} - -EnsInput.prototype.componentDidMount = function () { - const network = this.props.network - const networkHasEnsSupport = getNetworkEnsSupport(network) - this.setState({ ensResolution: ZERO_ADDRESS }) - - if (networkHasEnsSupport) { - const provider = global.ethereumProvider - this.ens = new ENS({ provider, network }) - this.checkName = debounce(this.lookupEnsName.bind(this), 200) - } -} - -EnsInput.prototype.lookupEnsName = function (recipient) { - const { ensResolution } = this.state - - log.info(`ENS attempting to resolve name: ${recipient}`) - this.ens.lookup(recipient.trim()) - .then((address) => { - if (address === ZERO_ADDRESS) throw new Error(this.context.t('noAddressForName')) - if (address !== ensResolution) { - this.setState({ - loadingEns: false, - ensResolution: address, - nickname: recipient.trim(), - hoverText: address + '\n' + this.context.t('clickCopy'), - ensFailure: false, - toError: null, - }) - } - }) - .catch((reason) => { - const setStateObj = { - loadingEns: false, - ensResolution: recipient, - ensFailure: true, - toError: null, - } - if (isValidENSAddress(recipient) && reason.message === 'ENS name not defined.') { - setStateObj.hoverText = this.context.t('ensNameNotFound') - setStateObj.toError = 'ensNameNotFound' - setStateObj.ensFailure = false - } else { - log.error(reason) - setStateObj.hoverText = reason.message - } - - return this.setState(setStateObj) - }) -} - -EnsInput.prototype.componentDidUpdate = function (prevProps, prevState) { - const state = this.state || {} - const ensResolution = state.ensResolution - // If an address is sent without a nickname, meaning not from ENS or from - // the user's own accounts, a default of a one-space string is used. - const nickname = state.nickname || ' ' - if (prevProps.network !== this.props.network) { - const provider = global.ethereumProvider - this.ens = new ENS({ provider, network: this.props.network }) - this.onChange(ensResolution) - } - if (prevState && ensResolution && this.props.onChange && - ensResolution !== prevState.ensResolution) { - this.props.onChange({ toAddress: ensResolution, nickname, toError: state.toError }) - } -} - -EnsInput.prototype.ensIcon = function (recipient) { - const { hoverText } = this.state || {} - return h('span.#ensIcon', { - title: hoverText, - style: { - position: 'absolute', - top: '16px', - left: '-25px', - }, - }, this.ensIconContents(recipient)) -} - -EnsInput.prototype.ensIconContents = function (recipient) { - const { loadingEns, ensFailure, ensResolution, toError } = this.state || { ensResolution: ZERO_ADDRESS } - - if (toError) return - - if (loadingEns) { - return h('img', { - src: 'images/loading.svg', - style: { - width: '30px', - height: '30px', - transform: 'translateY(-6px)', - }, - }) - } - - if (ensFailure) { - return h('i.fa.fa-warning.fa-lg.warning') - } - - if (ensResolution && (ensResolution !== ZERO_ADDRESS)) { - return h('i.fa.fa-check-circle.fa-lg.cursor-pointer', { - style: { color: 'green' }, - onClick: (event) => { - event.preventDefault() - event.stopPropagation() - copyToClipboard(ensResolution) - }, - }) - } -} - -function getNetworkEnsSupport (network) { - return Boolean(networkMap[network]) -} diff --git a/ui/app/components/eth-balance.js b/ui/app/components/eth-balance.js deleted file mode 100644 index c3d084bdc..000000000 --- a/ui/app/components/eth-balance.js +++ /dev/null @@ -1,96 +0,0 @@ -const { Component } = require('react') -const h = require('react-hyperscript') -const { inherits } = require('util') -const { - formatBalance, - generateBalanceObject, -} = require('../util') -const Tooltip = require('./tooltip.js') -const FiatValue = require('./fiat-value.js') - -module.exports = EthBalanceComponent - -inherits(EthBalanceComponent, Component) -function EthBalanceComponent () { - Component.call(this) -} - -EthBalanceComponent.prototype.render = function () { - const props = this.props - const { value, style, width, needsParse = true } = props - - const formattedValue = value ? formatBalance(value, 6, needsParse) : '...' - - return ( - - h('.ether-balance.ether-balance-amount', { - style, - }, [ - h('div', { - style: { - display: 'inline', - width, - }, - }, this.renderBalance(formattedValue)), - ]) - - ) -} -EthBalanceComponent.prototype.renderBalance = function (value) { - if (value === 'None') return value - if (value === '...') return value - - const { - conversionRate, - shorten, - incoming, - currentCurrency, - hideTooltip, - styleOveride = {}, - showFiat = true, - } = this.props - const { fontSize, color, fontFamily, lineHeight } = styleOveride - - const { shortBalance, balance, label } = generateBalanceObject(value, shorten ? 1 : 3) - const balanceToRender = shorten ? shortBalance : balance - - const [ethNumber, ethSuffix] = value.split(' ') - const containerProps = hideTooltip ? {} : { - position: 'bottom', - title: `${ethNumber} ${ethSuffix}`, - } - - return ( - h(hideTooltip ? 'div' : Tooltip, - containerProps, - h('div.flex-column', [ - h('.flex-row', { - style: { - alignItems: 'flex-end', - lineHeight: lineHeight || '13px', - fontFamily: fontFamily || 'Montserrat Light', - textRendering: 'geometricPrecision', - }, - }, [ - h('div', { - style: { - width: '100%', - textAlign: 'right', - fontSize: fontSize || 'inherit', - color: color || 'inherit', - }, - }, incoming ? `+${balanceToRender}` : balanceToRender), - h('div', { - style: { - color: color || '#AEAEAE', - fontSize: fontSize || '12px', - marginLeft: '5px', - }, - }, label), - ]), - - showFiat ? h(FiatValue, { value: this.props.value, conversionRate, currentCurrency }) : null, - ]) - ) - ) -} diff --git a/ui/app/components/export-text-container/export-text-container.component.js b/ui/app/components/export-text-container/export-text-container.component.js deleted file mode 100644 index c2546fa9b..000000000 --- a/ui/app/components/export-text-container/export-text-container.component.js +++ /dev/null @@ -1,45 +0,0 @@ -const { Component } = require('react') -const PropTypes = require('prop-types') -const h = require('react-hyperscript') -const copyToClipboard = require('copy-to-clipboard') -const { exportAsFile } = require('../../util') - -class ExportTextContainer extends Component { - render () { - const { text = '', filename = '' } = this.props - const { t } = this.context - - return ( - h('.export-text-container', [ - h('.export-text-container__text-container', [ - h('.export-text-container__text', text), - ]), - h('.export-text-container__buttons-container', [ - h('.export-text-container__button.export-text-container__button--copy', { - onClick: () => copyToClipboard(text), - }, [ - h('img', { src: 'images/copy-to-clipboard.svg' }), - h('.export-text-container__button-text', t('copyToClipboard')), - ]), - h('.export-text-container__button', { - onClick: () => exportAsFile(filename, text), - }, [ - h('img', { src: 'images/download.svg' }), - h('.export-text-container__button-text', t('saveAsCsvFile')), - ]), - ]), - ]) - ) - } -} - -ExportTextContainer.propTypes = { - text: PropTypes.string, - filename: PropTypes.string, -} - -ExportTextContainer.contextTypes = { - t: PropTypes.func, -} - -module.exports = ExportTextContainer diff --git a/ui/app/components/export-text-container/index.js b/ui/app/components/export-text-container/index.js deleted file mode 100644 index b2864a717..000000000 --- a/ui/app/components/export-text-container/index.js +++ /dev/null @@ -1,2 +0,0 @@ -const ExportTextContainer = require('./export-text-container.component') -module.exports = ExportTextContainer diff --git a/ui/app/components/export-text-container/index.scss b/ui/app/components/export-text-container/index.scss deleted file mode 100644 index 975d62f70..000000000 --- a/ui/app/components/export-text-container/index.scss +++ /dev/null @@ -1,52 +0,0 @@ -.export-text-container { - display: flex; - justify-content: center; - flex-direction: column; - align-items: center; - border: 1px solid $alto; - border-radius: 4px; - font-weight: 400; - - &__text-container { - width: 100%; - display: flex; - justify-content: center; - padding: 20px; - border-radius: 4px; - background: $alabaster; - } - - &__text { - resize: none; - border: none; - background: $alabaster; - font-size: 20px; - text-align: center; - } - - &__buttons-container { - display: flex; - flex-direction: row; - border-top: 1px solid $alto; - width: 100%; - } - - &__button { - padding: 10px; - flex: 1; - display: flex; - justify-content: center; - align-items: center; - font-size: 12px; - cursor: pointer; - color: $curious-blue; - - &--copy { - border-right: 1px solid $alto; - } - } - - &__button-text { - padding-left: 10px; - } -} diff --git a/ui/app/components/fiat-value.js b/ui/app/components/fiat-value.js deleted file mode 100644 index 56465fc9d..000000000 --- a/ui/app/components/fiat-value.js +++ /dev/null @@ -1,66 +0,0 @@ -const Component = require('react').Component -const h = require('react-hyperscript') -const inherits = require('util').inherits -const formatBalance = require('../util').formatBalance - -module.exports = FiatValue - -inherits(FiatValue, Component) -function FiatValue () { - Component.call(this) -} - -FiatValue.prototype.render = function () { - const props = this.props - const { conversionRate, currentCurrency, style } = props - const renderedCurrency = currentCurrency || '' - - const value = formatBalance(props.value, 6) - - if (value === 'None') return value - var fiatDisplayNumber, fiatTooltipNumber - var splitBalance = value.split(' ') - - if (conversionRate !== 0) { - fiatTooltipNumber = Number(splitBalance[0]) * conversionRate - fiatDisplayNumber = fiatTooltipNumber.toFixed(2) - } else { - fiatDisplayNumber = 'N/A' - fiatTooltipNumber = 'Unknown' - } - - return fiatDisplay(fiatDisplayNumber, renderedCurrency.toUpperCase(), style) -} - -function fiatDisplay (fiatDisplayNumber, fiatSuffix, styleOveride = {}) { - const { fontSize, color, fontFamily, lineHeight } = styleOveride - - if (fiatDisplayNumber !== 'N/A') { - return h('.flex-row', { - style: { - alignItems: 'flex-end', - lineHeight: lineHeight || '13px', - fontFamily: fontFamily || 'Montserrat Light', - textRendering: 'geometricPrecision', - }, - }, [ - h('div', { - style: { - width: '100%', - textAlign: 'right', - fontSize: fontSize || '12px', - color: color || '#333333', - }, - }, fiatDisplayNumber), - h('div', { - style: { - color: color || '#AEAEAE', - marginLeft: '5px', - fontSize: fontSize || '12px', - }, - }, fiatSuffix), - ]) - } else { - return h('div') - } -} diff --git a/ui/app/components/info-box/index.js b/ui/app/components/info-box/index.js deleted file mode 100644 index 6110422ed..000000000 --- a/ui/app/components/info-box/index.js +++ /dev/null @@ -1,2 +0,0 @@ -import InfoBox from './info-box.component' -module.exports = InfoBox diff --git a/ui/app/components/info-box/index.scss b/ui/app/components/info-box/index.scss deleted file mode 100644 index 8b5626d79..000000000 --- a/ui/app/components/info-box/index.scss +++ /dev/null @@ -1,24 +0,0 @@ -.info-box { - border-radius: 4px; - background-color: $alabaster; - position: relative; - padding: 16px; - display: flex; - flex-flow: column; - color: $mid-gray; - - &__close::after { - content: '\00D7'; - font-size: 29px; - font-weight: 200; - color: $dusty-gray; - position: absolute; - right: 12px; - top: 0; - cursor: pointer; - } - - &__description { - font-size: .75rem; - } -} diff --git a/ui/app/components/info-box/info-box.component.js b/ui/app/components/info-box/info-box.component.js deleted file mode 100644 index 8688b8e8f..000000000 --- a/ui/app/components/info-box/info-box.component.js +++ /dev/null @@ -1,49 +0,0 @@ -import React, { Component } from 'react' -import PropTypes from 'prop-types' - -export default class InfoBox extends Component { - static contextTypes = { - t: PropTypes.func, - } - - static propTypes = { - onClose: PropTypes.func, - title: PropTypes.string, - description: PropTypes.string, - } - - constructor (props) { - super(props) - - this.state = { - isShowing: true, - } - } - - handleClose () { - const { onClose } = this.props - - if (onClose) { - onClose() - } else { - this.setState({ isShowing: false }) - } - } - - render () { - const { title, description } = this.props - - return !this.state.isShowing - ? null - : ( -
-
this.handleClose()} - /> -
{ title }
-
{ description }
-
- ) - } -} diff --git a/ui/app/components/menu-droppo.js b/ui/app/components/menu-droppo.js deleted file mode 100644 index ea4949c80..000000000 --- a/ui/app/components/menu-droppo.js +++ /dev/null @@ -1,134 +0,0 @@ -const Component = require('react').Component -const h = require('react-hyperscript') -const inherits = require('util').inherits -const findDOMNode = require('react-dom').findDOMNode -import { CSSTransitionGroup } from 'react-transition-group' - -module.exports = MenuDroppoComponent - - -inherits(MenuDroppoComponent, Component) -function MenuDroppoComponent () { - Component.call(this) -} - -MenuDroppoComponent.prototype.render = function () { - const { containerClassName = '' } = this.props - const speed = this.props.speed || '300ms' - const useCssTransition = this.props.useCssTransition - const zIndex = ('zIndex' in this.props) ? this.props.zIndex : 0 - - this.manageListeners() - - const style = this.props.style || {} - if (!('position' in style)) { - style.position = 'fixed' - } - style.zIndex = zIndex - - return ( - h('div', { - style, - className: `.menu-droppo-container ${containerClassName}`, - }, [ - h('style', ` - .menu-droppo-enter { - transition: transform ${speed} ease-in-out; - transform: translateY(-200%); - } - - .menu-droppo-enter.menu-droppo-enter-active { - transition: transform ${speed} ease-in-out; - transform: translateY(0%); - } - - .menu-droppo-leave { - transition: transform ${speed} ease-in-out; - transform: translateY(0%); - } - - .menu-droppo-leave.menu-droppo-leave-active { - transition: transform ${speed} ease-in-out; - transform: translateY(-200%); - } - `), - - useCssTransition - ? h(CSSTransitionGroup, { - className: 'css-transition-group', - transitionName: 'menu-droppo', - transitionEnterTimeout: parseInt(speed), - transitionLeaveTimeout: parseInt(speed), - }, this.renderPrimary()) - : this.renderPrimary(), - ]) - ) -} - -MenuDroppoComponent.prototype.renderPrimary = function () { - const isOpen = this.props.isOpen - if (!isOpen) { - return null - } - - const innerStyle = this.props.innerStyle || {} - - return ( - h('.menu-droppo', { - key: 'menu-droppo-drawer', - style: innerStyle, - }, - [ this.props.children ]) - ) -} - -MenuDroppoComponent.prototype.manageListeners = function () { - const isOpen = this.props.isOpen - const onClickOutside = this.props.onClickOutside - - if (isOpen) { - this.outsideClickHandler = onClickOutside - } else if (isOpen) { - this.outsideClickHandler = null - } -} - -MenuDroppoComponent.prototype.componentDidMount = function () { - if (this && document.body) { - this.globalClickHandler = this.globalClickOccurred.bind(this) - document.body.addEventListener('click', this.globalClickHandler) - // eslint-disable-next-line react/no-find-dom-node - var container = findDOMNode(this) - this.container = container - } -} - -MenuDroppoComponent.prototype.componentWillUnmount = function () { - if (this && document.body) { - document.body.removeEventListener('click', this.globalClickHandler) - } -} - -MenuDroppoComponent.prototype.globalClickOccurred = function (event) { - const target = event.target - // eslint-disable-next-line react/no-find-dom-node - const container = findDOMNode(this) - - if (target !== container && - !isDescendant(this.container, event.target) && - this.outsideClickHandler) { - this.outsideClickHandler(event) - } -} - -function isDescendant (parent, child) { - var node = child.parentNode - while (node !== null) { - if (node === parent) { - return true - } - node = node.parentNode - } - - return false -} diff --git a/ui/app/components/modals/deposit-ether-modal.js b/ui/app/components/modals/deposit-ether-modal.js deleted file mode 100644 index 09137d39a..000000000 --- a/ui/app/components/modals/deposit-ether-modal.js +++ /dev/null @@ -1,220 +0,0 @@ -const Component = require('react').Component -const PropTypes = require('prop-types') -const h = require('react-hyperscript') -const inherits = require('util').inherits -const connect = require('react-redux').connect -const actions = require('../../actions') -const { getNetworkDisplayName } = require('../../../../app/scripts/controllers/network/util') -const ShapeshiftForm = require('../shapeshift-form') - -import Button from '../button' - -let DIRECT_DEPOSIT_ROW_TITLE -let DIRECT_DEPOSIT_ROW_TEXT -let COINBASE_ROW_TITLE -let COINBASE_ROW_TEXT -let SHAPESHIFT_ROW_TITLE -let SHAPESHIFT_ROW_TEXT -let FAUCET_ROW_TITLE - -function mapStateToProps (state) { - return { - network: state.metamask.network, - address: state.metamask.selectedAddress, - } -} - -function mapDispatchToProps (dispatch) { - return { - toCoinbase: (address) => { - dispatch(actions.buyEth({ network: '1', address, amount: 0 })) - }, - hideModal: () => { - dispatch(actions.hideModal()) - }, - hideWarning: () => { - dispatch(actions.hideWarning()) - }, - showAccountDetailModal: () => { - dispatch(actions.showModal({ name: 'ACCOUNT_DETAILS' })) - }, - toFaucet: network => dispatch(actions.buyEth({ network })), - } -} - -inherits(DepositEtherModal, Component) -function DepositEtherModal (props, context) { - Component.call(this) - - // need to set after i18n locale has loaded - DIRECT_DEPOSIT_ROW_TITLE = context.t('directDepositEther') - DIRECT_DEPOSIT_ROW_TEXT = context.t('directDepositEtherExplainer') - COINBASE_ROW_TITLE = context.t('buyCoinbase') - COINBASE_ROW_TEXT = context.t('buyCoinbaseExplainer') - SHAPESHIFT_ROW_TITLE = context.t('depositShapeShift') - SHAPESHIFT_ROW_TEXT = context.t('depositShapeShiftExplainer') - FAUCET_ROW_TITLE = context.t('testFaucet') - - this.state = { - buyingWithShapeshift: false, - } -} - -DepositEtherModal.contextTypes = { - t: PropTypes.func, -} - -module.exports = connect(mapStateToProps, mapDispatchToProps)(DepositEtherModal) - - -DepositEtherModal.prototype.facuetRowText = function (networkName) { - return this.context.t('getEtherFromFaucet', [networkName]) -} - -DepositEtherModal.prototype.renderRow = function ({ - logo, - title, - text, - buttonLabel, - onButtonClick, - hide, - className, - hideButton, - hideTitle, - onBackClick, - showBackButton, -}) { - if (hide) { - return null - } - - return h('div', { - className: className || 'deposit-ether-modal__buy-row', - }, [ - - onBackClick && showBackButton && h('div.deposit-ether-modal__buy-row__back', { - onClick: onBackClick, - }, [ - - h('i.fa.fa-arrow-left.cursor-pointer'), - - ]), - - h('div.deposit-ether-modal__buy-row__logo-container', [logo]), - - h('div.deposit-ether-modal__buy-row__description', [ - - !hideTitle && h('div.deposit-ether-modal__buy-row__description__title', [title]), - - h('div.deposit-ether-modal__buy-row__description__text', [text]), - - ]), - - !hideButton && h('div.deposit-ether-modal__buy-row__button', [ - h(Button, { - type: 'primary', - className: 'deposit-ether-modal__deposit-button', - large: true, - onClick: onButtonClick, - }, [buttonLabel]), - ]), - - ]) -} - -DepositEtherModal.prototype.render = function () { - const { network, toCoinbase, address, toFaucet } = this.props - const { buyingWithShapeshift } = this.state - - const isTestNetwork = ['3', '4', '42'].find(n => n === network) - const networkName = getNetworkDisplayName(network) - - return h('div.page-container.page-container--full-width.page-container--full-height', {}, [ - - h('div.page-container__header', [ - - h('div.page-container__title', [this.context.t('depositEther')]), - - h('div.page-container__subtitle', [ - this.context.t('needEtherInWallet'), - ]), - - h('div.page-container__header-close', { - onClick: () => { - this.setState({ buyingWithShapeshift: false }) - this.props.hideWarning() - this.props.hideModal() - }, - }), - - ]), - - h('.page-container__content', {}, [ - - h('div.deposit-ether-modal__buy-rows', [ - - this.renderRow({ - logo: h('img.deposit-ether-modal__logo', { - src: './images/deposit-eth.svg', - }), - title: DIRECT_DEPOSIT_ROW_TITLE, - text: DIRECT_DEPOSIT_ROW_TEXT, - buttonLabel: this.context.t('viewAccount'), - onButtonClick: () => this.goToAccountDetailsModal(), - hide: buyingWithShapeshift, - }), - - this.renderRow({ - logo: h('i.fa.fa-tint.fa-2x'), - title: FAUCET_ROW_TITLE, - text: this.facuetRowText(networkName), - buttonLabel: this.context.t('getEther'), - onButtonClick: () => toFaucet(network), - hide: !isTestNetwork || buyingWithShapeshift, - }), - - this.renderRow({ - logo: h('div.deposit-ether-modal__logo', { - style: { - backgroundImage: 'url(\'./images/coinbase logo.png\')', - height: '40px', - }, - }), - title: COINBASE_ROW_TITLE, - text: COINBASE_ROW_TEXT, - buttonLabel: this.context.t('continueToCoinbase'), - onButtonClick: () => toCoinbase(address), - hide: isTestNetwork || buyingWithShapeshift, - }), - - this.renderRow({ - logo: h('div.deposit-ether-modal__logo', { - style: { - backgroundImage: 'url(\'./images/shapeshift logo.png\')', - }, - }), - title: SHAPESHIFT_ROW_TITLE, - text: SHAPESHIFT_ROW_TEXT, - buttonLabel: this.context.t('shapeshiftBuy'), - onButtonClick: () => this.setState({ buyingWithShapeshift: true }), - hide: isTestNetwork, - hideButton: buyingWithShapeshift, - hideTitle: buyingWithShapeshift, - onBackClick: () => this.setState({ buyingWithShapeshift: false }), - showBackButton: this.state.buyingWithShapeshift, - className: buyingWithShapeshift && 'deposit-ether-modal__buy-row__shapeshift-buy', - }), - - buyingWithShapeshift && h(ShapeshiftForm), - - ]), - - ]), - ]) -} - -DepositEtherModal.prototype.goToAccountDetailsModal = function () { - this.props.hideWarning() - this.props.hideModal() - this.props.showAccountDetailModal() -} diff --git a/ui/app/components/modals/modal.js b/ui/app/components/modals/modal.js index 6f17d8fdb..63dc097fd 100644 --- a/ui/app/components/modals/modal.js +++ b/ui/app/components/modals/modal.js @@ -10,7 +10,6 @@ const { ENVIRONMENT_TYPE_POPUP } = require('../../../../app/scripts/lib/enums') // Modal Components const BuyOptions = require('./buy-options-modal') -const DepositEtherModal = require('./deposit-ether-modal') const EditAccountNameModal = require('./edit-account-name-modal') const ExportPrivateKeyModal = require('./export-private-key-modal') const NewAccountModal = require('./new-account-modal') @@ -72,40 +71,6 @@ const MODALS = { }, }, - DEPOSIT_ETHER: { - contents: [ - h(DepositEtherModal, {}, []), - ], - onHide: (props) => props.hideWarning(), - mobileModalStyle: { - width: '100%', - height: '100%', - transform: 'none', - left: '0', - right: '0', - margin: '0 auto', - boxShadow: '0 0 7px 0 rgba(0,0,0,0.08)', - top: '0', - display: 'flex', - }, - laptopModalStyle: { - width: '850px', - top: 'calc(10% + 10px)', - left: '0', - right: '0', - margin: '0 auto', - boxShadow: '0 0 6px 0 rgba(0,0,0,0.3)', - borderRadius: '7px', - transform: 'none', - height: 'calc(80% - 20px)', - overflowY: 'hidden', - }, - contentStyle: { - borderRadius: '7px', - height: '100%', - }, - }, - EDIT_ACCOUNT_NAME: { contents: [ h(EditAccountNameModal, {}, []), diff --git a/ui/app/components/notice.js b/ui/app/components/notice.js deleted file mode 100644 index bb7e0814c..000000000 --- a/ui/app/components/notice.js +++ /dev/null @@ -1,138 +0,0 @@ -const inherits = require('util').inherits -const Component = require('react').Component -const PropTypes = require('prop-types') -const h = require('react-hyperscript') -const ReactMarkdown = require('react-markdown') -const linker = require('extension-link-enabler') -const findDOMNode = require('react-dom').findDOMNode -const connect = require('react-redux').connect - -Notice.contextTypes = { - t: PropTypes.func, -} - -module.exports = connect()(Notice) - - -inherits(Notice, Component) -function Notice () { - Component.call(this) -} - -Notice.prototype.render = function () { - const { notice, onConfirm } = this.props - const { title, date, body } = notice - const state = this.state || { disclaimerDisabled: true } - const disabled = state.disclaimerDisabled - - return ( - h('.flex-column.flex-center.flex-grow', { - style: { - width: '100%', - }, - }, [ - h('h3.flex-center.text-transform-uppercase.terms-header', { - style: { - background: '#EBEBEB', - color: '#AEAEAE', - width: '100%', - fontSize: '20px', - textAlign: 'center', - padding: 6, - }, - }, [ - title, - ]), - - h('h5.flex-center.text-transform-uppercase.terms-header', { - style: { - background: '#EBEBEB', - color: '#AEAEAE', - marginBottom: 24, - width: '100%', - fontSize: '20px', - textAlign: 'center', - padding: 6, - }, - }, [ - date, - ]), - - h('style', ` - - .markdown { - overflow-x: hidden; - } - - .markdown h1, .markdown h2, .markdown h3 { - margin: 10px 0; - font-weight: bold; - } - - .markdown strong { - font-weight: bold; - } - .markdown em { - font-style: italic; - } - - .markdown p { - margin: 10px 0; - } - - .markdown a { - color: #df6b0e; - } - - `), - - h('div.markdown', { - onScroll: (e) => { - var object = e.currentTarget - if (object.offsetHeight + object.scrollTop + 100 >= object.scrollHeight) { - this.setState({disclaimerDisabled: false}) - } - }, - style: { - background: 'rgb(235, 235, 235)', - height: '310px', - padding: '6px', - width: '90%', - overflowY: 'scroll', - scroll: 'auto', - }, - }, [ - h(ReactMarkdown, { - className: 'notice-box', - source: body, - skipHtml: true, - }), - ]), - - h('button.primary', { - disabled, - onClick: () => { - this.setState({disclaimerDisabled: true}, () => onConfirm()) - }, - style: { - marginTop: '18px', - }, - }, this.context.t('accept')), - ]) - ) -} - -Notice.prototype.componentDidMount = function () { - // eslint-disable-next-line react/no-find-dom-node - var node = findDOMNode(this) - linker.setupListener(node) - if (document.getElementsByClassName('notice-box')[0].clientHeight < 310) { - this.setState({disclaimerDisabled: false}) - } -} - -Notice.prototype.componentWillUnmount = function () { - // eslint-disable-next-line react/no-find-dom-node - var node = findDOMNode(this) - linker.teardownListener(node) -} diff --git a/ui/app/components/pages/home/home.component.js b/ui/app/components/pages/home/home.component.js deleted file mode 100644 index d3c71c4f6..000000000 --- a/ui/app/components/pages/home/home.component.js +++ /dev/null @@ -1,77 +0,0 @@ -import React, { PureComponent } from 'react' -import PropTypes from 'prop-types' -import Media from 'react-media' -import { Redirect } from 'react-router-dom' -import WalletView from '../../wallet-view' -import TransactionView from '../../transaction-view' -import { - INITIALIZE_BACKUP_PHRASE_ROUTE, - RESTORE_VAULT_ROUTE, - CONFIRM_TRANSACTION_ROUTE, - NOTICE_ROUTE, - CONFIRM_ADD_SUGGESTED_TOKEN_ROUTE, -} from '../../../routes' - -export default class Home extends PureComponent { - static propTypes = { - history: PropTypes.object, - noActiveNotices: PropTypes.bool, - lostAccounts: PropTypes.array, - forgottenPassword: PropTypes.bool, - seedWords: PropTypes.string, - suggestedTokens: PropTypes.object, - unconfirmedTransactionsCount: PropTypes.number, - } - - componentDidMount () { - const { - history, - suggestedTokens = {}, - unconfirmedTransactionsCount = 0, - } = this.props - - // suggested new tokens - if (Object.keys(suggestedTokens).length > 0) { - history.push(CONFIRM_ADD_SUGGESTED_TOKEN_ROUTE) - } - - if (unconfirmedTransactionsCount > 0) { - history.push(CONFIRM_TRANSACTION_ROUTE) - } - } - - render () { - const { - noActiveNotices, - lostAccounts, - forgottenPassword, - seedWords, - } = this.props - - // notices - if (!noActiveNotices || (lostAccounts && lostAccounts.length > 0)) { - return - } - - // seed words - if (seedWords) { - return - } - - if (forgottenPassword) { - return - } - - return ( -
-
- } - /> - -
-
- ) - } -} diff --git a/ui/app/components/pages/home/home.container.js b/ui/app/components/pages/home/home.container.js deleted file mode 100644 index 58001df6b..000000000 --- a/ui/app/components/pages/home/home.container.js +++ /dev/null @@ -1,30 +0,0 @@ -import Home from './home.component' -import { compose } from 'recompose' -import { connect } from 'react-redux' -import { withRouter } from 'react-router-dom' -import { unconfirmedTransactionsCountSelector } from '../../../selectors/confirm-transaction' - -const mapStateToProps = state => { - const { metamask, appState } = state - const { - noActiveNotices, - lostAccounts, - seedWords, - suggestedTokens, - } = metamask - const { forgottenPassword } = appState - - return { - noActiveNotices, - lostAccounts, - forgottenPassword, - seedWords, - suggestedTokens, - unconfirmedTransactionsCount: unconfirmedTransactionsCountSelector(state), - } -} - -export default compose( - withRouter, - connect(mapStateToProps) -)(Home) diff --git a/ui/app/components/pages/home/index.js b/ui/app/components/pages/home/index.js deleted file mode 100644 index 4474ba5b8..000000000 --- a/ui/app/components/pages/home/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './home.container' diff --git a/ui/app/components/pages/keychains/restore-vault.js b/ui/app/components/pages/keychains/restore-vault.js deleted file mode 100644 index d90a33e49..000000000 --- a/ui/app/components/pages/keychains/restore-vault.js +++ /dev/null @@ -1,189 +0,0 @@ -import React, { Component } from 'react' -import PropTypes from 'prop-types' -import {connect} from 'react-redux' -import { - createNewVaultAndRestore, - unMarkPasswordForgotten, -} from '../../../actions' -import { DEFAULT_ROUTE } from '../../../routes' -import TextField from '../../text-field' - -class RestoreVaultPage extends Component { - static contextTypes = { - t: PropTypes.func, - } - - static propTypes = { - warning: PropTypes.string, - createNewVaultAndRestore: PropTypes.func.isRequired, - leaveImportSeedScreenState: PropTypes.func, - history: PropTypes.object, - isLoading: PropTypes.bool, - }; - - state = { - seedPhrase: '', - password: '', - confirmPassword: '', - seedPhraseError: null, - passwordError: null, - confirmPasswordError: null, - } - - parseSeedPhrase = (seedPhrase) => { - return seedPhrase - .match(/\w+/g) - .join(' ') - } - - handleSeedPhraseChange (seedPhrase) { - let seedPhraseError = null - - if (seedPhrase && this.parseSeedPhrase(seedPhrase).split(' ').length !== 12) { - seedPhraseError = this.context.t('seedPhraseReq') - } - - this.setState({ seedPhrase, seedPhraseError }) - } - - handlePasswordChange (password) { - const { confirmPassword } = this.state - let confirmPasswordError = null - let passwordError = null - - if (password && password.length < 8) { - passwordError = this.context.t('passwordNotLongEnough') - } - - if (confirmPassword && password !== confirmPassword) { - confirmPasswordError = this.context.t('passwordsDontMatch') - } - - this.setState({ password, passwordError, confirmPasswordError }) - } - - handleConfirmPasswordChange (confirmPassword) { - const { password } = this.state - let confirmPasswordError = null - - if (password !== confirmPassword) { - confirmPasswordError = this.context.t('passwordsDontMatch') - } - - this.setState({ confirmPassword, confirmPasswordError }) - } - - onClick = () => { - const { password, seedPhrase } = this.state - const { - createNewVaultAndRestore, - leaveImportSeedScreenState, - history, - } = this.props - - leaveImportSeedScreenState() - createNewVaultAndRestore(password, this.parseSeedPhrase(seedPhrase)) - .then(() => history.push(DEFAULT_ROUTE)) - } - - hasError () { - const { passwordError, confirmPasswordError, seedPhraseError } = this.state - return passwordError || confirmPasswordError || seedPhraseError - } - - render () { - const { - seedPhrase, - password, - confirmPassword, - seedPhraseError, - passwordError, - confirmPasswordError, - } = this.state - const { t } = this.context - const { isLoading } = this.props - const disabled = !seedPhrase || !password || !confirmPassword || isLoading || this.hasError() - - return ( -
-
-
- { - e.preventDefault() - this.props.history.goBack() - }} - href="#" - > - {`< Back`} - -
- { this.context.t('restoreAccountWithSeed') } -
-
- { this.context.t('secretPhrase') } -
-
- -