Merge pull request #3200 from alextsg/cb-703

[NewUI] Remove accessing PropTypes from main React package
feature/default_network_editable
kumavis 7 years ago committed by GitHub
commit 4e8d9fef84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      mascara/src/app/buy-ether-widget/index.js
  2. 7
      mascara/src/app/first-time/backup-phrase-screen.js
  3. 5
      mascara/src/app/first-time/breadcrumbs.js
  4. 3
      mascara/src/app/first-time/buy-ether-screen.js
  5. 31
      mascara/src/app/first-time/create-password-screen.js
  6. 3
      mascara/src/app/first-time/import-account-screen.js
  7. 3
      mascara/src/app/first-time/import-seed-phrase-screen.js
  8. 3
      mascara/src/app/first-time/index.js
  9. 10
      mascara/src/app/first-time/loading-screen.js
  10. 28
      mascara/src/app/first-time/notice-screen.js
  11. 3
      mascara/src/app/first-time/unique-image-screen.js
  12. 3
      mascara/src/app/shapeshift-form/index.js
  13. 2
      old-ui/app/components/account-dropdowns.js
  14. 2
      old-ui/app/components/dropdown.js
  15. 2
      ui/app/components/account-dropdowns.js
  16. 2
      ui/app/components/dropdowns/components/account-dropdowns.js
  17. 2
      ui/app/components/dropdowns/components/dropdown.js
  18. 2
      ui/app/components/dropdowns/simple-dropdown.js
  19. 2
      ui/app/components/loading.js
  20. 2
      ui/app/components/tab-bar.js

@ -1,4 +1,5 @@
import React, {Component, PropTypes} from 'react' import React, { Component } from 'react'
import PropTypes from 'prop-types'
import classnames from 'classnames' import classnames from 'classnames'
import {connect} from 'react-redux' import {connect} from 'react-redux'
import {qrcode} from 'qrcode-npm' import {qrcode} from 'qrcode-npm'

