mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-23 17:47:24 +00:00
fix: modal styling and phone collection errors
This commit is contained in:
parent
229cca975c
commit
d5b83c544f
7 changed files with 51 additions and 59 deletions
|
@ -158,7 +158,7 @@ class CardVerify extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
button="alt"
|
button="primary"
|
||||||
label={this.props.label}
|
label={this.props.label}
|
||||||
icon={icons.LOCK}
|
icon={icons.LOCK}
|
||||||
disabled={this.props.disabled || this.state.open || this.hasPendingClick}
|
disabled={this.props.disabled || this.state.open || this.hasPendingClick}
|
||||||
|
|
|
@ -36,6 +36,8 @@ export class FormField extends React.PureComponent<Props> {
|
||||||
...inputProps
|
...inputProps
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
const errorMessage = typeof error === 'object' ? error.message : error;
|
||||||
|
|
||||||
let input;
|
let input;
|
||||||
if (type) {
|
if (type) {
|
||||||
if (type === 'select') {
|
if (type === 'select') {
|
||||||
|
@ -65,13 +67,13 @@ export class FormField extends React.PureComponent<Props> {
|
||||||
'form-field--stretch': stretch || type === 'markdown',
|
'form-field--stretch': stretch || type === 'markdown',
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
{(label || error) && (
|
{(label || errorMessage) && (
|
||||||
<label
|
<label
|
||||||
className={classnames('form-field__label', { 'form-field__error': error })}
|
className={classnames('form-field__label', { 'form-field__error': errorMessage })}
|
||||||
htmlFor={name}
|
htmlFor={name}
|
||||||
>
|
>
|
||||||
{!error && label}
|
{!errorMessage && label}
|
||||||
{error}
|
{errorMessage}
|
||||||
</label>
|
</label>
|
||||||
)}
|
)}
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// I'll come back to this
|
// I'll come back to this
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Form, FormRow, FormField } from 'component/common/form';
|
import { Form, FormRow, FormField, Submit } from 'component/common/form';
|
||||||
|
|
||||||
const os = require('os').type();
|
const os = require('os').type();
|
||||||
const countryCodes = require('country-data')
|
const countryCodes = require('country-data')
|
||||||
|
@ -77,37 +77,30 @@ class UserPhoneNew extends React.PureComponent {
|
||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
<Form onSubmit={this.handleSubmit.bind(this)}>
|
<Form onSubmit={this.handleSubmit.bind(this)}>
|
||||||
<div className="form-row-phone">
|
<FormRow>
|
||||||
<FormField
|
<FormField type="select" name="country-codes" onChange={this.handleSelect.bind(this)}>
|
||||||
onChange={this.handleSelect.bind(this)}
|
|
||||||
render={() => (
|
|
||||||
<select>
|
|
||||||
{countryCodes.map((country, index) => (
|
{countryCodes.map((country, index) => (
|
||||||
<option key={index} value={country.countryCallingCode}>
|
<option key={index} value={country.countryCallingCode}>
|
||||||
{os === 'Darwin' ? country.emoji : `(${country.alpha2})`}{' '}
|
{os === 'Darwin' ? country.emoji : `(${country.alpha2})`}{' '}
|
||||||
{country.countryCallingCode}
|
{country.countryCallingCode}
|
||||||
</option>
|
</option>
|
||||||
))}
|
))}
|
||||||
</select>
|
</FormField>
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<FormField
|
<FormField
|
||||||
errorMessage={phoneErrorMessage}
|
|
||||||
onChange={event => {
|
|
||||||
this.handleChanged(event);
|
|
||||||
}}
|
|
||||||
render={() => (
|
|
||||||
<input
|
|
||||||
type="text"
|
type="text"
|
||||||
placeholder={this.state.country_code === '+1' ? '(555) 555-5555' : '5555555555'}
|
placeholder={this.state.country_code === '+1' ? '(555) 555-5555' : '5555555555'}
|
||||||
name="phone"
|
name="phone"
|
||||||
value={this.state.phone}
|
value={this.state.phone}
|
||||||
|
error={phoneErrorMessage}
|
||||||
|
onChange={event => {
|
||||||
|
this.handleChanged(event);
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
</FormRow>
|
||||||
/>
|
<div className="card__actions card__actions--center">
|
||||||
</div>
|
|
||||||
<Submit label="Submit" disabled={isPending} />
|
<Submit label="Submit" disabled={isPending} />
|
||||||
{cancelButton}
|
{cancelButton}
|
||||||
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import { Form, FormElement, Submit } from 'component/common/form';
|
import { Form, FormField, Submit } from 'component/common/form';
|
||||||
|
|
||||||
class UserPhoneVerify extends React.PureComponent {
|
class UserPhoneVerify extends React.PureComponent {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
@ -37,31 +37,27 @@ class UserPhoneVerify extends React.PureComponent {
|
||||||
{__(
|
{__(
|
||||||
`Please enter the verification code sent to +${countryCode}${phone}. Didn't receive it? `
|
`Please enter the verification code sent to +${countryCode}${phone}. Didn't receive it? `
|
||||||
)}
|
)}
|
||||||
<Button onClick={this.reset.bind(this)} label="Go back." />
|
<Button button="link" onClick={this.reset.bind(this)} label="Go back." />
|
||||||
</p>
|
</p>
|
||||||
<FormElement
|
<FormField
|
||||||
label={__('Verification Code')}
|
|
||||||
errorMessage={phoneErrorMessage}
|
|
||||||
render={() => (
|
|
||||||
<input
|
|
||||||
type="text"
|
type="text"
|
||||||
name="code"
|
name="code"
|
||||||
value={this.state.code}
|
value={this.state.code}
|
||||||
onChange={event => {
|
onChange={event => {
|
||||||
this.handleCodeChanged(event);
|
this.handleCodeChanged(event);
|
||||||
}}
|
}}
|
||||||
/>
|
label={__('Verification Code')}
|
||||||
)}
|
error={phoneErrorMessage}
|
||||||
/>
|
/>
|
||||||
{/* render help separately so it always shows */}
|
{/* render help separately so it always shows */}
|
||||||
<div className="form-field__helper">
|
<div className="form-field__helper">
|
||||||
<p>
|
<p>
|
||||||
{__('Email')} <Button href="mailto:help@lbry.io" label="help@lbry.io" /> or join our{' '}
|
{__('Email')} <Button button="link" href="mailto:help@lbry.io" label="help@lbry.io" />{' '}
|
||||||
<Button href="https://chat.lbry.io" label="chat" />{' '}
|
or join our <Button button="link" href="https://chat.lbry.io" label="chat" />{' '}
|
||||||
{__('if you encounter any trouble with your code.')}
|
{__('if you encounter any trouble with your code.')}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="form-row-submit">
|
<div className="card__actions card__actions--center">
|
||||||
<Submit label={__('Verify')} />
|
<Submit label={__('Verify')} />
|
||||||
{cancelButton}
|
{cancelButton}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -60,6 +60,7 @@ class UserVerify extends React.PureComponent {
|
||||||
<div className="meta">
|
<div className="meta">
|
||||||
{__('A $1 authorization may temporarily appear with your provider.')}{' '}
|
{__('A $1 authorization may temporarily appear with your provider.')}{' '}
|
||||||
<Button
|
<Button
|
||||||
|
button="link"
|
||||||
href="https://lbry.io/faq/identity-requirements"
|
href="https://lbry.io/faq/identity-requirements"
|
||||||
label={__('Read more about why we do this.')}
|
label={__('Read more about why we do this.')}
|
||||||
/>
|
/>
|
||||||
|
@ -80,7 +81,7 @@ class UserVerify extends React.PureComponent {
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
verifyPhone();
|
verifyPhone();
|
||||||
}}
|
}}
|
||||||
button="alt"
|
button="primary"
|
||||||
icon={icons.PHONE}
|
icon={icons.PHONE}
|
||||||
label={__('Submit Phone Number')}
|
label={__('Submit Phone Number')}
|
||||||
/>
|
/>
|
||||||
|
@ -88,11 +89,11 @@ class UserVerify extends React.PureComponent {
|
||||||
<div className="card__content">
|
<div className="card__content">
|
||||||
<div className="meta">
|
<div className="meta">
|
||||||
{__('Standard messaging rates apply. Having trouble?')}{' '}
|
{__('Standard messaging rates apply. Having trouble?')}{' '}
|
||||||
<Button href="https://lbry.io/faq/phone" label={__('Read more.')} />
|
<Button button="link" href="https://lbry.io/faq/phone" label={__('Read more.')} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section className="card card--form">
|
<section className="card card--section">
|
||||||
<div className="card__title">
|
<div className="card__title">
|
||||||
<h3>{__('3) Proof via Chat')}</h3>
|
<h3>{__('3) Proof via Chat')}</h3>
|
||||||
</div>
|
</div>
|
||||||
|
@ -111,7 +112,7 @@ class UserVerify extends React.PureComponent {
|
||||||
<div className="card__actions">
|
<div className="card__actions">
|
||||||
<Button
|
<Button
|
||||||
href="https://chat.lbry.io"
|
href="https://chat.lbry.io"
|
||||||
button="alt"
|
button="primary"
|
||||||
icon={icons.MESSAGE}
|
icon={icons.MESSAGE}
|
||||||
label={__('Join LBRY Chat')}
|
label={__('Join LBRY Chat')}
|
||||||
/>
|
/>
|
||||||
|
@ -129,7 +130,7 @@ class UserVerify extends React.PureComponent {
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="card__actions">
|
<div className="card__actions">
|
||||||
<Button onClick={() => navigate('/discover')} button="alt" label={__('Skip Rewards')} />
|
<Button onClick={() => navigate('/discover')} button="primary" label={__('Skip Rewards')} />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
|
|
|
@ -21,24 +21,24 @@ const ModalCreditIntro = props => {
|
||||||
</p>
|
</p>
|
||||||
{currentBalance <= 0 && (
|
{currentBalance <= 0 && (
|
||||||
<p>
|
<p>
|
||||||
You currently have <CreditAmount amount={currentBalance} />, so the actions you can take
|
You currently have <CreditAmount noStyle amount={currentBalance} />, so the actions you
|
||||||
are limited.
|
can take are limited.
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
<p>
|
<p>
|
||||||
There are a variety of ways to get credits, including more than{' '}
|
There are a variety of ways to get credits, including more than{' '}
|
||||||
{totalRewardValue ? (
|
{totalRewardValue ? (
|
||||||
<CreditAmount amount={totalRewardRounded} />
|
<CreditAmount noStyle amount={totalRewardRounded} />
|
||||||
) : (
|
) : (
|
||||||
<span className="credit-amount">{__('?? credits')}</span>
|
<span className="credit-amount">{__('?? credits')}</span>
|
||||||
)}{' '}
|
)}{' '}
|
||||||
{__(' in free rewards for participating in the LBRY beta.')}
|
{__(' in free rewards for participating in the LBRY beta.')}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div className="modal__buttons">
|
<div className="card__actions card__actions--center">
|
||||||
<Button button="primary" onClick={addBalance} label={__('Get Credits')} />
|
<Button button="primary" onClick={addBalance} label={__('Get Credits')} />
|
||||||
<Button
|
<Button
|
||||||
button="alt"
|
button="link"
|
||||||
onClick={closeModal}
|
onClick={closeModal}
|
||||||
label={currentBalance <= 0 ? __('Use Without LBC') : __('Meh, Not Now')}
|
label={currentBalance <= 0 ? __('Use Without LBC') : __('Meh, Not Now')}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -8,7 +8,7 @@ class ModalPhoneCollection extends React.PureComponent {
|
||||||
renderInner() {
|
renderInner() {
|
||||||
const { closeModal, phone, user } = this.props;
|
const { closeModal, phone, user } = this.props;
|
||||||
|
|
||||||
const cancelButton = <Button button="text" onClick={closeModal} label={__('Not Now')} />;
|
const cancelButton = <Button button="link" onClick={closeModal} label={__('Not Now')} />;
|
||||||
|
|
||||||
if (!user.phone_number && !phone) {
|
if (!user.phone_number && !phone) {
|
||||||
return <UserPhoneNew cancelButton={cancelButton} />;
|
return <UserPhoneNew cancelButton={cancelButton} />;
|
||||||
|
|
Loading…
Add table
Reference in a new issue