Direct link to account creation (#1266)

* create link

* comment
This commit is contained in:
Thibaut Sardan 2019-06-03 11:51:08 +02:00 committed by Jaco Greeff
parent 67346c83a1
commit 66eb434e31
3 changed files with 15 additions and 6 deletions

View File

@ -26,10 +26,16 @@ type State = {
};
class Overview extends React.PureComponent<Props, State> {
state: State = {
isCreateOpen: false,
isImportOpen: false
};
constructor (props: Props) {
super(props);
const { state : { isCreateOpen = false } = {} } = this.props.location;
this.state = {
isCreateOpen,
isImportOpen: false
};
}
render () {
const { accounts, onStatusChange, t } = this.props;

View File

@ -64,7 +64,7 @@ class Accounts extends React.PureComponent<Props, State> {
You don't have any accounts. Some features are currently hidden and will only become available once you have accounts.
{' '}
<Link
to ='/accounts'
to = {{ pathname: '/accounts', state: { isCreateOpen: true } }}
onClick={this.onClose}
>
{t('Create an account now.')}

View File

@ -5,6 +5,9 @@
import { WithTranslation } from 'react-i18next';
import { RpcRxInterface } from '@polkadot/rpc-rx/types';
import { ActionStatus } from '@polkadot/ui-app/Status/types';
// location props passed by react-router from a link can contain a "state" object
// this is used for Account creation link to popup the account creation modal
import { LocationDescriptorObject } from 'history';
export type BareProps = {
className?: string,
@ -15,7 +18,7 @@ export type BareProps = {
export type AppProps = {
basePath: string,
location: Location,
location: LocationDescriptorObject,
onStatusChange: (status: ActionStatus) => void
};