How to use the metronome-wallet-ui-logic/src/utils.errorPropTypes function in metronome-wallet-ui-logic

To help you get started, we’ve selected a few metronome-wallet-ui-logic examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github autonomoussoftware / metronome-wallet-desktop / src / components / onboarding / PasswordStep.js View on Github external
text-align: center;
`

const Green = styled.div`
  display: inline-block;
  color: ${p => p.theme.colors.success};
`

export default class PasswordStep extends React.Component {
  static propTypes = {
    requiredPasswordEntropy: PropTypes.number.isRequired,
    onPasswordSubmit: PropTypes.func.isRequired,
    onInputChange: PropTypes.func.isRequired,
    passwordAgain: PropTypes.string,
    password: PropTypes.string,
    errors: utils.errorPropTypes('passwordAgain', 'password')
  }

  onPasswordSubmit = e => {
    e.preventDefault()
    this.props.onPasswordSubmit({ clearOnError: false })
  }

  render() {
    return (
      
        <form data-testid="pass-form">
          
            Enter a strong password until the meter turns green.
          
          
            </form>
github autonomoussoftware / metronome-wallet-desktop / src / components / ChangePassword.js View on Github external
margin-bottom: -3.9rem;
`

class ChangePassword extends React.Component {
  static propTypes = {
    requiredPasswordEntropy: PropTypes.number.isRequired,
    newPasswordAgain: PropTypes.string,
    onInputChange: PropTypes.func.isRequired,
    newPassword: PropTypes.string,
    oldPassword: PropTypes.string,
    onSubmit: PropTypes.func.isRequired,
    history: PropTypes.shape({
      push: PropTypes.func.isRequired
    }).isRequired,
    status: PropTypes.oneOf(['init', 'pending', 'success', 'failure']),
    errors: utils.errorPropTypes(
      'newPasswordAgain',
      'newPassword',
      'oldPassword'
    ),
    error: PropTypes.string
  }

  static contextType = ToastsContext

  handleSubmitAndNavigate = e => {
    e.preventDefault()
    this.props.onSubmit()
  }

  componentDidUpdate(prevProps) {
    if (this.props.status === 'success' && prevProps.status !== 'success') {
github autonomoussoftware / metronome-wallet-desktop / src / components / Login.js View on Github external
import withLoginState from 'metronome-wallet-ui-logic/src/hocs/withLoginState'
import * as utils from 'metronome-wallet-ui-logic/src/utils'
import PropTypes from 'prop-types'
import React from 'react'

import { TextInput, AltLayout, Btn, Sp } from './common'

class Login extends React.Component {
  static propTypes = {
    onInputChange: PropTypes.func.isRequired,
    onSubmit: PropTypes.func.isRequired,
    password: PropTypes.string,
    errors: utils.errorPropTypes('password'),
    status: utils.statusPropTypes,
    error: PropTypes.string
  }

  render() {
    return (
      
        <form data-testid="login-form">
          
            </form>
github autonomoussoftware / metronome-wallet-desktop / src / components / onboarding / VerifyMnemonicStep.js View on Github external
import PropTypes from 'prop-types'
import React from 'react'

import { TextInput, AltLayout, Btn, Sp } from '../common'
import SecondaryBtn from './SecondaryBtn'
import Message from './Message'

export default class VerifyMnemonicStep extends React.Component {
  static propTypes = {
    onMnemonicCopiedToggled: PropTypes.func.isRequired,
    onMnemonicAccepted: PropTypes.func.isRequired,
    onInputChange: PropTypes.func.isRequired,
    mnemonicAgain: PropTypes.string,
    shouldSubmit: PropTypes.func.isRequired,
    getTooltip: PropTypes.func.isRequired,
    errors: utils.errorPropTypes('mnemonicAgain')
  }

  render() {
    return (
      
        <form data-testid="mnemonic-form">
          
            To verify you have copied the recovery passphrase correctly, enter
            the 12 words provided before in the field below.
          
          
            </form>
github autonomoussoftware / metronome-wallet-desktop / src / components / onboarding / UserMnemonicStep.js View on Github external
import PropTypes from 'prop-types'
import React from 'react'

import { TextInput, AltLayout, Btn, Sp } from '../common'
import SecondaryBtn from './SecondaryBtn'
import Message from './Message'

export default class UserMnemonic extends React.Component {
  static propTypes = {
    onUseUserMnemonicToggled: PropTypes.func.isRequired,
    onMnemonicAccepted: PropTypes.func.isRequired,
    onInputChange: PropTypes.func.isRequired,
    userMnemonic: PropTypes.string,
    shouldSubmit: PropTypes.func.isRequired,
    getTooltip: PropTypes.func.isRequired,
    errors: utils.errorPropTypes('userMnemonic')
  }

  render() {
    return (
      
        <form data-testid="mnemonic-form">
          
            Enter a valid 12 word passphrase to recover a previously created
            wallet.
          
          
            </form>