ghost-portal/packages/app-explorer/src/BestHash.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

20 lines
690 B
TypeScript

// Copyright 2017-2018 @polkadot/app-explorer authors & contributors
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
import { Header } from '@polkadot/primitives/header';
import headerHash from '@polkadot/primitives/codec/header/hash';
import withObservableDiv from '@polkadot/ui-react-rx/with/observableDiv';
import u8aToHex from '@polkadot/util/u8a/toHex';
const Component: React.ComponentType<any> = withObservableDiv('chainNewHead')(
(value?: Header): string | undefined =>
value
? u8aToHex(headerHash(value), 64)
: value,
{ className: 'explorer--BestHash' }
);
export default Component;