This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(onboarding): allow setting wallet name
Allow setting the wallet name in the onboarding process rather than the wallet alias. This makes more sense since local wallets operate in private mode and therefore do not broadcast their address or alias to the network. Fix #1025
- Loading branch information
Showing
44 changed files
with
228 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import { FormattedMessage, injectIntl } from 'react-intl' | ||
import { Box } from 'rebass' | ||
import { Bar, Form, Header, Input } from 'components/UI' | ||
import messages from './messages' | ||
|
||
class Name extends React.Component { | ||
static propTypes = { | ||
wizardApi: PropTypes.object, | ||
wizardState: PropTypes.object, | ||
name: PropTypes.string, | ||
setName: PropTypes.func.isRequired | ||
} | ||
|
||
static defaultProps = { | ||
wizardApi: {}, | ||
wizardState: {}, | ||
name: '' | ||
} | ||
|
||
setFormApi = formApi => { | ||
this.formApi = formApi | ||
} | ||
|
||
handleSubmit = values => { | ||
const { setName } = this.props | ||
setName(values.name) | ||
} | ||
|
||
render() { | ||
const { wizardApi, wizardState, name, setName, intl, ...rest } = this.props | ||
const { getApi, onChange, preSubmit, onSubmit, onSubmitFailure } = wizardApi | ||
const { currentItem } = wizardState | ||
|
||
return ( | ||
<Form | ||
{...rest} | ||
getApi={formApi => { | ||
this.setFormApi(formApi) | ||
if (getApi) { | ||
getApi(formApi) | ||
} | ||
}} | ||
onChange={onChange && (formState => onChange(formState, currentItem))} | ||
preSubmit={preSubmit} | ||
onSubmit={values => { | ||
this.handleSubmit(values) | ||
if (onSubmit) { | ||
onSubmit(values) | ||
} | ||
}} | ||
onSubmitFailure={onSubmitFailure} | ||
> | ||
{({ formState }) => { | ||
const shouldValidateInline = formState.submits > 0 | ||
return ( | ||
<> | ||
<Header | ||
title={<FormattedMessage {...messages.wallet_name_title} />} | ||
subtitle={<FormattedMessage {...messages.wallet_name_description} />} | ||
align="left" | ||
/> | ||
<Bar my={4} /> | ||
<Box> | ||
<Input | ||
autoFocus | ||
field="name" | ||
name="name" | ||
label={<FormattedMessage {...messages.wallet_name_label} />} | ||
initialValue={name} | ||
validateOnBlur={shouldValidateInline} | ||
validateOnChange={shouldValidateInline} | ||
/> | ||
</Box> | ||
</> | ||
) | ||
}} | ||
</Form> | ||
) | ||
} | ||
} | ||
|
||
export default injectIntl(Name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.