* ui-signer pureComponentify * ui-react pureCompify * Status queue prop * ui-app Button * ui-app InputExtrinsic * apps, app-rpc, ui-app, ui-react * app-extrinsics, app-explorer, apps * fixes for tslint * more linter fixes * Update index.tsx * Update index.tsx * Update Nonce.tsx * Update index.tsx * Update Results.tsx * Update index.tsx * Update Queries.tsx * Update NodeInfo.tsx * Update index.tsx * Update Item.tsx * style fixes * TSLINTs
This commit is contained in:
parent
6a694f7c5b
commit
57800cdb83
@ -20,52 +20,55 @@ type Props = I18nProps & {
|
|||||||
value?: Header
|
value?: Header
|
||||||
};
|
};
|
||||||
|
|
||||||
function BlockHeader ({ className, value, style }: Props) {
|
class BlockHeader extends React.PureComponent<Props> {
|
||||||
if (!value) {
|
render () {
|
||||||
return null;
|
const { className, value, style } = this.props;
|
||||||
}
|
if (!value) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const hash = headerHash(value);
|
const hash = headerHash(value);
|
||||||
// tslint:disable-next-line:variable-name
|
// tslint:disable-next-line:variable-name
|
||||||
const { extrinsicsRoot, number, parentHash, stateRoot } = value;
|
const { extrinsicsRoot, number, parentHash, stateRoot } = value;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={classes('explorer--BlockHeader', className)}
|
className={classes('explorer--BlockHeader', className)}
|
||||||
style={style}
|
style={style}
|
||||||
>
|
>
|
||||||
<div className='number'>
|
<div className='number'>
|
||||||
<div>{numberFormat(number)}</div>
|
<div>{numberFormat(number)}</div>
|
||||||
</div>
|
</div>
|
||||||
<div className='details'>
|
<div className='details'>
|
||||||
<div className='hash'>
|
<div className='hash'>
|
||||||
{u8aToHex(hash)}
|
{u8aToHex(hash)}
|
||||||
|
</div>
|
||||||
|
<table className='contains'>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td className='type'>parentHash</td>
|
||||||
|
<td className='hash'>
|
||||||
|
{u8aToHex(parentHash)}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td className='type'>extrinsicsRoot</td>
|
||||||
|
<td className='hash'>
|
||||||
|
{u8aToHex(extrinsicsRoot)}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td className='type'>stateRoot</td>
|
||||||
|
<td className='hash'>
|
||||||
|
{u8aToHex(stateRoot)}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<table className='contains'>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td className='type'>parentHash</td>
|
|
||||||
<td className='hash'>
|
|
||||||
{u8aToHex(parentHash)}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td className='type'>extrinsicsRoot</td>
|
|
||||||
<td className='hash'>
|
|
||||||
{u8aToHex(extrinsicsRoot)}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td className='type'>stateRoot</td>
|
|
||||||
<td className='hash'>
|
|
||||||
{u8aToHex(stateRoot)}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
);
|
||||||
);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default translate(BlockHeader);
|
export default translate(BlockHeader);
|
||||||
|
|||||||
@ -17,22 +17,26 @@ import translate from './translate';
|
|||||||
|
|
||||||
type Props = I18nProps & {};
|
type Props = I18nProps & {};
|
||||||
|
|
||||||
function ExplorerApp ({ className, style, t }: Props) {
|
class ExplorerApp extends React.PureComponent<Props> {
|
||||||
return (
|
render () {
|
||||||
<div
|
const { className, style, t } = this.props;
|
||||||
className={classes('explorer--App', className)}
|
|
||||||
style={style}
|
return (
|
||||||
>
|
<div
|
||||||
<BestNumber
|
className={classes('explorer--App', className)}
|
||||||
className='explorer--BestNumber'
|
style={style}
|
||||||
label={t('app.bestNumber', {
|
>
|
||||||
defaultValue: 'best #'
|
<BestNumber
|
||||||
})}
|
className='explorer--BestNumber'
|
||||||
/>
|
label={t('app.bestNumber', {
|
||||||
<BestHash />
|
defaultValue: 'best #'
|
||||||
<BlockHeaders />
|
})}
|
||||||
</div>
|
/>
|
||||||
);
|
<BestHash />
|
||||||
|
<BlockHeaders />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default translate(ExplorerApp);
|
export default translate(ExplorerApp);
|
||||||
|
|||||||
@ -17,22 +17,26 @@ type Props = BareProps & {
|
|||||||
value?: Uint8Array
|
value?: Uint8Array
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function Nonce ({ className, label, style, onChange, value }: Props) {
|
export default class Nonce extends React.PureComponent<Props> {
|
||||||
return (
|
render () {
|
||||||
<div
|
const { className, label, style, onChange, value } = this.props;
|
||||||
className={classes('ui--row', className)}
|
|
||||||
style={style}
|
return (
|
||||||
>
|
<div
|
||||||
<Labelled
|
className={classes('ui--row', className)}
|
||||||
className='small'
|
style={style}
|
||||||
label={label}
|
|
||||||
>
|
>
|
||||||
<RxNonce
|
<Labelled
|
||||||
className='ui disabled dropdown selection'
|
className='small'
|
||||||
onChange={onChange}
|
label={label}
|
||||||
params={value}
|
>
|
||||||
/>
|
<RxNonce
|
||||||
</Labelled>
|
className='ui disabled dropdown selection'
|
||||||
</div>
|
onChange={onChange}
|
||||||
);
|
params={value}
|
||||||
|
/>
|
||||||
|
</Labelled>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,17 +16,21 @@ import Selection from './Selection';
|
|||||||
|
|
||||||
type Props = BareProps;
|
type Props = BareProps;
|
||||||
|
|
||||||
export default function ExtrinsicsApp ({ className, style }: Props) {
|
export default class ExtrinsicsApp extends React.PureComponent<Props> {
|
||||||
return (
|
render () {
|
||||||
<div
|
const { className, style } = this.props;
|
||||||
className={classes('extrinsics--App', className)}
|
|
||||||
style={style}
|
return (
|
||||||
>
|
<div
|
||||||
<QueueConsumer>
|
className={classes('extrinsics--App', className)}
|
||||||
{({ queueAdd }: QueueProps) => (
|
style={style}
|
||||||
<Selection queueAdd={queueAdd} />
|
>
|
||||||
)}
|
<QueueConsumer>
|
||||||
</QueueConsumer>
|
{({ queueAdd }: QueueProps) => (
|
||||||
</div>
|
<Selection queueAdd={queueAdd} />
|
||||||
);
|
)}
|
||||||
|
</QueueConsumer>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,34 +17,38 @@ type Props = BareProps & {
|
|||||||
queue: Array<QueueTx>
|
queue: Array<QueueTx>
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function Results ({ className, queue = [], style }: Props) {
|
export default class Results extends React.PureComponent<Props> {
|
||||||
const filtered = queue
|
render () {
|
||||||
.filter(({ error, result }) =>
|
const { className, queue = [], style } = this.props;
|
||||||
!isUndefined(error) || !isUndefined(result)
|
|
||||||
)
|
|
||||||
.reverse();
|
|
||||||
|
|
||||||
if (!filtered.length) {
|
const filtered = queue
|
||||||
return null;
|
.filter(({ error, result }) =>
|
||||||
|
!isUndefined(error) || !isUndefined(result)
|
||||||
|
)
|
||||||
|
.reverse();
|
||||||
|
|
||||||
|
if (!filtered.length) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={classes('rpc--Results', className)}
|
||||||
|
style={style}
|
||||||
|
>
|
||||||
|
{filtered.map(({ error, id, result, rpc: { section, name } }) => (
|
||||||
|
<Output
|
||||||
|
isError={!!error}
|
||||||
|
key={id}
|
||||||
|
label={`${id}: ${section}.${name}`}
|
||||||
|
value={
|
||||||
|
error
|
||||||
|
? error.message
|
||||||
|
: resultToText(result)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className={classes('rpc--Results', className)}
|
|
||||||
style={style}
|
|
||||||
>
|
|
||||||
{filtered.map(({ error, id, result, rpc: { section, name } }) => (
|
|
||||||
<Output
|
|
||||||
isError={!!error}
|
|
||||||
key={id}
|
|
||||||
label={`${id}: ${section}.${name}`}
|
|
||||||
value={
|
|
||||||
error
|
|
||||||
? error.message
|
|
||||||
: resultToText(result)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,24 +17,28 @@ import Selection from './Selection';
|
|||||||
|
|
||||||
type Props = BareProps & {};
|
type Props = BareProps & {};
|
||||||
|
|
||||||
export default function RpcApp ({ className, style }: Props) {
|
export default class RpcApp extends React.PureComponent<Props> {
|
||||||
return (
|
render () {
|
||||||
<div
|
const { className, style } = this.props;
|
||||||
className={classes('rpc--App', className)}
|
|
||||||
style={style}
|
return (
|
||||||
>
|
<div
|
||||||
<QueueConsumer>
|
className={classes('rpc--App', className)}
|
||||||
{({ queue, queueAdd }: QueueProps) => [
|
style={style}
|
||||||
<Selection
|
>
|
||||||
key='add'
|
<QueueConsumer>
|
||||||
queueAdd={queueAdd}
|
{({ queue, queueAdd }: QueueProps) => [
|
||||||
/>,
|
<Selection
|
||||||
<Results
|
key='add'
|
||||||
key='results'
|
queueAdd={queueAdd}
|
||||||
queue={queue}
|
/>,
|
||||||
/>
|
<Results
|
||||||
]}
|
key='results'
|
||||||
</QueueConsumer>
|
queue={queue}
|
||||||
</div>
|
/>
|
||||||
);
|
]}
|
||||||
|
</QueueConsumer>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,25 +17,29 @@ type Props = I18nProps & {
|
|||||||
value?: Array<StorageQuery>
|
value?: Array<StorageQuery>
|
||||||
};
|
};
|
||||||
|
|
||||||
function Queries ({ className, onRemove, style, value }: Props) {
|
class Queries extends React.PureComponent<Props> {
|
||||||
if (!value || !value.length) {
|
render () {
|
||||||
return null;
|
const { className, onRemove, style, value } = this.props;
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
if (!value || !value.length) {
|
||||||
<div
|
return null;
|
||||||
className={classes('storage--Queries', className)}
|
}
|
||||||
style={style}
|
|
||||||
>
|
return (
|
||||||
{value.map((query) =>
|
<div
|
||||||
<Query
|
className={classes('storage--Queries', className)}
|
||||||
key={query.id}
|
style={style}
|
||||||
onRemove={onRemove}
|
>
|
||||||
value={query}
|
{value.map((query) =>
|
||||||
/>
|
<Query
|
||||||
)}
|
key={query.id}
|
||||||
</div>
|
onRemove={onRemove}
|
||||||
);
|
value={query}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default translate(Queries);
|
export default translate(Queries);
|
||||||
|
|||||||
@ -21,24 +21,28 @@ function updateTestInfo (chain?: string) {
|
|||||||
keyring.setTestMode(isTestChain(chain));
|
keyring.setTestMode(isTestChain(chain));
|
||||||
}
|
}
|
||||||
|
|
||||||
function NodeInfo ({ className, style, t }: Props) {
|
class NodeInfo extends React.PureComponent<Props> {
|
||||||
return (
|
render () {
|
||||||
<div className={classes('apps--NodeInfo', className)}>
|
const { className, style, t } = this.props;
|
||||||
<Chain
|
|
||||||
label={t('info.chain', {
|
return (
|
||||||
defaultValue: 'chain: '
|
<div className={classes('apps--NodeInfo', className)} style={style}>
|
||||||
|
<Chain
|
||||||
|
label={t('info.chain', {
|
||||||
|
defaultValue: 'chain: '
|
||||||
|
})}
|
||||||
|
onChange={updateTestInfo}
|
||||||
|
/>
|
||||||
|
<NodeName label={t('info.name', {
|
||||||
|
defaultValue: 'client: '
|
||||||
})}
|
})}
|
||||||
onChange={updateTestInfo}
|
/>
|
||||||
/>
|
<NodeVersion label={t('info.name', {
|
||||||
<NodeName label={t('info.name', {
|
defaultValue: 'version: '
|
||||||
defaultValue: 'client: '
|
})} />
|
||||||
})}
|
</div>
|
||||||
/>
|
);
|
||||||
<NodeVersion label={t('info.name', {
|
}
|
||||||
defaultValue: 'version: '
|
|
||||||
})} />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default translate(NodeInfo);
|
export default translate(NodeInfo);
|
||||||
|
|||||||
@ -14,17 +14,21 @@ import translate from '../translate';
|
|||||||
|
|
||||||
type Props = I18nProps & {};
|
type Props = I18nProps & {};
|
||||||
|
|
||||||
function NotFound ({ className, style, t }: Props) {
|
class NotFound extends React.PureComponent<Props> {
|
||||||
return (
|
render () {
|
||||||
<div
|
const { className, style, t } = this.props;
|
||||||
className={classes('apps--NotFound', className)}
|
|
||||||
style={style}
|
return (
|
||||||
>
|
<div
|
||||||
{t('notfound.error', {
|
className={classes('apps--NotFound', className)}
|
||||||
defaultValue: 'ERROR: You have tried to access an application that does not exist'
|
style={style}
|
||||||
})}
|
>
|
||||||
</div>
|
{t('notfound.error', {
|
||||||
);
|
defaultValue: 'ERROR: You have tried to access an application that does not exist'
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default translate(NotFound);
|
export default translate(NotFound);
|
||||||
|
|||||||
@ -17,17 +17,21 @@ type Props = I18nProps & {
|
|||||||
route: Route
|
route: Route
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function Item ({ route: { i18n, icon, isExact, name, path = '' }, t }: Props) {
|
export default class Item extends React.PureComponent<Props> {
|
||||||
return (
|
render () {
|
||||||
<Menu.Item className='apps--SideBar-Item'>
|
const { route: { i18n, icon, isExact, name, path = '' }, t } = this.props;
|
||||||
<NavLink
|
|
||||||
activeClassName='apps--SideBar-Item-NavLink-active'
|
return (
|
||||||
className='apps--SideBar-Item-NavLink'
|
<Menu.Item className='apps--SideBar-Item'>
|
||||||
exact={isExact}
|
<NavLink
|
||||||
to={path || `/${name}`}
|
activeClassName='apps--SideBar-Item-NavLink-active'
|
||||||
>
|
className='apps--SideBar-Item-NavLink'
|
||||||
<Icon name={icon} /> {t(`sidebar.${name}`, i18n)}
|
exact={isExact}
|
||||||
</NavLink>
|
to={path || `/${name}`}
|
||||||
</Menu.Item>
|
>
|
||||||
);
|
<Icon name={icon} /> {t(`sidebar.${name}`, i18n)}
|
||||||
|
</NavLink>
|
||||||
|
</Menu.Item>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,51 +20,55 @@ type Props = I18nProps & {
|
|||||||
children?: React.ReactNode
|
children?: React.ReactNode
|
||||||
};
|
};
|
||||||
|
|
||||||
function SideBar ({ children, className, style, t }: Props) {
|
class SideBar extends React.PureComponent<Props> {
|
||||||
return (
|
render () {
|
||||||
<div
|
const { children, className, style, t } = this.props;
|
||||||
className={classes('apps--SideBar', className)}
|
|
||||||
style={style}
|
return (
|
||||||
>
|
<div
|
||||||
<Menu
|
className={classes('apps--SideBar', className)}
|
||||||
secondary
|
style={style}
|
||||||
vertical
|
|
||||||
>
|
>
|
||||||
{
|
<Menu
|
||||||
routing.routes
|
secondary
|
||||||
.filter((route) =>
|
vertical
|
||||||
!route || !route.isHidden
|
>
|
||||||
)
|
{
|
||||||
.map((route, index) => (
|
routing.routes
|
||||||
route
|
.filter((route) =>
|
||||||
? (
|
!route || !route.isHidden
|
||||||
<Item
|
)
|
||||||
key={route.name}
|
.map((route, index) => (
|
||||||
t={t}
|
route
|
||||||
route={route}
|
? (
|
||||||
/>
|
<Item
|
||||||
)
|
key={route.name}
|
||||||
: (
|
t={t}
|
||||||
<Menu.Divider
|
route={route}
|
||||||
hidden
|
/>
|
||||||
key={index}
|
)
|
||||||
/>
|
: (
|
||||||
)
|
<Menu.Divider
|
||||||
))
|
hidden
|
||||||
}
|
key={index}
|
||||||
<Menu.Divider hidden />
|
/>
|
||||||
<Menu.Item className='apps--SideBar-Item'>
|
)
|
||||||
<a
|
))
|
||||||
className='apps--SideBar-Item-NavLink'
|
}
|
||||||
href='https://github.com/polkadot-js/apps'>
|
<Menu.Divider hidden />
|
||||||
<Icon name='github' /> GitHub
|
<Menu.Item className='apps--SideBar-Item'>
|
||||||
</a>
|
<a
|
||||||
</Menu.Item>
|
className='apps--SideBar-Item-NavLink'
|
||||||
<Menu.Divider hidden />
|
href='https://github.com/polkadot-js/apps'>
|
||||||
{children}
|
<Icon name='github' /> GitHub
|
||||||
</Menu>
|
</a>
|
||||||
</div>
|
</Menu.Item>
|
||||||
);
|
<Menu.Divider hidden />
|
||||||
|
{children}
|
||||||
|
</Menu>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default translate(SideBar);
|
export default translate(SideBar);
|
||||||
|
|||||||
@ -8,13 +8,15 @@ import React from 'react';
|
|||||||
|
|
||||||
import classes from '../util/classes';
|
import classes from '../util/classes';
|
||||||
|
|
||||||
function ButtonDivider ({ className, style }: DividerProps) {
|
export default class ButtonDivider extends React.Component<DividerProps> {
|
||||||
return (
|
render () {
|
||||||
<div
|
const { className, style } = this.props;
|
||||||
className={classes('ui button compact mini basic', className)}
|
|
||||||
style={style}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default ButtonDivider;
|
return (
|
||||||
|
<div
|
||||||
|
className={classes('ui button compact mini basic', className)}
|
||||||
|
style={style}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -11,18 +11,23 @@ import Button from '@polkadot/ui-app/Button';
|
|||||||
import classes from '../util/classes';
|
import classes from '../util/classes';
|
||||||
import Divider from './Divider';
|
import Divider from './Divider';
|
||||||
|
|
||||||
function ButtonGroup ({ children, className, style }: GroupProps) {
|
// ({ children, className, style }: GroupProps)
|
||||||
return (
|
class ButtonGroup extends React.PureComponent<GroupProps> {
|
||||||
<div
|
render () {
|
||||||
className={classes('ui--Button-Group', className)}
|
const { children, className, style } = this.props;
|
||||||
style={style}
|
|
||||||
>
|
return (
|
||||||
<SUIButton.Group>
|
<div
|
||||||
<Button.Group.Divider style={{ padding: '0em' }} />
|
className={classes('ui--Button-Group', className)}
|
||||||
{children}
|
style={style}
|
||||||
</SUIButton.Group>
|
>
|
||||||
</div>
|
<SUIButton.Group>
|
||||||
);
|
<Button.Group.Divider style={{ padding: '0em' }} />
|
||||||
|
{children}
|
||||||
|
</SUIButton.Group>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(ButtonGroup as GroupType).Divider = Divider;
|
(ButtonGroup as GroupType).Divider = Divider;
|
||||||
|
|||||||
@ -15,20 +15,24 @@ type Props = I18nProps & {
|
|||||||
text?: string
|
text?: string
|
||||||
};
|
};
|
||||||
|
|
||||||
function ButtonOr ({ className, style, t, text }: Props) {
|
class ButtonOr extends React.PureComponent<Props> {
|
||||||
return (
|
render () {
|
||||||
<SUIButton.Or
|
const { className, style, t, text } = this.props;
|
||||||
className={className}
|
|
||||||
style={style}
|
return (
|
||||||
text={
|
<SUIButton.Or
|
||||||
isUndefined(text)
|
className={className}
|
||||||
? t('button.or', {
|
style={style}
|
||||||
defaultValue: 'or'
|
text={
|
||||||
})
|
isUndefined(text)
|
||||||
: text
|
? t('button.or', {
|
||||||
}
|
defaultValue: 'or'
|
||||||
/>
|
})
|
||||||
);
|
: text
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default translate(ButtonOr);
|
export default translate(ButtonOr);
|
||||||
|
|||||||
@ -15,31 +15,35 @@ import Divider from './Divider';
|
|||||||
import Group from './Group';
|
import Group from './Group';
|
||||||
import Or from './Or';
|
import Or from './Or';
|
||||||
|
|
||||||
function Button ({ children, className, floated, icon, isBasic = false, isCircular = false, isDisabled = false, isNegative = false, isPrimary = false, onClick, size, style, text }: ButtonProps) {
|
class Button extends React.PureComponent<ButtonProps> {
|
||||||
const props = {
|
render () {
|
||||||
basic: isBasic,
|
const { children, className, floated, icon, isBasic = false, isCircular = false, isDisabled = false, isNegative = false, isPrimary = false, onClick, size, style, text } = this.props;
|
||||||
circular: isCircular,
|
|
||||||
className,
|
|
||||||
disabled: isDisabled,
|
|
||||||
floated,
|
|
||||||
icon,
|
|
||||||
negative: isNegative,
|
|
||||||
onClick,
|
|
||||||
primary: isPrimary,
|
|
||||||
size,
|
|
||||||
secondary: isBasic && !(isPrimary || isNegative),
|
|
||||||
style
|
|
||||||
};
|
|
||||||
|
|
||||||
return isUndefined(text) && isUndefined(children)
|
const props = {
|
||||||
? (
|
basic: isBasic || false,
|
||||||
<SUIButton {...props} />
|
circular: isCircular,
|
||||||
)
|
className,
|
||||||
: (
|
disabled: isDisabled,
|
||||||
<SUIButton {...props}>
|
floated,
|
||||||
{text}{children}
|
icon,
|
||||||
</SUIButton>
|
negative: isNegative,
|
||||||
);
|
onClick,
|
||||||
|
primary: isPrimary,
|
||||||
|
size,
|
||||||
|
secondary: isBasic && !(isPrimary || isNegative || false),
|
||||||
|
style
|
||||||
|
};
|
||||||
|
|
||||||
|
return isUndefined(text) && isUndefined(children)
|
||||||
|
? (
|
||||||
|
<SUIButton {...props} />
|
||||||
|
)
|
||||||
|
: (
|
||||||
|
<SUIButton {...props}>
|
||||||
|
{text}{children}
|
||||||
|
</SUIButton>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(Button as ButtonType).Divider = Divider;
|
(Button as ButtonType).Divider = Divider;
|
||||||
|
|||||||
@ -18,17 +18,21 @@ type Props = BareProps & {
|
|||||||
value?: any
|
value?: any
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function CopyButton ({ className, icon = 'copy', isCircular = true, isPrimary = true, size = 'tiny', style, value }: Props) {
|
export default class CopyButton extends React.PureComponent<Props> {
|
||||||
return (
|
render () {
|
||||||
<CopyToClipboard text={value}>
|
const { className, icon = 'copy', isCircular = true, isPrimary = true, size = 'tiny', style, value } = this.props;
|
||||||
<Button
|
|
||||||
className={className}
|
return (
|
||||||
icon={icon}
|
<CopyToClipboard text={value}>
|
||||||
isCircular={isCircular}
|
<Button
|
||||||
isPrimary={isPrimary}
|
className={className}
|
||||||
size={size}
|
icon={icon}
|
||||||
style={style}
|
isCircular={isCircular}
|
||||||
/>
|
isPrimary={isPrimary}
|
||||||
</CopyToClipboard>
|
size={size}
|
||||||
);
|
style={style}
|
||||||
|
/>
|
||||||
|
</CopyToClipboard>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,29 +25,35 @@ type Props = I18nProps & {
|
|||||||
withLabel?: boolean
|
withLabel?: boolean
|
||||||
};
|
};
|
||||||
|
|
||||||
function SelectMethod ({ className, isError, label = '', onChange, options, style, t, type, value: { name, section }, withLabel }: Props) {
|
// ({ className, isError, label = '', onChange, options, style, t, type, value: { name, section }, withLabel }: Props) {
|
||||||
if (!options.length) {
|
class SelectMethod extends React.PureComponent<Props> {
|
||||||
return null;
|
|
||||||
|
render () {
|
||||||
|
const { className, isError, label = '', onChange, options, style, t, type, value: { name, section }, withLabel } = this.props;
|
||||||
|
|
||||||
|
if (!options.length) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const transform = (name: Extrinsic$Sections): SectionItem<Extrinsics> =>
|
||||||
|
extrinsics[section][type][name];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dropdown
|
||||||
|
className={classes('ui--DropdownLinked-Items', className)}
|
||||||
|
isError={isError}
|
||||||
|
label={label || t('input.extrinsic.method', {
|
||||||
|
defaultValue: 'with the extrinsic'
|
||||||
|
})}
|
||||||
|
onChange={onChange}
|
||||||
|
options={options}
|
||||||
|
style={style}
|
||||||
|
transform={transform}
|
||||||
|
value={name}
|
||||||
|
withLabel={withLabel}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const transform = (name: Extrinsic$Sections): SectionItem<Extrinsics> =>
|
|
||||||
extrinsics[section][type][name];
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Dropdown
|
|
||||||
className={classes('ui--DropdownLinked-Items', className)}
|
|
||||||
isError={isError}
|
|
||||||
label={label || t('input.extrinsic.method', {
|
|
||||||
defaultValue: 'with the extrinsic'
|
|
||||||
})}
|
|
||||||
onChange={onChange}
|
|
||||||
options={options}
|
|
||||||
style={style}
|
|
||||||
transform={transform}
|
|
||||||
value={name}
|
|
||||||
withLabel={withLabel}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default translate(SelectMethod);
|
export default translate(SelectMethod);
|
||||||
|
|||||||
@ -23,22 +23,26 @@ type Props = I18nProps & {
|
|||||||
withLabel?: boolean
|
withLabel?: boolean
|
||||||
};
|
};
|
||||||
|
|
||||||
function SelectSection ({ className, defaultValue, isError, label = '', onChange, options, style, t, value: { section }, withLabel }: Props) {
|
class SelectSection extends React.PureComponent<Props> {
|
||||||
return (
|
render () {
|
||||||
<Dropdown
|
const { className, defaultValue, isError, label = '', onChange, options, style, t, value: { section }, withLabel } = this.props;
|
||||||
className={classes('ui--DropdownLinked-Sections', className)}
|
|
||||||
defaultValue={defaultValue}
|
return (
|
||||||
isError={isError}
|
<Dropdown
|
||||||
label={label || t('input.extrinsic.section', {
|
className={classes('ui--DropdownLinked-Sections', className)}
|
||||||
defaultValue: 'from extrinsic section'
|
defaultValue={defaultValue}
|
||||||
})}
|
isError={isError}
|
||||||
onChange={onChange}
|
label={label || t('input.extrinsic.section', {
|
||||||
options={options}
|
defaultValue: 'from extrinsic section'
|
||||||
style={style}
|
})}
|
||||||
value={section}
|
onChange={onChange}
|
||||||
withLabel={withLabel}
|
options={options}
|
||||||
/>
|
style={style}
|
||||||
);
|
value={section}
|
||||||
|
withLabel={withLabel}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default translate(SelectSection);
|
export default translate(SelectSection);
|
||||||
|
|||||||
@ -24,29 +24,33 @@ type Props = I18nProps & {
|
|||||||
withLabel?: boolean
|
withLabel?: boolean
|
||||||
};
|
};
|
||||||
|
|
||||||
function SelectMethod ({ className, isError, label = '', onChange, options, style, t, value: { name, section }, withLabel }: Props) {
|
class SelectMethod extends React.PureComponent<Props> {
|
||||||
if (!options.length) {
|
render () {
|
||||||
return null;
|
const { className, isError, label = '', onChange, options, style, t, value: { name, section }, withLabel } = this.props;
|
||||||
|
|
||||||
|
if (!options.length) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const transform = (name: Interface$Sections): SectionItem<Interfaces> =>
|
||||||
|
map[section].public[name];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dropdown
|
||||||
|
className={classes('ui--DropdownLinked-Items', className)}
|
||||||
|
isError={isError}
|
||||||
|
label={label || t('input.rpc.method', {
|
||||||
|
defaultValue: 'with method name'
|
||||||
|
})}
|
||||||
|
onChange={onChange}
|
||||||
|
options={options}
|
||||||
|
style={style}
|
||||||
|
transform={transform}
|
||||||
|
value={name}
|
||||||
|
withLabel={withLabel}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const transform = (name: Interface$Sections): SectionItem<Interfaces> =>
|
|
||||||
map[section].public[name];
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Dropdown
|
|
||||||
className={classes('ui--DropdownLinked-Items', className)}
|
|
||||||
isError={isError}
|
|
||||||
label={label || t('input.rpc.method', {
|
|
||||||
defaultValue: 'with method name'
|
|
||||||
})}
|
|
||||||
onChange={onChange}
|
|
||||||
options={options}
|
|
||||||
style={style}
|
|
||||||
transform={transform}
|
|
||||||
value={name}
|
|
||||||
withLabel={withLabel}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default translate(SelectMethod);
|
export default translate(SelectMethod);
|
||||||
|
|||||||
@ -23,22 +23,26 @@ type Props = I18nProps & {
|
|||||||
withLabel?: boolean
|
withLabel?: boolean
|
||||||
};
|
};
|
||||||
|
|
||||||
function SelectSection ({ className, defaultValue, isError, label, onChange, options, style, t, value: { section }, withLabel }: Props) {
|
class SelectSection extends React.PureComponent<Props> {
|
||||||
return (
|
render () {
|
||||||
<Dropdown
|
const { className, defaultValue, isError, label, onChange, options, style, t, value: { section }, withLabel } = this.props;
|
||||||
className={classes('ui--DropdownLinked-Sections', className)}
|
|
||||||
defaultValue={defaultValue}
|
return (
|
||||||
isError={isError}
|
<Dropdown
|
||||||
label={label || t('input.rpc.section', {
|
className={classes('ui--DropdownLinked-Sections', className)}
|
||||||
defaultValue: 'rpc area'
|
defaultValue={defaultValue}
|
||||||
})}
|
isError={isError}
|
||||||
onChange={onChange}
|
label={label || t('input.rpc.section', {
|
||||||
options={options}
|
defaultValue: 'rpc area'
|
||||||
style={style}
|
})}
|
||||||
value={section}
|
onChange={onChange}
|
||||||
withLabel={withLabel}
|
options={options}
|
||||||
/>
|
style={style}
|
||||||
);
|
value={section}
|
||||||
|
withLabel={withLabel}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default translate(SelectSection);
|
export default translate(SelectSection);
|
||||||
|
|||||||
@ -24,29 +24,33 @@ type Props = I18nProps & {
|
|||||||
withLabel?: boolean
|
withLabel?: boolean
|
||||||
};
|
};
|
||||||
|
|
||||||
function SelectKey ({ className, isError, label = '', onChange, options, style, t, value: { name, section }, withLabel }: Props) {
|
class SelectKey extends React.PureComponent<Props> {
|
||||||
if (!options.length) {
|
render () {
|
||||||
return null;
|
const { className, isError, label = '', onChange, options, style, t, value: { name, section }, withLabel } = this.props;
|
||||||
|
|
||||||
|
if (!options.length) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const transform = (name: string): SectionItem<Storages> =>
|
||||||
|
map[section].public[name];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dropdown
|
||||||
|
className={classes('ui--DropdownLinked-Items', className)}
|
||||||
|
isError={isError}
|
||||||
|
label={label || t('input.storage.key', {
|
||||||
|
defaultValue: 'with storage key'
|
||||||
|
})}
|
||||||
|
onChange={onChange}
|
||||||
|
options={options}
|
||||||
|
style={style}
|
||||||
|
transform={transform}
|
||||||
|
value={name}
|
||||||
|
withLabel={withLabel}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const transform = (name: string): SectionItem<Storages> =>
|
|
||||||
map[section].public[name];
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Dropdown
|
|
||||||
className={classes('ui--DropdownLinked-Items', className)}
|
|
||||||
isError={isError}
|
|
||||||
label={label || t('input.storage.key', {
|
|
||||||
defaultValue: 'with storage key'
|
|
||||||
})}
|
|
||||||
onChange={onChange}
|
|
||||||
options={options}
|
|
||||||
style={style}
|
|
||||||
transform={transform}
|
|
||||||
value={name}
|
|
||||||
withLabel={withLabel}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default translate(SelectKey);
|
export default translate(SelectKey);
|
||||||
|
|||||||
@ -23,22 +23,26 @@ type Props = I18nProps & {
|
|||||||
withLabel?: boolean
|
withLabel?: boolean
|
||||||
};
|
};
|
||||||
|
|
||||||
function SelectSection ({ className, defaultValue, isError, label, onChange, options, style, t, value: { section }, withLabel }: Props) {
|
class SelectSection extends React.PureComponent<Props> {
|
||||||
return (
|
render () {
|
||||||
<Dropdown
|
const { className, defaultValue, isError, label, onChange, options, style, t, value: { section }, withLabel } = this.props;
|
||||||
className={classes('ui--DropdownLinked-Sections', className)}
|
|
||||||
defaultValue={defaultValue}
|
return (
|
||||||
isError={isError}
|
<Dropdown
|
||||||
label={label || t('input.storage.section', {
|
className={classes('ui--DropdownLinked-Sections', className)}
|
||||||
defaultValue: 'storage area'
|
defaultValue={defaultValue}
|
||||||
})}
|
isError={isError}
|
||||||
onChange={onChange}
|
label={label || t('input.storage.section', {
|
||||||
options={options}
|
defaultValue: 'storage area'
|
||||||
style={style}
|
})}
|
||||||
value={section}
|
onChange={onChange}
|
||||||
withLabel={withLabel}
|
options={options}
|
||||||
/>
|
style={style}
|
||||||
);
|
value={section}
|
||||||
|
withLabel={withLabel}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default translate(SelectSection);
|
export default translate(SelectSection);
|
||||||
|
|||||||
@ -20,22 +20,26 @@ const defaultLabel: any = (// node?
|
|||||||
<div> </div>
|
<div> </div>
|
||||||
);
|
);
|
||||||
|
|
||||||
export default function Labelled ({ className, children, isHidden = false, label = defaultLabel, style, withLabel = true }: Props) {
|
export default class Labelled extends React.PureComponent<Props> {
|
||||||
if (isHidden) {
|
render () {
|
||||||
return null;
|
const { className, children, isHidden = false, label = defaultLabel, style, withLabel = true } = this.props;
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
if (isHidden) {
|
||||||
<div
|
return null;
|
||||||
className={classes('ui--Labelled', className)}
|
}
|
||||||
style={style}
|
|
||||||
>
|
return (
|
||||||
{
|
<div
|
||||||
withLabel
|
className={classes('ui--Labelled', className)}
|
||||||
? <Label>{label}</Label>
|
style={style}
|
||||||
: null
|
>
|
||||||
}
|
{
|
||||||
{children}
|
withLabel
|
||||||
</div>
|
? <Label>{label}</Label>
|
||||||
);
|
: null
|
||||||
|
}
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,26 +20,30 @@ type Props = BareProps & {
|
|||||||
withLabel?: boolean
|
withLabel?: boolean
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function Output ({ className, children, isError = false, isHidden, label, style, value, withCopy = false, withLabel }: Props) {
|
export default class Output extends React.PureComponent<Props> {
|
||||||
return (
|
render () {
|
||||||
<Labelled
|
const { className, children, isError = false, isHidden, label, style, value, withCopy = false, withLabel } = this.props;
|
||||||
className={className}
|
|
||||||
isHidden={isHidden}
|
return (
|
||||||
label={label}
|
<Labelled
|
||||||
style={style}
|
className={className}
|
||||||
withLabel={withLabel}
|
isHidden={isHidden}
|
||||||
>
|
label={label}
|
||||||
<div className={classes('ui--output', isError && 'error')}>
|
style={style}
|
||||||
{value}
|
withLabel={withLabel}
|
||||||
{children}
|
>
|
||||||
{
|
<div className={classes('ui--output', isError && 'error')}>
|
||||||
withCopy
|
{value}
|
||||||
? (
|
{children}
|
||||||
<CopyButton className='ui--output-button' value={value} />
|
{
|
||||||
)
|
withCopy
|
||||||
: null
|
? (
|
||||||
}
|
<CopyButton className='ui--output-button' value={value} />
|
||||||
</div>
|
)
|
||||||
</Labelled>
|
: null
|
||||||
);
|
}
|
||||||
|
</div>
|
||||||
|
</Labelled>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,19 +16,23 @@ type Props = BareProps & {
|
|||||||
withLabel?: boolean
|
withLabel?: boolean
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function Static ({ className, children, isHidden, label, style, value, withLabel }: Props) {
|
export default class Static extends React.PureComponent<Props> {
|
||||||
return (
|
render () {
|
||||||
<Labelled
|
const { className, children, isHidden, label, style, value, withLabel } = this.props;
|
||||||
className={className}
|
|
||||||
isHidden={isHidden}
|
return (
|
||||||
label={label}
|
<Labelled
|
||||||
style={style}
|
className={className}
|
||||||
withLabel={withLabel}
|
isHidden={isHidden}
|
||||||
>
|
label={label}
|
||||||
<div className='ui dropdown selection disabled'>
|
style={style}
|
||||||
{value}
|
withLabel={withLabel}
|
||||||
{children}
|
>
|
||||||
</div>
|
<div className='ui dropdown selection disabled'>
|
||||||
</Labelled>
|
{value}
|
||||||
);
|
{children}
|
||||||
|
</div>
|
||||||
|
</Labelled>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,26 +13,29 @@ type DemoProps = {
|
|||||||
component: string
|
component: string
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function Demo ({ attrs, attrsReq, children, component }: DemoProps) {
|
export default class Demo extends React.PureComponent<DemoProps> {
|
||||||
const allAttrs = Object.assign({ className: '"..."', style: '{...}' }, attrs);
|
render () {
|
||||||
const attrsText = Object
|
const { attrs, attrsReq, children, component } = this.props;
|
||||||
.keys(allAttrs)
|
const allAttrs = Object.assign({ className: '"..."', style: '{...}' }, attrs);
|
||||||
.map((attr) => {
|
const attrsText = Object
|
||||||
const value = allAttrs[attr];
|
.keys(allAttrs)
|
||||||
const bool = value === 'bool';
|
.map((attr) => {
|
||||||
const opt = bool || !attrsReq.includes(attr);
|
const value = allAttrs[attr];
|
||||||
|
const bool = value === 'bool';
|
||||||
|
const opt = bool || !attrsReq.includes(attr);
|
||||||
|
|
||||||
return `${opt ? '[' : ''}${attr}${bool ? '' : '='}${bool ? '' : value}${opt ? ']' : ''}`;
|
return `${opt ? '[' : ''}${attr}${bool ? '' : '='}${bool ? '' : value}${opt ? ']' : ''}`;
|
||||||
})
|
})
|
||||||
.sort()
|
.sort()
|
||||||
.join('\n ');
|
.join('\n ');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container className='ui--DemoContainer'>
|
<Container className='ui--DemoContainer'>
|
||||||
<pre className='ui--DemoHeader'>
|
<pre className='ui--DemoHeader'>
|
||||||
{`<${component}\n ${attrsText}\n/>`}
|
{`<${component}\n ${attrsText}\n/>`}
|
||||||
</pre>
|
</pre>
|
||||||
{children}
|
{children}
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,13 +12,15 @@ type Props = BaseProps & {
|
|||||||
children: any // React$Node
|
children: any // React$Node
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function Container ({ children, className, style }: Props) {
|
export default class Container extends React.PureComponent<Props> {
|
||||||
return (
|
render () {
|
||||||
<div
|
return (
|
||||||
className={['ui--Container', className].join(' ')}
|
<div
|
||||||
style={style}
|
className={['ui--Container', this.props.className].join(' ')}
|
||||||
>
|
style={this.props.style}
|
||||||
{children}
|
>
|
||||||
</div>
|
{this.props.children}
|
||||||
);
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,34 +9,37 @@ import addressEncode from '@polkadot/util-keyring/address/encode';
|
|||||||
import Container from '../Container/Demo';
|
import Container from '../Container/Demo';
|
||||||
import IdentityIcon from './index';
|
import IdentityIcon from './index';
|
||||||
|
|
||||||
export default function Demo () {
|
export default class Demo extends React.PureComponent {
|
||||||
const identities: Array<Uint8Array | string> = [new Uint8Array(32)];
|
render () {
|
||||||
|
const identities: Array<Uint8Array | string> = [new Uint8Array(32)];
|
||||||
|
|
||||||
while (identities.length !== 10) {
|
while (identities.length !== 10) {
|
||||||
identities.push(
|
identities.push(
|
||||||
addressEncode(randomAsU8a(32))
|
addressEncode(randomAsU8a(32))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Container
|
||||||
|
component='IdentityIcon'
|
||||||
|
attrs={{
|
||||||
|
size: '<number>',
|
||||||
|
value: '{...}'
|
||||||
|
}}
|
||||||
|
attrsReq={[
|
||||||
|
'value'
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
{
|
||||||
|
identities.map((value) => (
|
||||||
|
<IdentityIcon
|
||||||
|
key={value.toString()}
|
||||||
|
value={value}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</Container>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
|
||||||
<Container
|
|
||||||
component='IdentityIcon'
|
|
||||||
attrs={{
|
|
||||||
size: '<number>',
|
|
||||||
value: '{...}'
|
|
||||||
}}
|
|
||||||
attrsReq={[
|
|
||||||
'value'
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
{
|
|
||||||
identities.map((value) => (
|
|
||||||
<IdentityIcon
|
|
||||||
key={value.toString()}
|
|
||||||
value={value}
|
|
||||||
/>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</Container>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,12 +15,16 @@ type Props = BaseProps & {
|
|||||||
value: string | Uint8Array
|
value: string | Uint8Array
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function IdentityIcon ({ className, size = 64, style, value }: Props) {
|
export default class IdentityIcon extends React.PureComponent<Props> {
|
||||||
return (
|
render () {
|
||||||
<div
|
const { className, size = 64, style, value } = this.props;
|
||||||
className={['ui--IdentityIcon', className].join(' ')}
|
|
||||||
ref={appendIcon(value, size)}
|
return (
|
||||||
style={style}
|
<div
|
||||||
/>
|
className={['ui--IdentityIcon', className].join(' ')}
|
||||||
);
|
ref={appendIcon(value, size)} // TODO: The append should probably be in this class and done in a more "React-y" way
|
||||||
|
style={style}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,33 +13,37 @@ type Props = BareProps & {
|
|||||||
queue: Array<QueueTx>
|
queue: Array<QueueTx>
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function Status ({ className, queue, style }: Props) {
|
export default class Status extends React.PureComponent<Props> {
|
||||||
const available = queue.filter(({ status }) =>
|
render () {
|
||||||
!['completed', 'incomplete'].includes(status)
|
const { queue, className, style } = this.props;
|
||||||
);
|
const available = queue.filter(({ status }) =>
|
||||||
|
|
||||||
if (!available.length) {
|
!['completed', 'incomplete'].includes(status)
|
||||||
return null;
|
);
|
||||||
|
|
||||||
|
if (!available.length) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={classes('ui--signer-Status', className)}
|
||||||
|
style={style}
|
||||||
|
>
|
||||||
|
{available.map(({ rpc: { name, section }, id, status }) =>
|
||||||
|
<div
|
||||||
|
className={classes('ui--signer-Status-Item', status)}
|
||||||
|
key={id}
|
||||||
|
>
|
||||||
|
<div className='header'>
|
||||||
|
{section}.{name}
|
||||||
|
</div>
|
||||||
|
<div className='status'>
|
||||||
|
{status}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className={classes('ui--signer-Status', className)}
|
|
||||||
style={style}
|
|
||||||
>
|
|
||||||
{available.map(({ rpc: { name, section }, id, status }) =>
|
|
||||||
<div
|
|
||||||
className={classes('ui--signer-Status-Item', status)}
|
|
||||||
key={id}
|
|
||||||
>
|
|
||||||
<div className='header'>
|
|
||||||
{section}.{name}
|
|
||||||
</div>
|
|
||||||
<div className='status'>
|
|
||||||
{status}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,27 +22,31 @@ export type SignerType = React.ComponentType<Props> & {
|
|||||||
Queue: React.ComponentType<QueueComponentProps>
|
Queue: React.ComponentType<QueueComponentProps>
|
||||||
};
|
};
|
||||||
|
|
||||||
function Signer ({ children, className, style }: Props) {
|
class Signer extends React.PureComponent<Props> {
|
||||||
return (
|
render () {
|
||||||
<Queue>
|
const { children, className, style } = this.props;
|
||||||
{children}
|
|
||||||
<QueueConsumer>
|
return (
|
||||||
{({ queue, queueSetStatus }: QueueProps) => [
|
<Queue>
|
||||||
<Modal
|
{children}
|
||||||
className={className}
|
<QueueConsumer>
|
||||||
key='signer-modal'
|
{({ queue, queueSetStatus }: QueueProps) => [
|
||||||
queue={queue}
|
<Modal
|
||||||
queueSetStatus={queueSetStatus}
|
className={className}
|
||||||
style={style}
|
key='signer-modal'
|
||||||
/>,
|
queue={queue}
|
||||||
<Status
|
queueSetStatus={queueSetStatus}
|
||||||
key='signer-status'
|
style={style}
|
||||||
queue={queue}
|
/>,
|
||||||
/>
|
<Status
|
||||||
]}
|
key='signer-status'
|
||||||
</QueueConsumer>
|
queue={queue}
|
||||||
</Queue>
|
/>
|
||||||
);
|
]}
|
||||||
|
</QueueConsumer>
|
||||||
|
</Queue>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(Signer as SignerType).Queue = Queue;
|
(Signer as SignerType).Queue = Queue;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user