@ -1,5 +1,6 @@
import React, {Component, PropTypes} from 'react' import React, { Component } from 'react'
import {connect} from 'react-redux'; import PropTypes from 'prop-types'
import {connect} from 'react-redux'
import classnames from 'classnames' import classnames from 'classnames'
import shuffle from 'lodash.shuffle' import shuffle from 'lodash.shuffle'
import {compose, onlyUpdateForPropTypes} from 'recompose' import {compose, onlyUpdateForPropTypes} from 'recompose'
@ -194,7 +195,7 @@ class BackupPhraseScreen extends Component {
</button> </button>
</div> </div>
</div> </div>
) )
} }
renderBack () { renderBack () {

@ -1,10 +1,11 @@
import React, {Component, PropTypes} from 'react' import React, { Component } from 'react'
import PropTypes from 'prop-types'
export default class Breadcrumbs extends Component { export default class Breadcrumbs extends Component {
static propTypes = { static propTypes = {
total: PropTypes.number, total: PropTypes.number,
currentIndex: PropTypes.number currentIndex: PropTypes.number,
}; };
render() { render() {

@ -1,4 +1,5 @@
import React, {Component, PropTypes} from 'react' import React, { Component } from 'react'
import PropTypes from 'prop-types'
import classnames from 'classnames' import classnames from 'classnames'
import {connect} from 'react-redux' import {connect} from 'react-redux'
import {qrcode} from 'qrcode-npm' import {qrcode} from 'qrcode-npm'

@ -1,6 +1,7 @@
import EventEmitter from 'events' import EventEmitter from 'events'
import React, {Component, PropTypes} from 'react' import React, { Component } from 'react'
import {connect} from 'react-redux'; import PropTypes from 'prop-types'
import {connect} from 'react-redux'
import {createNewVaultAndKeychain} from '../../../../ui/app/actions' import {createNewVaultAndKeychain} from '../../../../ui/app/actions'
import LoadingScreen from './loading-screen' import LoadingScreen from './loading-screen'
import Breadcrumbs from './breadcrumbs' import Breadcrumbs from './breadcrumbs'
@ -12,12 +13,12 @@ class CreatePasswordScreen extends Component {
createAccount: PropTypes.func.isRequired, createAccount: PropTypes.func.isRequired,
goToImportWithSeedPhrase: PropTypes.func.isRequired, goToImportWithSeedPhrase: PropTypes.func.isRequired,
goToImportAccount: PropTypes.func.isRequired, goToImportAccount: PropTypes.func.isRequired,
next: PropTypes.func.isRequired next: PropTypes.func.isRequired,
} }
state = { state = {
password: '', password: '',
confirmPassword: '' confirmPassword: '',
} }
constructor () { constructor () {
@ -25,34 +26,34 @@ class CreatePasswordScreen extends Component {
this.animationEventEmitter = new EventEmitter() this.animationEventEmitter = new EventEmitter()
} }
isValid() { isValid () {
const {password, confirmPassword} = this.state; const {password, confirmPassword} = this.state
if (!password || !confirmPassword) { if (!password || !confirmPassword) {
return false; return false
} }
if (password.length < 8) { if (password.length < 8) {
return false; return false
} }
return password === confirmPassword; return password === confirmPassword
} }
createAccount = () => { createAccount = () => {
if (!this.isValid()) { if (!this.isValid()) {
return; return
} }
const {password} = this.state; const {password} = this.state
const {createAccount, next} = this.props; const {createAccount, next} = this.props
createAccount(password) createAccount(password)
.then(next); .then(next)
} }
render() { render () {
const { isLoading, goToImportAccount, goToImportWithSeedPhrase } = this.props const { isLoading, goToImportWithSeedPhrase } = this.props
return isLoading return isLoading
? <LoadingScreen loadingMessage="Creating your new account" /> ? <LoadingScreen loadingMessage="Creating your new account" />

@ -1,4 +1,5 @@
import React, {Component, PropTypes} from 'react' import React, { Component } from 'react'
import PropTypes from 'prop-types'
import {connect} from 'react-redux' import {connect} from 'react-redux'
import classnames from 'classnames' import classnames from 'classnames'
import LoadingScreen from './loading-screen' import LoadingScreen from './loading-screen'

@ -1,4 +1,5 @@
import React, {Component, PropTypes} from 'react' import React, { Component } from 'react'
import PropTypes from 'prop-types'
import {connect} from 'react-redux' import {connect} from 'react-redux'
import LoadingScreen from './loading-screen' import LoadingScreen from './loading-screen'
import {createNewVaultAndRestore, hideWarning, displayWarning} from '../../../../ui/app/actions' import {createNewVaultAndRestore, hideWarning, displayWarning} from '../../../../ui/app/actions'

@ -1,4 +1,5 @@
import React, {Component, PropTypes} from 'react' import React, { Component } from 'react'
import PropTypes from 'prop-types'
import {connect} from 'react-redux' import {connect} from 'react-redux'
import CreatePasswordScreen from './create-password-screen' import CreatePasswordScreen from './create-password-screen'
import UniqueImageScreen from './unique-image-screen' import UniqueImageScreen from './unique-image-screen'

@ -1,4 +1,5 @@
import React, {Component, PropTypes} from 'react' import React from 'react'
import PropTypes from 'prop-types'
import Spinner from './spinner' import Spinner from './spinner'
export default function LoadingScreen({ className = '', loadingMessage }) { export default function LoadingScreen({ className = '', loadingMessage }) {
@ -7,5 +8,10 @@ export default function LoadingScreen({ className = '', loadingMessage }) {
<Spinner color="#1B344D" /> <Spinner color="#1B344D" />
<div className="loading-screen__message">{loadingMessage}</div> <div className="loading-screen__message">{loadingMessage}</div>
</div> </div>
); )
}
LoadingScreen.propTypes = {
className: PropTypes.string,
loadingMessage: PropTypes.string,
} }

@ -1,4 +1,5 @@
import React, {Component, PropTypes} from 'react' import React, { Component } from 'react'
import PropTypes from 'prop-types'
import Markdown from 'react-markdown' import Markdown from 'react-markdown'
import {connect} from 'react-redux' import {connect} from 'react-redux'
import debounce from 'lodash.debounce' import debounce from 'lodash.debounce'
@ -12,25 +13,26 @@ class NoticeScreen extends Component {
lastUnreadNotice: PropTypes.shape({ lastUnreadNotice: PropTypes.shape({
title: PropTypes.string, title: PropTypes.string,
date: PropTypes.string, date: PropTypes.string,
body: PropTypes.string body: PropTypes.string,
}), }),
next: PropTypes.func.isRequired next: PropTypes.func.isRequired,
markNoticeRead: PropTypes.func,
}; };
static defaultProps = { static defaultProps = {
lastUnreadNotice: {} lastUnreadNotice: {},
}; };
state = { state = {
atBottom: false, atBottom: false,
} }
componentDidMount() { componentDidMount () {
this.onScroll() this.onScroll()
} }
acceptTerms = () => { acceptTerms = () => {
const { markNoticeRead, lastUnreadNotice, next } = this.props; const { markNoticeRead, lastUnreadNotice, next } = this.props
const defer = markNoticeRead(lastUnreadNotice) const defer = markNoticeRead(lastUnreadNotice)
.then(() => this.setState({ atBottom: false })) .then(() => this.setState({ atBottom: false }))
@ -43,17 +45,17 @@ class NoticeScreen extends Component {
if (this.state.atBottom) return if (this.state.atBottom) return
const target = document.querySelector('.tou__body') const target = document.querySelector('.tou__body')
const {scrollTop, offsetHeight, scrollHeight} = target; const {scrollTop, offsetHeight, scrollHeight} = target
const atBottom = scrollTop + offsetHeight >= scrollHeight; const atBottom = scrollTop + offsetHeight >= scrollHeight
this.setState({atBottom: atBottom}) this.setState({atBottom: atBottom})
}, 25) }, 25)
render() { render () {
const { const {
address, address,
lastUnreadNotice: { title, body } lastUnreadNotice: { title, body },
} = this.props; } = this.props
const { atBottom } = this.state const { atBottom } = this.state
return ( return (
@ -84,9 +86,9 @@ class NoticeScreen extends Component {
export default connect( export default connect(
({ metamask: { selectedAddress, lastUnreadNotice } }) => ({ ({ metamask: { selectedAddress, lastUnreadNotice } }) => ({
lastUnreadNotice, lastUnreadNotice,
address: selectedAddress address: selectedAddress,
}), }),
dispatch => ({ dispatch => ({
markNoticeRead: notice => dispatch(markNoticeRead(notice)) markNoticeRead: notice => dispatch(markNoticeRead(notice)),
}) })
)(NoticeScreen) )(NoticeScreen)

@ -1,4 +1,5 @@
import React, {Component, PropTypes} from 'react' import React, { Component } from 'react'
import PropTypes from 'prop-types'
import {connect} from 'react-redux' import {connect} from 'react-redux'
import Identicon from '../../../../ui/app/components/identicon' import Identicon from '../../../../ui/app/components/identicon'
import Breadcrumbs from './breadcrumbs' import Breadcrumbs from './breadcrumbs'

@ -1,4 +1,5 @@
import React, {Component, PropTypes} from 'react' import React, { Component } from 'react'
import PropTypes from 'prop-types'
import classnames from 'classnames' import classnames from 'classnames'
import {qrcode} from 'qrcode-npm' import {qrcode} from 'qrcode-npm'
import {connect} from 'react-redux' import {connect} from 'react-redux'

@ -1,5 +1,5 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('react').PropTypes const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const actions = require('../../../ui/app/actions') const actions = require('../../../ui/app/actions')
const genAccountLink = require('etherscan-link').createAccountLink const genAccountLink = require('etherscan-link').createAccountLink

@ -1,5 +1,5 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('react').PropTypes const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const MenuDroppo = require('./menu-droppo') const MenuDroppo = require('./menu-droppo')
const extend = require('xtend') const extend = require('xtend')

@ -1,5 +1,5 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('react').PropTypes const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const actions = require('../actions') const actions = require('../actions')
const genAccountLink = require('etherscan-link').createAccountLink const genAccountLink = require('etherscan-link').createAccountLink

@ -1,5 +1,5 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('react').PropTypes const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const actions = require('../../../actions') const actions = require('../../../actions')
const genAccountLink = require('../../../../lib/account-link.js') const genAccountLink = require('../../../../lib/account-link.js')

@ -1,5 +1,5 @@
const Component = require('react').Component const Component = require('react').Component
const PropTypes = require('react').PropTypes const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const MenuDroppo = require('../../menu-droppo') const MenuDroppo = require('../../menu-droppo')
const extend = require('xtend') const extend = require('xtend')

@ -1,5 +1,5 @@
const { Component } = require('react') const { Component } = require('react')
const PropTypes = require('react').PropTypes const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const classnames = require('classnames') const classnames = require('classnames')
const R = require('ramda') const R = require('ramda')

@ -1,6 +1,6 @@
const { Component } = require('react') const { Component } = require('react')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const PropTypes = require('react').PropTypes const PropTypes = require('prop-types')
class LoadingIndicator extends Component { class LoadingIndicator extends Component {
renderMessage () { renderMessage () {

@ -1,6 +1,6 @@
const { Component } = require('react') const { Component } = require('react')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const PropTypes = require('react').PropTypes const PropTypes = require('prop-types')
const classnames = require('classnames') const classnames = require('classnames')
class TabBar extends Component { class TabBar extends Component {

Loading…
Cancel
Save