Bump dev, adjust JSX props (#303)
This commit is contained in:
parent
8b054495f9
commit
0be206d4e0
@ -7,9 +7,9 @@
|
|||||||
"packages/*"
|
"packages/*"
|
||||||
],
|
],
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"@polkadot/api": "^1.9.0-beta.26",
|
"@polkadot/api": "^1.9.1",
|
||||||
"@polkadot/keyring": "^2.7.1",
|
"@polkadot/keyring": "^2.7.1",
|
||||||
"@polkadot/types": "^1.9.0-beta.26",
|
"@polkadot/types": "^1.9.1",
|
||||||
"@polkadot/util": "^2.7.1",
|
"@polkadot/util": "^2.7.1",
|
||||||
"@polkadot/util-crypto": "^2.7.1",
|
"@polkadot/util-crypto": "^2.7.1",
|
||||||
"babel-core": "^7.0.0-bridge.0",
|
"babel-core": "^7.0.0-bridge.0",
|
||||||
@ -28,8 +28,8 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.9.0",
|
"@babel/core": "^7.9.0",
|
||||||
"@polkadot/dev": "^0.51.9",
|
"@polkadot/dev": "^0.52.1",
|
||||||
"@polkadot/typegen": "^1.9.0-beta.26",
|
"@polkadot/typegen": "^1.9.1",
|
||||||
"@types/jest": "^25.1.4",
|
"@types/jest": "^25.1.4",
|
||||||
"copy-webpack-plugin": "^5.1.1",
|
"copy-webpack-plugin": "^5.1.1",
|
||||||
"sinon-chrome": "^3.0.1"
|
"sinon-chrome": "^3.0.1"
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
"license": "Apache-2",
|
"license": "Apache-2",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.9.2",
|
"@babel/runtime": "^7.9.2",
|
||||||
"@polkadot/api": "^1.9.0-beta.26",
|
"@polkadot/api": "^1.9.1",
|
||||||
"@polkadot/keyring": "^2.7.1",
|
"@polkadot/keyring": "^2.7.1",
|
||||||
"@polkadot/ui-keyring": "^0.52.0-beta.21",
|
"@polkadot/ui-keyring": "^0.52.0-beta.21",
|
||||||
"extensionizer": "^1.0.1"
|
"extensionizer": "^1.0.1"
|
||||||
|
|||||||
@ -35,18 +35,32 @@ function Account ({ address, className, isExternal }: Props): React.ReactElement
|
|||||||
return (
|
return (
|
||||||
<div className={className}>
|
<div className={className}>
|
||||||
<Address
|
<Address
|
||||||
address={address}
|
|
||||||
name={editedName}
|
|
||||||
actions={(
|
actions={(
|
||||||
<>
|
<>
|
||||||
<MenuGroup>
|
<MenuGroup>
|
||||||
<MenuItem onClick={_toggleEdit}>Rename</MenuItem>
|
<MenuItem onClick={_toggleEdit}>Rename</MenuItem>
|
||||||
{!isExternal && <MenuItem to={`/account/derive/${address}`}>Derive New Account</MenuItem>}
|
{!isExternal && (
|
||||||
|
<MenuItem to={`/account/derive/${address}`}>Derive New Account</MenuItem>
|
||||||
|
)}
|
||||||
</MenuGroup>
|
</MenuGroup>
|
||||||
{!isExternal && <MenuItem isDanger to={`/account/export/${address}`}>Export Account</MenuItem>}
|
{!isExternal && (
|
||||||
<MenuItem isDanger to={`/account/forget/${address}`}>Forget Account</MenuItem>
|
<MenuItem
|
||||||
|
isDanger
|
||||||
|
to={`/account/export/${address}`}
|
||||||
|
>
|
||||||
|
Export Account
|
||||||
|
</MenuItem>
|
||||||
|
)}
|
||||||
|
<MenuItem
|
||||||
|
isDanger
|
||||||
|
to={`/account/forget/${address}`}
|
||||||
|
>
|
||||||
|
Forget Account
|
||||||
|
</MenuItem>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
address={address}
|
||||||
|
name={editedName}
|
||||||
>
|
>
|
||||||
{isEditing && (
|
{isEditing && (
|
||||||
<Name
|
<Name
|
||||||
|
|||||||
@ -30,7 +30,10 @@ export default function Accounts (): React.ReactElement<Props> {
|
|||||||
? <AddAccount />
|
? <AddAccount />
|
||||||
: (
|
: (
|
||||||
<>
|
<>
|
||||||
<Header showSettings text={'Accounts'} />
|
<Header
|
||||||
|
showSettings
|
||||||
|
text={'Accounts'}
|
||||||
|
/>
|
||||||
<AccountsArea>
|
<AccountsArea>
|
||||||
{accounts.map((json, index): React.ReactNode => (
|
{accounts.map((json, index): React.ReactNode => (
|
||||||
<Account
|
<Account
|
||||||
@ -44,14 +47,14 @@ export default function Accounts (): React.ReactElement<Props> {
|
|||||||
}
|
}
|
||||||
<ButtonArea>
|
<ButtonArea>
|
||||||
<ButtonWithSubtitle
|
<ButtonWithSubtitle
|
||||||
to='/account/create'
|
|
||||||
title='Create New Account'
|
|
||||||
subTitle='With new seed'
|
subTitle='With new seed'
|
||||||
|
title='Create New Account'
|
||||||
|
to='/account/create'
|
||||||
/>
|
/>
|
||||||
<ButtonWithSubtitle
|
<ButtonWithSubtitle
|
||||||
to='/account/import-seed'
|
|
||||||
title='Import an Account'
|
|
||||||
subTitle='I have a pre-existing seed'
|
subTitle='I have a pre-existing seed'
|
||||||
|
title='Import an Account'
|
||||||
|
to='/account/import-seed'
|
||||||
/>
|
/>
|
||||||
{mediaAllowed && (
|
{mediaAllowed && (
|
||||||
<QrButton to='/account/import-qr'>
|
<QrButton to='/account/import-qr'>
|
||||||
|
|||||||
@ -33,13 +33,16 @@ function Request ({ authId, className, isFirst, request: { origin }, url }: Prop
|
|||||||
<div className={className}>
|
<div className={className}>
|
||||||
<RequestInfo>
|
<RequestInfo>
|
||||||
<Info>
|
<Info>
|
||||||
<Icon icon='X' onClick={_onReject} />
|
<Icon
|
||||||
|
icon='X'
|
||||||
|
onClick={_onReject}
|
||||||
|
/>
|
||||||
<div className='tab-info'>
|
<div className='tab-info'>
|
||||||
An application, self-identifying as <span className='tab-name'>{origin}</span> is requesting access from{' '}
|
An application, self-identifying as <span className='tab-name'>{origin}</span> is requesting access from{' '}
|
||||||
<a
|
<a
|
||||||
href={url}
|
href={url}
|
||||||
target='_blank'
|
|
||||||
rel='noopener noreferrer'
|
rel='noopener noreferrer'
|
||||||
|
target='_blank'
|
||||||
>
|
>
|
||||||
<span className='tab-url'>{url}</span>
|
<span className='tab-url'>{url}</span>
|
||||||
</a>.
|
</a>.
|
||||||
@ -52,7 +55,12 @@ function Request ({ authId, className, isFirst, request: { origin }, url }: Prop
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<RejectButton>
|
<RejectButton>
|
||||||
<Link isDanger onClick={_onReject}>Reject</Link>
|
<Link
|
||||||
|
isDanger
|
||||||
|
onClick={_onReject}
|
||||||
|
>
|
||||||
|
Reject
|
||||||
|
</Link>
|
||||||
</RejectButton>
|
</RejectButton>
|
||||||
</RequestInfo>
|
</RequestInfo>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -12,7 +12,7 @@ interface Props {
|
|||||||
className?: string;
|
className?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
function CreationStep ({ step, onClick, className }: Props): React.ReactElement<Props> {
|
function CreationStep ({ className, onClick, step }: Props): React.ReactElement<Props> {
|
||||||
return (
|
return (
|
||||||
<div className={className}>
|
<div className={className}>
|
||||||
<div>
|
<div>
|
||||||
@ -20,7 +20,10 @@ function CreationStep ({ step, onClick, className }: Props): React.ReactElement<
|
|||||||
<CurrentStep>{step}</CurrentStep>
|
<CurrentStep>{step}</CurrentStep>
|
||||||
<TotalSteps>/2</TotalSteps>
|
<TotalSteps>/2</TotalSteps>
|
||||||
</div>
|
</div>
|
||||||
<ActionText text={step === 1 ? 'Cancel' : 'Back'} onClick={onClick} />
|
<ActionText
|
||||||
|
onClick={onClick}
|
||||||
|
text={step === 1 ? 'Cancel' : 'Back'}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,8 +6,8 @@ import React, { useState } from 'react';
|
|||||||
import { Button, ButtonArea, Checkbox, MnemonicSeed, VerticalSpace, Warning } from '../../components';
|
import { Button, ButtonArea, Checkbox, MnemonicSeed, VerticalSpace, Warning } from '../../components';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
seed: string;
|
|
||||||
onNextStep: () => void;
|
onNextStep: () => void;
|
||||||
|
seed: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const onCopy = (): void => {
|
const onCopy = (): void => {
|
||||||
@ -19,26 +19,29 @@ const onCopy = (): void => {
|
|||||||
document.execCommand('copy');
|
document.execCommand('copy');
|
||||||
};
|
};
|
||||||
|
|
||||||
function Mnemonic ({ seed, onNextStep }: Props): React.ReactElement<Props> {
|
function Mnemonic ({ onNextStep, seed }: Props): React.ReactElement<Props> {
|
||||||
const [isMnemonicSaved, setIsMnemonicSaved] = useState(false);
|
const [isMnemonicSaved, setIsMnemonicSaved] = useState(false);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Warning>
|
<Warning>Please write down your wallet’s mnemonic seed and keep it in a safe place. <br />
|
||||||
Please write down your wallet’s mnemonic seed and keep it in a safe place. <br />
|
Mnemonic seed is used to restore your wallet. Keep it carefully in case you lose your assets.</Warning>
|
||||||
Mnemonic seed is used to restore your wallet. Keep it carefully in case you lose your assets.
|
|
||||||
</Warning>
|
|
||||||
<MnemonicSeed
|
<MnemonicSeed
|
||||||
seed={seed}
|
|
||||||
onCopy={onCopy}
|
onCopy={onCopy}
|
||||||
|
seed={seed}
|
||||||
/>
|
/>
|
||||||
<VerticalSpace />
|
<VerticalSpace />
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={isMnemonicSaved}
|
checked={isMnemonicSaved}
|
||||||
onChange={setIsMnemonicSaved}
|
|
||||||
label='I have saved my mnemonic seed safely.'
|
label='I have saved my mnemonic seed safely.'
|
||||||
|
onChange={setIsMnemonicSaved}
|
||||||
/>
|
/>
|
||||||
<ButtonArea>
|
<ButtonArea>
|
||||||
<Button isDisabled={!isMnemonicSaved} onClick={onNextStep}>Next step</Button>
|
<Button
|
||||||
|
isDisabled={!isMnemonicSaved}
|
||||||
|
onClick={onNextStep}
|
||||||
|
>
|
||||||
|
Next step
|
||||||
|
</Button>
|
||||||
</ButtonArea>
|
</ButtonArea>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -48,14 +48,26 @@ export default function CreateAccount (): React.ReactElement {
|
|||||||
<CurrentStep>{step}</CurrentStep>
|
<CurrentStep>{step}</CurrentStep>
|
||||||
<TotalSteps>/2</TotalSteps>
|
<TotalSteps>/2</TotalSteps>
|
||||||
</div>
|
</div>
|
||||||
<ActionText text={step === 1 ? 'Cancel' : 'Back'} onClick={_onCancel} />
|
<ActionText
|
||||||
|
onClick={_onCancel}
|
||||||
|
text={step === 1 ? 'Cancel' : 'Back'}
|
||||||
|
/>
|
||||||
</CreationSteps>
|
</CreationSteps>
|
||||||
</Header>
|
</Header>
|
||||||
<Loading>{account && (step === 1 ? (
|
<Loading>{account && (step === 1
|
||||||
<Mnemonic seed={account.seed} onNextStep={_onNextStep} />
|
? (
|
||||||
) : (
|
<Mnemonic
|
||||||
<AccountName address={account.address} onCreate={_onCreate} />
|
onNextStep={_onNextStep}
|
||||||
))}</Loading>
|
seed={account.seed}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
: (
|
||||||
|
<AccountName
|
||||||
|
address={account.address}
|
||||||
|
onCreate={_onCreate}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
)}</Loading>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,13 +13,17 @@ interface Props {
|
|||||||
|
|
||||||
function Step ({ step, className }: Props): React.ReactElement<Props> {
|
function Step ({ step, className }: Props): React.ReactElement<Props> {
|
||||||
return (
|
return (
|
||||||
<Header text={
|
<Header
|
||||||
<>
|
className={className}
|
||||||
<span>Derive new account</span>
|
showBackArrow
|
||||||
<CurrentStep>{step}</CurrentStep>
|
text={
|
||||||
<TotalSteps>/2</TotalSteps>
|
<>
|
||||||
</>
|
<span>Derive new account</span>
|
||||||
} showBackArrow className={className} />
|
<CurrentStep>{step}</CurrentStep>
|
||||||
|
<TotalSteps>/2</TotalSteps>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||||
|
|
||||||
import React, { useCallback, useContext, useState } from 'react';
|
import React, { useCallback, useContext, useState } from 'react';
|
||||||
import { RouteComponentProps } from 'react-router';
|
import { RouteComponentProps, withRouter } from 'react-router';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import { ActionContext, Address, Button, ButtonArea, InputWithLabel, VerticalSpace } from '../../components';
|
import { ActionContext, Address, Button, ButtonArea, InputWithLabel, VerticalSpace } from '../../components';
|
||||||
@ -13,7 +13,13 @@ import Step from './Step';
|
|||||||
|
|
||||||
type Props = RouteComponentProps<{ address: string }>;
|
type Props = RouteComponentProps<{ address: string }>;
|
||||||
|
|
||||||
export default function Derive ({ match: { params: { address: parentAddress } } }: Props): React.ReactElement<Props> {
|
const DeriveButton = styled(Button)`
|
||||||
|
margin-left: 24px;
|
||||||
|
margin-right: 24px;
|
||||||
|
width: auto;
|
||||||
|
`;
|
||||||
|
|
||||||
|
function Derive ({ match: { params: { address: parentAddress } } }: Props): React.ReactElement<Props> {
|
||||||
const onAction = useContext(ActionContext);
|
const onAction = useContext(ActionContext);
|
||||||
const [account, setAccount] = useState<null | { address: string; suri: string }>(null);
|
const [account, setAccount] = useState<null | { address: string; suri: string }>(null);
|
||||||
const [name, setName] = useState<string | null>(null);
|
const [name, setName] = useState<string | null>(null);
|
||||||
@ -38,21 +44,30 @@ export default function Derive ({ match: { params: { address: parentAddress } }
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Step step={derivationConfirmed ? 2 : 1} />
|
<Step step={derivationConfirmed ? 2 : 1} />
|
||||||
{!derivationConfirmed && <InputWithLabel
|
{!derivationConfirmed && (
|
||||||
isFocused
|
<InputWithLabel
|
||||||
isError={!isProperParentPassword}
|
data-export-password
|
||||||
label='enter the password for the account you want to derive from'
|
isError={!isProperParentPassword}
|
||||||
onChange={_onParentPasswordEnter}
|
isFocused
|
||||||
type='password'
|
label='enter the password for the account you want to derive from'
|
||||||
data-export-password
|
onChange={_onParentPasswordEnter}
|
||||||
/>}
|
type='password'
|
||||||
{!derivationConfirmed && <DeriveButton
|
/>
|
||||||
isDisabled={!isProperParentPassword}
|
)}
|
||||||
onClick={(): void => setDerivationConfirmed(true)}
|
{!derivationConfirmed && (
|
||||||
>
|
<DeriveButton
|
||||||
I want to derive from this account
|
isDisabled={!isProperParentPassword}
|
||||||
</DeriveButton>}
|
onClick={(): void => setDerivationConfirmed(true)}
|
||||||
{isProperParentPassword && derivationConfirmed && <Name onChange={setName} isFocused />}
|
>
|
||||||
|
I want to derive from this account
|
||||||
|
</DeriveButton>
|
||||||
|
)}
|
||||||
|
{isProperParentPassword && derivationConfirmed && (
|
||||||
|
<Name
|
||||||
|
isFocused
|
||||||
|
onChange={setName}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
{isProperParentPassword && derivationConfirmed && parentPassword && name && <DerivationPath
|
{isProperParentPassword && derivationConfirmed && parentPassword && name && <DerivationPath
|
||||||
onChange={setAccount}
|
onChange={setAccount}
|
||||||
parentAddress={parentAddress}
|
parentAddress={parentAddress}
|
||||||
@ -75,8 +90,4 @@ export default function Derive ({ match: { params: { address: parentAddress } }
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const DeriveButton = styled(Button)`
|
export default withRouter(Derive);
|
||||||
margin-left: 24px;
|
|
||||||
margin-right: 24px;
|
|
||||||
width: auto;
|
|
||||||
`;
|
|
||||||
|
|||||||
@ -31,7 +31,7 @@ describe('Export component', () => {
|
|||||||
wrapper = mount(
|
wrapper = mount(
|
||||||
<MemoryRouter initialEntries={ [`/account/export/${VALID_ADDRESS}`] }>
|
<MemoryRouter initialEntries={ [`/account/export/${VALID_ADDRESS}`] }>
|
||||||
<ThemeProvider theme={themes.dark}>
|
<ThemeProvider theme={themes.dark}>
|
||||||
<Route path='/account/export/:address' component={ Export } />
|
<Route path='/account/export/:address'><Export /></Route>
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
</MemoryRouter>
|
</MemoryRouter>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -45,29 +45,35 @@ function Export ({ match: { params: { address } } }: Props): React.ReactElement<
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Header text='Export account' showBackArrow/>
|
<Header
|
||||||
|
showBackArrow
|
||||||
|
text='Export account'
|
||||||
|
/>
|
||||||
<div>
|
<div>
|
||||||
<Address address={address}>
|
<Address address={address}>
|
||||||
<MovedWarning danger>You are exporting your account. Keep it safe and don't share it with anyone.</MovedWarning>
|
<MovedWarning danger>You are exporting your account. Keep it safe and don't share it with anyone.</MovedWarning>
|
||||||
<ActionArea>
|
<ActionArea>
|
||||||
<InputWithLabel
|
<InputWithLabel
|
||||||
|
data-export-password
|
||||||
isError={pass.length < MIN_LENGTH || wrongPasswordHighlight}
|
isError={pass.length < MIN_LENGTH || wrongPasswordHighlight}
|
||||||
label='password for this account'
|
label='password for this account'
|
||||||
onChange={setPass}
|
onChange={setPass}
|
||||||
type='password'
|
type='password'
|
||||||
data-export-password
|
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
isDisabled={pass.length === 0}
|
|
||||||
isDanger
|
|
||||||
onClick={_onExportButtonClick}
|
|
||||||
className='export-button'
|
className='export-button'
|
||||||
data-export-button
|
data-export-button
|
||||||
|
isDanger
|
||||||
|
isDisabled={pass.length === 0}
|
||||||
|
onClick={_onExportButtonClick}
|
||||||
>
|
>
|
||||||
I want to export this account
|
I want to export this account
|
||||||
</Button>
|
</Button>
|
||||||
<CancelButton>
|
<CancelButton>
|
||||||
<ActionText text='Cancel' onClick={(): void => onAction('/')} />
|
<ActionText
|
||||||
|
onClick={(): void => onAction('/')}
|
||||||
|
text='Cancel'
|
||||||
|
/>
|
||||||
</CancelButton>
|
</CancelButton>
|
||||||
</ActionArea>
|
</ActionArea>
|
||||||
</Address>
|
</Address>
|
||||||
|
|||||||
@ -21,7 +21,10 @@ function Forget ({ match: { params: { address } } }: Props): React.ReactElement<
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Header text='Forget account' showBackArrow/>
|
<Header
|
||||||
|
showBackArrow
|
||||||
|
text='Forget account'
|
||||||
|
/>
|
||||||
<div>
|
<div>
|
||||||
<Address address={address}>
|
<Address address={address}>
|
||||||
<MovedWarning danger>
|
<MovedWarning danger>
|
||||||
@ -35,7 +38,10 @@ function Forget ({ match: { params: { address } } }: Props): React.ReactElement<
|
|||||||
I want to forget this account
|
I want to forget this account
|
||||||
</Button>
|
</Button>
|
||||||
<CancelButton>
|
<CancelButton>
|
||||||
<ActionText text='Cancel' onClick={(): void => onAction('/')} />
|
<ActionText
|
||||||
|
onClick={(): void => onAction('/')}
|
||||||
|
text='Cancel'
|
||||||
|
/>
|
||||||
</CancelButton>
|
</CancelButton>
|
||||||
</ActionArea>
|
</ActionArea>
|
||||||
</Address>
|
</Address>
|
||||||
|
|||||||
@ -27,7 +27,10 @@ export default function ImportQr (): React.ReactElement<Props> {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Header showBackArrow text='Scan Address Qr' />
|
<Header
|
||||||
|
showBackArrow
|
||||||
|
text='Scan Address Qr'
|
||||||
|
/>
|
||||||
{!account && (
|
{!account && (
|
||||||
<div>
|
<div>
|
||||||
<QrScanAddress onScan={setAccount} />
|
<QrScanAddress onScan={setAccount} />
|
||||||
|
|||||||
@ -42,13 +42,16 @@ export default function Import (): React.ReactElement<Props> {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<HeaderWithSmallerMargin text='Import account' showBackArrow />
|
<HeaderWithSmallerMargin
|
||||||
|
showBackArrow
|
||||||
|
text='Import account'
|
||||||
|
/>
|
||||||
<SeedInput
|
<SeedInput
|
||||||
rowsCount={2}
|
|
||||||
isError={!account}
|
isError={!account}
|
||||||
isFocused
|
isFocused
|
||||||
label='existing 12 or 24-word mnemonic seed'
|
label='existing 12 or 24-word mnemonic seed'
|
||||||
onChange={_onChangeSeed}
|
onChange={_onChangeSeed}
|
||||||
|
rowsCount={2}
|
||||||
/>
|
/>
|
||||||
{account && <Name onChange={setName} />}
|
{account && <Name onChange={setName} />}
|
||||||
{account && name && <Password onChange={setPassword} />}
|
{account && name && <Password onChange={setPassword} />}
|
||||||
|
|||||||
@ -61,7 +61,12 @@ function Request ({ className, metaId, request, url }: Props): React.ReactElemen
|
|||||||
<RequestWarning>This approval will add the metadata to your extension instance, allowing future requests to be decoded using this metadata.</RequestWarning>
|
<RequestWarning>This approval will add the metadata to your extension instance, allowing future requests to be decoded using this metadata.</RequestWarning>
|
||||||
<AcceptButton onClick={_onApprove}>Yes, do this metadata update</AcceptButton>
|
<AcceptButton onClick={_onApprove}>Yes, do this metadata update</AcceptButton>
|
||||||
<RejectButton>
|
<RejectButton>
|
||||||
<Link isDanger onClick={_onReject}>Reject</Link>
|
<Link
|
||||||
|
isDanger
|
||||||
|
onClick={_onReject}
|
||||||
|
>
|
||||||
|
Reject
|
||||||
|
</Link>
|
||||||
</RejectButton>
|
</RejectButton>
|
||||||
</RequestInfo>
|
</RequestInfo>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -104,7 +104,10 @@ function Extrinsic ({ className, isDecoded, payload: { era, nonce, tip }, reques
|
|||||||
}, [method, isDecoded, chain, specVersion]);
|
}, [method, isDecoded, chain, specVersion]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Table className={className} isFull>
|
<Table
|
||||||
|
className={className}
|
||||||
|
isFull
|
||||||
|
>
|
||||||
<tr>
|
<tr>
|
||||||
<td className='label'>from</td>
|
<td className='label'>from</td>
|
||||||
<td className='data'>{url}</td>
|
<td className='data'>{url}</td>
|
||||||
|
|||||||
@ -71,9 +71,9 @@ export default function Request ({ account: { isExternal }, request, signId, url
|
|||||||
{isExternal
|
{isExternal
|
||||||
? (
|
? (
|
||||||
<Qr
|
<Qr
|
||||||
|
onSignature={_onSignature}
|
||||||
payload={extrinsic}
|
payload={extrinsic}
|
||||||
request={payload}
|
request={payload}
|
||||||
onSignature={_onSignature}
|
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<Extrinsic
|
<Extrinsic
|
||||||
@ -85,9 +85,19 @@ export default function Request ({ account: { isExternal }, request, signId, url
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
<SignArea>
|
<SignArea>
|
||||||
{isFirst && !isExternal && <Unlock onSign={_onSign} buttonText={buttonText} />}
|
{isFirst && !isExternal && (
|
||||||
|
<Unlock
|
||||||
|
buttonText={buttonText}
|
||||||
|
onSign={_onSign}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<CancelButton>
|
<CancelButton>
|
||||||
<Link isDanger onClick={_onCancel}>Cancel</Link>
|
<Link
|
||||||
|
isDanger
|
||||||
|
onClick={_onCancel}
|
||||||
|
>
|
||||||
|
Cancel
|
||||||
|
</Link>
|
||||||
</CancelButton>
|
</CancelButton>
|
||||||
</SignArea>
|
</SignArea>
|
||||||
</>
|
</>
|
||||||
@ -98,12 +108,25 @@ export default function Request ({ account: { isExternal }, request, signId, url
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Address address={payload.address} />
|
<Address address={payload.address} />
|
||||||
<Bytes bytes={payload.data} url={url} />
|
<Bytes
|
||||||
|
bytes={payload.data}
|
||||||
|
url={url}
|
||||||
|
/>
|
||||||
<VerticalSpace />
|
<VerticalSpace />
|
||||||
<SignArea>
|
<SignArea>
|
||||||
{!isExternal && <Unlock onSign={_onSign} buttonText={buttonText} />}
|
{!isExternal && (
|
||||||
|
<Unlock
|
||||||
|
buttonText={buttonText}
|
||||||
|
onSign={_onSign}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<CancelButton>
|
<CancelButton>
|
||||||
<Link isDanger onClick={_onCancel}>Reject</Link>
|
<Link
|
||||||
|
isDanger
|
||||||
|
onClick={_onCancel}
|
||||||
|
>
|
||||||
|
Reject
|
||||||
|
</Link>
|
||||||
</CancelButton>
|
</CancelButton>
|
||||||
</SignArea>
|
</SignArea>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@ -26,8 +26,14 @@ function TransactionIndex ({ index, totalItems, onNextClick, onPreviousClick }:
|
|||||||
<TotalSteps>/{totalItems}</TotalSteps>
|
<TotalSteps>/{totalItems}</TotalSteps>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<ArrowLeft onClick={(): unknown => previousClickActive && onPreviousClick()} isActive={previousClickActive} />
|
<ArrowLeft
|
||||||
<ArrowRight onClick={(): unknown => nextClickActive && onNextClick()} isActive={nextClickActive} />
|
isActive={previousClickActive}
|
||||||
|
onClick={(): unknown => previousClickActive && onPreviousClick()}
|
||||||
|
/>
|
||||||
|
<ArrowRight
|
||||||
|
isActive={nextClickActive}
|
||||||
|
onClick={(): unknown => nextClickActive && onNextClick()}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</CreationSteps>
|
</CreationSteps>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -35,19 +35,19 @@ export default function Signing (): React.ReactElement<{}> {
|
|||||||
{requests.length > 1 && (
|
{requests.length > 1 && (
|
||||||
<TransactionIndex
|
<TransactionIndex
|
||||||
index={requestIndex}
|
index={requestIndex}
|
||||||
totalItems={requests.length}
|
|
||||||
onNextClick={(): void => setRequestIndex(requestIndex + 1)}
|
onNextClick={(): void => setRequestIndex(requestIndex + 1)}
|
||||||
onPreviousClick={(): void => setRequestIndex(requestIndex - 1)}
|
onPreviousClick={(): void => setRequestIndex(requestIndex - 1)}
|
||||||
|
totalItems={requests.length}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Header>
|
</Header>
|
||||||
<Request
|
<Request
|
||||||
isFirst={requestIndex === 0}
|
|
||||||
account={requests[requestIndex].account}
|
account={requests[requestIndex].account}
|
||||||
|
buttonText={isTransaction ? 'Sign the transaction' : 'Sign the message'}
|
||||||
|
isFirst={requestIndex === 0}
|
||||||
request={requests[requestIndex].request}
|
request={requests[requestIndex].request}
|
||||||
signId={requests[requestIndex].id}
|
signId={requests[requestIndex].id}
|
||||||
url={requests[requestIndex].url}
|
url={requests[requestIndex].url}
|
||||||
buttonText={isTransaction ? 'Sign the transaction' : 'Sign the message'}
|
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
) : <Loading />;
|
) : <Loading />;
|
||||||
|
|||||||
@ -101,13 +101,18 @@ export default function Popup (): React.ReactElement<{}> {
|
|||||||
<MetadataReqContext.Provider value={metaRequests}>
|
<MetadataReqContext.Provider value={metaRequests}>
|
||||||
<SigningReqContext.Provider value={signRequests}>
|
<SigningReqContext.Provider value={signRequests}>
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route path='/account/create' component={CreateAccount} />
|
<Route path='/account/create'><CreateAccount /></Route>
|
||||||
<Route path='/account/forget/:address' component={Forget} />
|
<Route path='/account/forget/:address'><Forget /></Route>
|
||||||
<Route path='/account/export/:address' component={Export} />
|
<Route path='/account/export/:address'><Export /></Route>
|
||||||
<Route path='/account/import-qr' component={ImportQr} />
|
<Route path='/account/import-qr'><ImportQr /></Route>
|
||||||
<Route path='/account/import-seed' component={ImportSeed} />
|
<Route path='/account/import-seed'><ImportSeed /></Route>
|
||||||
<Route path='/account/derive/:address' component={Derive} />
|
<Route path='/account/derive/:address'><Derive /></Route>
|
||||||
<Route exact path='/' component={Root} />
|
<Route
|
||||||
|
exact
|
||||||
|
path='/'
|
||||||
|
>
|
||||||
|
<Root />
|
||||||
|
</Route>
|
||||||
</Switch>
|
</Switch>
|
||||||
</SigningReqContext.Provider>
|
</SigningReqContext.Provider>
|
||||||
</MetadataReqContext.Provider>
|
</MetadataReqContext.Provider>
|
||||||
|
|||||||
@ -15,7 +15,10 @@ interface Props {
|
|||||||
|
|
||||||
function ActionText ({ icon, className, text, onClick }: Props): React.ReactElement<Props> {
|
function ActionText ({ icon, className, text, onClick }: Props): React.ReactElement<Props> {
|
||||||
return (
|
return (
|
||||||
<div className={className} onClick={onClick}>
|
<div
|
||||||
|
className={className}
|
||||||
|
onClick={onClick}
|
||||||
|
>
|
||||||
{icon && <Svg src={icon} />}
|
{icon && <Svg src={icon} />}
|
||||||
<span>{text}</span>
|
<span>{text}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// This software may be modified and distributed under the terms
|
// This software may be modified and distributed under the terms
|
||||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||||
|
|
||||||
import React, { useContext } from 'react';
|
import React, { useCallback, useContext } from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { ActionContext } from './contexts';
|
import { ActionContext } from './contexts';
|
||||||
import AddAccountImage from './AddAccountImage';
|
import AddAccountImage from './AddAccountImage';
|
||||||
@ -14,13 +14,20 @@ interface Props {
|
|||||||
|
|
||||||
function AddAccount ({ className }: Props): React.ReactElement<Props> {
|
function AddAccount ({ className }: Props): React.ReactElement<Props> {
|
||||||
const onAction = useContext(ActionContext);
|
const onAction = useContext(ActionContext);
|
||||||
|
const _onClick = useCallback(
|
||||||
|
(): void => onAction('/account/create'),
|
||||||
|
[onAction]
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Header showSettings text={'Add Account'}/>
|
<Header
|
||||||
|
showSettings
|
||||||
|
text={'Add Account'}
|
||||||
|
/>
|
||||||
<div className={className}>
|
<div className={className}>
|
||||||
<Image>
|
<Image>
|
||||||
<AddAccountImage onClick={(): void => onAction('/account/create')}/>
|
<AddAccountImage onClick={_onClick}/>
|
||||||
</Image>
|
</Image>
|
||||||
<div>
|
<div>
|
||||||
<TipText>You currently don't have any accounts. Either create a new account or if you have an existing account you wish to use, import it with the seed phrase.</TipText>
|
<TipText>You currently don't have any accounts. Either create a new account or if you have an existing account you wish to use, import it with the seed phrase.</TipText>
|
||||||
|
|||||||
@ -2,6 +2,12 @@
|
|||||||
// This software may be modified and distributed under the terms
|
// This software may be modified and distributed under the terms
|
||||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||||
|
|
||||||
|
// We _could_ reformat, but just keep it as-is, since this is actually
|
||||||
|
// externally generated and not really user-editable
|
||||||
|
|
||||||
|
/* eslint-disable react/jsx-sort-props */
|
||||||
|
/* eslint-disable react/jsx-max-props-per-line */
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
|||||||
@ -30,8 +30,8 @@ function Button ({ children, className, isDisabled, onClick, to }: Props): React
|
|||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
className={className}
|
className={className}
|
||||||
onClick={_onClick}
|
|
||||||
disabled={isDisabled}
|
disabled={isDisabled}
|
||||||
|
onClick={_onClick}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@ -19,9 +19,9 @@ function Checkbox ({ onChange, label, className, checked }: Props): React.ReactE
|
|||||||
<label>
|
<label>
|
||||||
{label}
|
{label}
|
||||||
<input
|
<input
|
||||||
type='checkbox'
|
|
||||||
checked={checked}
|
checked={checked}
|
||||||
onChange={((event): void => onChange(event.target.checked))}
|
onChange={((event): void => onChange(event.target.checked))}
|
||||||
|
type='checkbox'
|
||||||
/>
|
/>
|
||||||
<span />
|
<span />
|
||||||
</label>
|
</label>
|
||||||
|
|||||||
@ -18,9 +18,9 @@ function Identicon ({ iconTheme, className, prefix, value }: Props): React.React
|
|||||||
<div className={className}>
|
<div className={className}>
|
||||||
<Icon
|
<Icon
|
||||||
className='icon'
|
className='icon'
|
||||||
|
prefix={prefix}
|
||||||
size={64}
|
size={64}
|
||||||
theme={iconTheme}
|
theme={iconTheme}
|
||||||
prefix={prefix}
|
|
||||||
value={value}
|
value={value}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -39,12 +39,12 @@ function InputWithLabel ({ className, defaultValue, label, isError, isFocused, i
|
|||||||
defaultValue={defaultValue || undefined}
|
defaultValue={defaultValue || undefined}
|
||||||
onBlur={onBlur}
|
onBlur={onBlur}
|
||||||
onChange={_onChange}
|
onChange={_onChange}
|
||||||
|
placeholder={placeholder}
|
||||||
readOnly={isReadOnly}
|
readOnly={isReadOnly}
|
||||||
spellCheck={false}
|
spellCheck={false}
|
||||||
type={type}
|
type={type}
|
||||||
value={value}
|
value={value}
|
||||||
withError={isError}
|
withError={isError}
|
||||||
placeholder={placeholder}
|
|
||||||
/>
|
/>
|
||||||
</Label>
|
</Label>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -26,8 +26,8 @@ function Link ({ children, className, onClick, to }: Props): React.ReactElement<
|
|||||||
</RouterLink>
|
</RouterLink>
|
||||||
) : (
|
) : (
|
||||||
<a
|
<a
|
||||||
href='#'
|
|
||||||
className={className}
|
className={className}
|
||||||
|
href='#'
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
@ -22,8 +22,8 @@ function MnemonicSeed ({ seed, onCopy, className }: Props): React.ReactElement<P
|
|||||||
<ActionText
|
<ActionText
|
||||||
data-seed-action='copy'
|
data-seed-action='copy'
|
||||||
icon={copy}
|
icon={copy}
|
||||||
text='Copy to clipboard'
|
|
||||||
onClick={onCopy}
|
onClick={onCopy}
|
||||||
|
text='Copy to clipboard'
|
||||||
/>
|
/>
|
||||||
</ButtonsRow>
|
</ButtonsRow>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -30,11 +30,11 @@ function DerivationPath ({ onChange, parentAddress, parentPassword }: Props): Re
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<InputWithLabel
|
<InputWithLabel
|
||||||
label='Derivation path'
|
|
||||||
placeholder='//hard/soft'
|
|
||||||
onChange={_onChange}
|
|
||||||
value={path}
|
|
||||||
isError={!isValid}
|
isError={!isValid}
|
||||||
|
label='Derivation path'
|
||||||
|
onChange={_onChange}
|
||||||
|
placeholder='//hard/soft'
|
||||||
|
value={path}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -37,8 +37,8 @@ export default function Name ({ address, className, defaultValue, isFocused, lab
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<InputWithLabel
|
<InputWithLabel
|
||||||
data-input-name
|
|
||||||
className={className}
|
className={className}
|
||||||
|
data-input-name
|
||||||
defaultValue={startValue}
|
defaultValue={startValue}
|
||||||
isError={isError}
|
isError={isError}
|
||||||
isFocused={isFocused}
|
isFocused={isFocused}
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
"@polkadot/extension-ui": "0.24.0-beta.3"
|
"@polkadot/extension-ui": "0.24.0-beta.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/dev": "^0.51.9",
|
"@polkadot/dev": "^0.52.1",
|
||||||
"@types/chrome": "^0.0.103",
|
"@types/chrome": "^0.0.103",
|
||||||
"@types/firefox-webext-browser": "^70.0.1",
|
"@types/firefox-webext-browser": "^70.0.1",
|
||||||
"babel-loader": "^8.1.0",
|
"babel-loader": "^8.1.0",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user