WIP 257 extrinsics no accounts (#273)

* WIP: Not sure if this is proper use of Link / Button

* remove console log

* remove space

* moved logic to index and use accountsObservable

* fixed travis recs

* added translate import and t(), changed button to simple link, updated div to main
This commit is contained in:
Marni 2018-09-05 06:07:40 -04:00 committed by Jaco Greeff
parent 351072a4e4
commit f5a19e6062

View File

@ -1,23 +1,43 @@
// Copyright 2017-2018 @polkadot/app-extrinsics authors & contributors
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
import { BareProps } from '@polkadot/ui-app/types';
import { QueueProps } from '@polkadot/ui-signer/types';
import { I18nProps } from '@polkadot/ui-app/types';
import './index.css';
import React from 'react';
import { Link } from 'react-router-dom';
import { QueueConsumer } from '@polkadot/ui-signer/Context';
import accountsObservable from '@polkadot/ui-keyring/observable/accounts';
import withObservableBase from '@polkadot/ui-react-rx/with/observableBase';
import translate from './translate';
import Selection from './Selection';
type Props = BareProps & {
basePath: string
type Props = I18nProps & {
basePath: string,
accountAll?: Array<any>
};
export default class ExtrinsicsApp extends React.PureComponent<Props> {
class ExtrinsicsApp extends React.PureComponent<Props> {
render () {
const { accountAll, t } = this.props;
if (!accountAll || !Object.keys(accountAll).length) {
return (
<main className='extrinsics--App'>
{t('accounts.none', {
defaultValue: 'There are no saved accounts. '
})}
<Link to='/accounts'>
Add Accounts.
</Link>
</main>
);
}
return (
<main className='extrinsics--App'>
<QueueConsumer>
@ -29,3 +49,7 @@ export default class ExtrinsicsApp extends React.PureComponent<Props> {
);
}
}
export { ExtrinsicsApp };
export default withObservableBase(accountsObservable.subject, { propName: 'accountAll' })(translate(ExtrinsicsApp));