diff --git a/src/renderer/component/common/credit-amount.jsx b/src/renderer/component/common/credit-amount.jsx index 0eee4ec5e..ac6538b0e 100644 --- a/src/renderer/component/common/credit-amount.jsx +++ b/src/renderer/component/common/credit-amount.jsx @@ -23,6 +23,7 @@ class CreditAmount extends React.PureComponent { showFullPrice: false, showPlus: false, showLBC: true, + badge: true, }; render() { diff --git a/src/renderer/component/transactionList/internal/transaction-list-item.jsx b/src/renderer/component/transactionList/internal/transaction-list-item.jsx index 997b85af1..fb5960dda 100644 --- a/src/renderer/component/transactionList/internal/transaction-list-item.jsx +++ b/src/renderer/component/transactionList/internal/transaction-list-item.jsx @@ -53,12 +53,12 @@ class TransactionListItem extends React.PureComponent { return ( - +
{fee !== 0 && ( - + )} diff --git a/src/renderer/component/userPhoneNew/view.jsx b/src/renderer/component/userPhoneNew/view.jsx index dff273299..2bc7edc3c 100644 --- a/src/renderer/component/userPhoneNew/view.jsx +++ b/src/renderer/component/userPhoneNew/view.jsx @@ -1,6 +1,5 @@ -// I'll come back to this -/* eslint-disable */ -import React from 'react'; +// @flow +import * as React from 'react'; import { Form, FormRow, FormField, Submit } from 'component/common/form'; const os = require('os').type(); @@ -20,67 +19,86 @@ const countryCodes = require('country-data') return 0; }); -class UserPhoneNew extends React.PureComponent { - constructor(props) { +type Props = { + addUserPhone: (string, string) => void, + cancelButton: React.Node, + phoneErrorMessage: ?string, + isPending: boolean, +}; + +type State = { + phone: string, + countryCode: string, +}; + +class UserPhoneNew extends React.PureComponent { + constructor(props: Props) { super(props); this.state = { phone: '', - country_code: '+1', + countryCode: '+1', }; - this.formatPhone = this.formatPhone.bind(this); + (this: any).formatPhone = this.formatPhone.bind(this); + (this: any).handleSubmit = this.handleSubmit.bind(this); + (this: any).handleSelect = this.handleSelect.bind(this); } - formatPhone(value) { - const { country_code } = this.state; - value = value.replace(/\D/g, ''); - if (country_code === '+1') { - if (!value) { + formatPhone(value: string) { + const { countryCode } = this.state; + const formattedNumber = value.replace(/\D/g, ''); + + if (countryCode === '+1') { + if (!formattedNumber) { return ''; - } else if (value.length < 4) { - return value; - } else if (value.length < 7) { - return `(${value.substring(0, 3)}) ${value.substring(3)}`; + } else if (formattedNumber.length < 4) { + return formattedNumber; + } else if (formattedNumber.length < 7) { + return `(${formattedNumber.substring(0, 3)}) ${formattedNumber.substring(3)}`; } - const fullNumber = `(${value.substring(0, 3)}) ${value.substring(3, 6)}-${value.substring( + const fullNumber = `(${formattedNumber.substring(0, 3)}) ${formattedNumber.substring( + 3, 6 - )}`; + )}-${formattedNumber.substring(6)}`; return fullNumber.length <= 14 ? fullNumber : fullNumber.substring(0, 14); } - return value; + return formattedNumber; } - handleChanged(event) { + handleChanged(event: SyntheticInputEvent<*>) { this.setState({ phone: this.formatPhone(event.target.value), }); } - handleSelect(event) { - this.setState({ country_code: event.target.value }); + handleSelect(event: SyntheticInputEvent<*>) { + this.setState({ countryCode: event.target.value }); } handleSubmit() { - const { phone, country_code } = this.state; - this.props.addUserPhone(phone.replace(/\D/g, ''), country_code.substring(1)); + const { phone, countryCode } = this.state; + this.props.addUserPhone(phone.replace(/\D/g, ''), countryCode.substring(1)); } render() { const { cancelButton, phoneErrorMessage, isPending } = this.props; return ( -
-

- {__( - 'Enter your phone number and we will send you a verification code. We will not share your phone number with third parties.' - )} -

-
- - - {countryCodes.map((country, index) => ( -
+ ); } } export default UserPhoneNew; -/* eslint-enable */ diff --git a/src/renderer/component/userPhoneVerify/view.jsx b/src/renderer/component/userPhoneVerify/view.jsx index 9d507e710..349cea98c 100644 --- a/src/renderer/component/userPhoneVerify/view.jsx +++ b/src/renderer/component/userPhoneVerify/view.jsx @@ -2,7 +2,7 @@ /* eslint-disable */ import React from 'react'; import Button from 'component/button'; -import { Form, FormField, Submit } from 'component/common/form'; +import { Form, FormField, Submit, FormRow } from 'component/common/form'; class UserPhoneVerify extends React.PureComponent { constructor(props) { @@ -32,35 +32,44 @@ class UserPhoneVerify extends React.PureComponent { render() { const { cancelButton, phoneErrorMessage, phone, countryCode } = this.props; return ( -
-

- {__( - `Please enter the verification code sent to +${countryCode}${phone}. Didn't receive it? ` - )} -