Explicit save to vanity (button label) (#3367)
* Explicit save to vanity (button label) * Save warning
This commit is contained in:
parent
b39379b710
commit
decaec9e17
@ -7,6 +7,8 @@ import styled from 'styled-components';
|
||||
import { Button, IdentityIcon } from '@polkadot/react-components';
|
||||
import { u8aToHex } from '@polkadot/util';
|
||||
|
||||
import { useTranslation } from '../translate';
|
||||
|
||||
interface Props {
|
||||
address: string;
|
||||
className?: string;
|
||||
@ -18,16 +20,18 @@ interface Props {
|
||||
}
|
||||
|
||||
function Match ({ address, className = '', count, offset, onCreateToggle, onRemove, seed }: Props): React.ReactElement<Props> {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const hexSeed = useMemo(
|
||||
() => u8aToHex(seed),
|
||||
[seed]
|
||||
);
|
||||
const _onCreate = useCallback(
|
||||
(): void => onCreateToggle(hexSeed),
|
||||
() => onCreateToggle(hexSeed),
|
||||
[hexSeed, onCreateToggle]
|
||||
);
|
||||
const _onRemove = useCallback(
|
||||
(): void => onRemove(address),
|
||||
() => onRemove(address),
|
||||
[address, onRemove]
|
||||
);
|
||||
|
||||
@ -53,6 +57,7 @@ function Match ({ address, className = '', count, offset, onCreateToggle, onRemo
|
||||
<td className='button'>
|
||||
<Button
|
||||
icon='plus'
|
||||
label={t<string>('Save')}
|
||||
onClick={_onCreate}
|
||||
/>
|
||||
<Button
|
||||
@ -72,7 +77,7 @@ export default React.memo(styled(Match)`
|
||||
}
|
||||
|
||||
.vanity--Match-addr {
|
||||
font-size: 1.25rem;
|
||||
font-size: 1.1rem;
|
||||
|
||||
.no {
|
||||
color: inherit;
|
||||
|
||||
@ -232,20 +232,23 @@ function VanityApp ({ className = '', onStatusChange }: Props): React.ReactEleme
|
||||
/>
|
||||
</Button.Group>
|
||||
{matches.length !== 0 && (
|
||||
<Table
|
||||
className='vanity--App-matches'
|
||||
empty={t<string>('No matches found')}
|
||||
header={header}
|
||||
>
|
||||
{matches.map((match): React.ReactNode => (
|
||||
<Match
|
||||
{...match}
|
||||
key={match.address}
|
||||
onCreateToggle={setCreateSeed}
|
||||
onRemove={_onRemove}
|
||||
/>
|
||||
))}
|
||||
</Table>
|
||||
<>
|
||||
<article className='warning nomargin'>{t<string>('Ensure that you utilized the "Save" functionality before using a generated address to receive funds. Without saving the address any funds and the associated seed any funds sent to it will be lost.')}</article>
|
||||
<Table
|
||||
className='vanity--App-matches'
|
||||
empty={t<string>('No matches found')}
|
||||
header={header}
|
||||
>
|
||||
{matches.map((match): React.ReactNode => (
|
||||
<Match
|
||||
{...match}
|
||||
key={match.address}
|
||||
onCreateToggle={setCreateSeed}
|
||||
onRemove={_onRemove}
|
||||
/>
|
||||
))}
|
||||
</Table>
|
||||
</>
|
||||
)}
|
||||
{createSeed && (
|
||||
<CreateModal
|
||||
|
||||
Loading…
Reference in New Issue
Block a user