ghost-portal/packages/ui-react-rx/src/demo.tsx
Jaco Greeff 46a48539b7
Additional block production overview on explorer (#212)
* Cleanup Card layouts

* Additional block production overview on explorer

* Adjust Card padding for accounts

* Observable calculations into ApiObservable

* DRY-er combineLatest + .pipe(map(...))

* .pipe(map(...))

* Progress takes value + total, auto-colors

* CardSummary with Progress

* Small style updates

* Cleanup withApiObservable (optional value name)

* Cleanup progress props

* Cleanup rpc method use

* Auto-set the prop from withStorage

* Cleanups in observable use

* Cleanups to layout

* Initial bestNumber

* Poll for changes in ApiObservable

* WIP (debug)

* Initial conversion (untested) or subscribeStorage

* s/apiObservable/observable/

* Starting to show stuff (after storage subscriptions). WIP.

* Staking UI works, still WIP on rest.

* Readability

* Storage withObservableDiv, Closes https://github.com/polkadot-js/apps/issues/215

* Add encoding FIXMEs

* 'nominee' on set click

* Align withObservable with others (single line)

* Retrieve ss58 encoded AccountId from storage

* Update with latest api (null/undefined storage distinction)
2018-08-13 12:05:11 +02:00

53 lines
1.5 KiB
TypeScript

// Copyright 2017-2018 @polkadot/ui-react-rx authors & contributors
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
import React from 'react';
import ReactDOM from 'react-dom';
import mockProvider from '@polkadot/api-provider/mock';
import Api from './Api';
import Balance from './Balance';
import BestNumber from './BestNumber';
import Chain from './Chain';
import Connected from './Connected';
import NodeName from './NodeName';
import NodeVersion from './NodeVersion';
import Nonce from './Nonce';
import withApi from './with/api';
const provider = mockProvider();
const ALICE_ADDR = '5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ';
const ALICE_PUBLIC = '0xd172a74cda4c865912c32ba0a80a57ae69abae410e5ccb59dee84e2f4432db4f';
const element = document.getElementById('demo');
if (!element) {
throw new Error('Unable to find #demo element');
}
const WithApiDebug = withApi(
(apiProps) => (
<pre style={{ background: '#f5f5f5', padding: '0.5em' }}>
{JSON.stringify(apiProps, undefined, 2)}
</pre>
)
);
ReactDOM.render(
<Api provider={provider}>
<Connected label='status =' />
<NodeName label='name =' />
<NodeVersion label='version =' />
<Chain label='chain =' />
<br />
<BestNumber label='best block #' />
<Balance label='balance =' params={[ALICE_PUBLIC]} />
<Nonce label='nonce =' params={ALICE_ADDR} />
<br />
<WithApiDebug />
</Api>,
element
);