Polkadot poll app (#3162)

* Polkadot poll app

* Bump deps

* Fix vanitygen dep

* Small formatting adjustments

* Adjust padding consistency

* Value align

* Show end blocks & time remaining

* Disable toggles on votend

* Countdown & close

* Uppercase millionand billion

* long-form million/billion

* Hide toggle when not voting
This commit is contained in:
Jaco Greeff 2020-07-10 23:25:50 +02:00 committed by GitHub
parent 038f961885
commit 17a3deb04c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 582 additions and 132 deletions

View File

@ -33,12 +33,12 @@
"afterSign": "electron-builder-notarize"
},
"resolutions": {
"@polkadot/api": "^1.24.0-beta.1",
"@polkadot/api-contract": "^1.24.0-beta.1",
"@polkadot/keyring": "^2.18.0-beta.2",
"@polkadot/types": "^1.24.0-beta.1",
"@polkadot/util": "^2.18.0-beta.2",
"@polkadot/util-crypto": "^2.18.0-beta.2",
"@polkadot/api": "^1.24.0-beta.2",
"@polkadot/api-contract": "^1.24.0-beta.2",
"@polkadot/keyring": "^2.18.0-beta.3",
"@polkadot/types": "^1.24.0-beta.2",
"@polkadot/util": "^2.18.0-beta.3",
"@polkadot/util-crypto": "^2.18.0-beta.3",
"babel-core": "^7.0.0-bridge.0"
},
"scripts": {

View File

@ -4,11 +4,11 @@
import { Route } from './types';
import Template from '@polkadot/app-123code';
import Component from '@polkadot/app-123code';
export default function create (t: <T = string> (key: string, text: string, options: { ns: string }) => T): Route {
return {
Component: Template,
Component,
display: {
isHidden: true,
needsAccounts: true,

View File

@ -4,11 +4,11 @@
import { Route } from './types';
import Accounts, { useCounter } from '@polkadot/app-accounts';
import Component, { useCounter } from '@polkadot/app-accounts';
export default function create (t: <T = string> (key: string, text: string, options: { ns: string }) => T): Route {
return {
Component: Accounts,
Component,
display: {
needsApi: []
},

View File

@ -4,11 +4,11 @@
import { Route } from './types';
import Claims, { useCounter } from '@polkadot/app-claims';
import Component, { useCounter } from '@polkadot/app-claims';
export default function create (t: <T = string> (key: string, text: string, options: { ns: string }) => T): Route {
return {
Component: Claims,
Component,
display: {
needsAccounts: true,
needsApi: [

View File

@ -4,11 +4,11 @@
import { Route } from './types';
import Contracts from '@polkadot/app-contracts';
import Component from '@polkadot/app-contracts';
export default function create (t: <T = string> (key: string, text: string, options: { ns: string }) => T): Route {
return {
Component: Contracts,
Component,
display: {
needsAccounts: true,
needsApi: [

View File

@ -4,11 +4,11 @@
import { Route } from './types';
import Council, { useCounter } from '@polkadot/app-council';
import Component, { useCounter } from '@polkadot/app-council';
export default function create (t: <T = string> (key: string, text: string, options: { ns: string }) => T): Route {
return {
Component: Council,
Component,
display: {
needsApi: [
[

View File

@ -4,11 +4,11 @@
import { Route } from './types';
import Dashboard from '@polkadot/app-dashboard';
import Component from '@polkadot/app-dashboard';
export default function create (t: <T = string> (key: string, text: string, options: { ns: string }) => T): Route {
return {
Component: Dashboard,
Component,
display: {
isHidden: true
},

View File

@ -4,11 +4,11 @@
import { Route } from './types';
import Democracy, { useCounter } from '@polkadot/app-democracy';
import Component, { useCounter } from '@polkadot/app-democracy';
export default function create (t: <T = string> (key: string, text: string, options: { ns: string }) => T): Route {
return {
Component: Democracy,
Component,
display: {
needsApi: [
'tx.democracy.notePreimage'

View File

@ -4,11 +4,11 @@
import { Route } from './types';
import Explorer from '@polkadot/app-explorer';
import Component from '@polkadot/app-explorer';
export default function create (t: <T = string> (key: string, text: string, options: { ns: string }) => T): Route {
return {
Component: Explorer,
Component,
display: {
needsApi: []
},

View File

@ -4,11 +4,11 @@
import { Route } from './types';
import Extrinsics from '@polkadot/app-extrinsics';
import Component from '@polkadot/app-extrinsics';
export default function create (t: <T = string> (key: string, text: string, options: { ns: string }) => T): Route {
return {
Component: Extrinsics,
Component,
display: {
needsAccounts: true,
needsApi: []

View File

@ -4,11 +4,11 @@
import { Route } from './types';
import GenericAsset from '@polkadot/app-generic-asset';
import Component from '@polkadot/app-generic-asset';
export default function create (t: <T = string> (key: string, text: string, options: { ns: string }) => T): Route {
return {
Component: GenericAsset,
Component,
display: {
isHidden: false,
needsAccounts: true,

View File

@ -4,11 +4,11 @@
import { Route } from './types';
import Translator from '@polkadot/app-i18n';
import Component from '@polkadot/app-i18n';
export default function create (t: <T = string> (key: string, text: string, options: { ns: string }) => T): Route {
return {
Component: Translator,
Component,
display: {
isHidden: true
},

View File

@ -21,6 +21,7 @@ import genericAsset from './generic-asset';
import i18n from './i18n';
import js from './js';
import parachains from './parachains';
import poll from './poll';
import settings from './settings';
import society from './society';
import staking from './staking';
@ -38,6 +39,7 @@ export default function create (t: <T = string> (key: string, text: string, opti
explorer(t),
accounts(t),
claims(t),
poll(t),
transfer(t),
genericAsset(t),
null,
@ -53,6 +55,7 @@ export default function create (t: <T = string> (key: string, text: string, opti
explorer(t),
accounts(t),
claims(t),
poll(t),
transfer(t),
genericAsset(t),
null,

View File

@ -4,11 +4,11 @@
import { Route } from './types';
import Js from '@polkadot/app-js';
import Component from '@polkadot/app-js';
export default function create (t: <T = string> (key: string, text: string, options: { ns: string }) => T): Route {
return {
Component: Js,
Component,
display: {
needsApi: []
},

View File

@ -4,11 +4,11 @@
import { Route } from './types';
import Parachains from '@polkadot/app-parachains';
import Component from '@polkadot/app-parachains';
export default function create (t: <T = string> (key: string, text: string, options: { ns: string }) => T): Route {
return {
Component: Parachains,
Component,
display: {
needsApi: [
'query.parachains.code'

View File

@ -0,0 +1,22 @@
// Copyright 2017-2020 @polkadot/apps-routing authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { Route } from './types';
import Component from '@polkadot/app-poll';
export default function create (t: <T = string> (key: string, text: string, options: { ns: string }) => T): Route {
return {
Component,
display: {
needsAccounts: true,
needsApi: [
'tx.poll.vote'
]
},
icon: 'podcast',
name: 'poll',
text: t<string>('nav.poll', 'Token poll', { ns: 'apps-routing' })
};
}

View File

@ -4,11 +4,11 @@
import { Route } from './types';
import Settings, { useCounter } from '@polkadot/app-settings';
import Component, { useCounter } from '@polkadot/app-settings';
export default function create (t: <T = string> (key: string, text: string, options: { ns: string }) => T): Route {
return {
Component: Settings,
Component,
display: {},
icon: 'cogs',
name: 'settings',

View File

@ -4,11 +4,11 @@
import { Route } from './types';
import Society from '@polkadot/app-society';
import Component from '@polkadot/app-society';
export default function create (t: <T = string> (key: string, text: string, options: { ns: string }) => T): Route {
return {
Component: Society,
Component,
display: {
needsAccounts: true,
needsApi: [

View File

@ -4,11 +4,11 @@
import { Route } from './types';
import Staking from '@polkadot/app-staking';
import Component from '@polkadot/app-staking';
export default function create (t: <T = string> (key: string, text: string, options: { ns: string }) => T): Route {
return {
Component: Staking,
Component,
display: {
needsApi: [
['tx.staking.bond']

View File

@ -4,11 +4,11 @@
import { Route } from './types';
import Storage from '@polkadot/app-storage';
import Component from '@polkadot/app-storage';
export default function create (t: <T = string> (key: string, text: string, options: { ns: string }) => T): Route {
return {
Component: Storage,
Component,
display: {
needsApi: []
},

View File

@ -4,11 +4,11 @@
import { Route } from './types';
import Sudo from '@polkadot/app-sudo';
import Component from '@polkadot/app-sudo';
export default function create (t: <T = string> (key: string, text: string, options: { ns: string }) => T): Route {
return {
Component: Sudo,
Component,
display: {
needsAccounts: true,
needsApi: [

View File

@ -4,11 +4,11 @@
import { Route } from './types';
import TechComm, { useCounter } from '@polkadot/app-tech-comm';
import Component, { useCounter } from '@polkadot/app-tech-comm';
export default function create (t: <T = string> (key: string, text: string, options: { ns: string }) => T): Route {
return {
Component: TechComm,
Component,
display: {
needsAccounts: true,
needsApi: [

View File

@ -4,11 +4,11 @@
import { Route } from './types';
import Toolbox from '@polkadot/app-toolbox';
import Component from '@polkadot/app-toolbox';
export default function create (t: <T = string> (key: string, text: string, options: { ns: string }) => T): Route {
return {
Component: Toolbox,
Component,
display: {
needsApi: []
},

View File

@ -4,12 +4,12 @@
import { Route } from './types';
import TransferModal from '@polkadot/app-accounts/Accounts/modals/Transfer';
import Modal from '@polkadot/app-accounts/Accounts/modals/Transfer';
export default function create (t: <T = string> (key: string, text: string, options: { ns: string }) => T): Route {
return {
Component: TransferModal,
Modal: TransferModal,
Component: Modal,
Modal,
display: {
isHidden: false,
needsAccounts: true,

View File

@ -4,11 +4,11 @@
import { Route } from './types';
import Treasury, { useCounter } from '@polkadot/app-treasury';
import Component, { useCounter } from '@polkadot/app-treasury';
export default function create (t: <T = string> (key: string, text: string, options: { ns: string }) => T): Route {
return {
Component: Treasury,
Component,
display: {
needsApi: [
'tx.treasury.proposeSpend'

View File

@ -12,6 +12,6 @@
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.10.4",
"@polkadot/api-contract": "^1.24.0-beta.1"
"@polkadot/api-contract": "^1.24.0-beta.2"
}
}

View File

View File

201
packages/page-poll/LICENSE Normal file
View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1 @@
# @polkadot/app-poll

View File

@ -0,0 +1,17 @@
{
"name": "@polkadot/app-poll",
"private": true,
"version": "0.49.0-beta.19",
"description": "A basic polling module",
"main": "index.js",
"scripts": {},
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [
"Jaco Greeff <jacogr@gmail.com>"
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.10.4",
"@polkadot/react-components": "0.49.0-beta.19"
}
}

View File

@ -0,0 +1,185 @@
// Copyright 2017-2020 @polkadot/app-poll authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { Balance, BlockNumber } from '@polkadot/types/interfaces';
import { ITuple } from '@polkadot/types/types';
import BN from 'bn.js';
import React, { useEffect, useState } from 'react';
import styled from 'styled-components';
import { Button, Columar, InputAddress, Progress, Spinner, Toggle, TxButton } from '@polkadot/react-components';
import { useApi, useCall } from '@polkadot/react-hooks';
import { FormatBalance, BlockToTime } from '@polkadot/react-query';
import { BN_ONE, BN_ZERO, bnMax, formatNumber } from '@polkadot/util';
import { useTranslation } from './translate';
interface Props {
className?: string;
}
const DIV = new BN(1_000_000);
function PollApp ({ className }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const totals = useCall<ITuple<[Balance, Balance, Balance, Balance]>>(api.query.poll.totals, []);
const bestNumber = useCall<BlockNumber>(api.derive.chain.bestNumber, []);
const [accountId, setAccountId] = useState<string | null>(null);
const [opt10m, setOpt10m] = useState(true);
const [opt100m, setOpt100m] = useState(false);
const [opt1b, setOpt1b] = useState(false);
const [opt10b, setOpt10b] = useState(false);
const [progress, setProgress] = useState<BN[] | undefined>();
useEffect((): void => {
if (totals) {
const max = bnMax(BN_ONE, ...totals);
setProgress(totals.map((total) => total.mul(DIV).div(max)));
}
}, [totals]);
if (!totals || !progress || !bestNumber) {
return <Spinner label={t<string>('Retrieving totals...')} />;
}
const blocksLeft = (api.consts.poll.end as BlockNumber).sub(bestNumber);
const canVote = blocksLeft.gt(BN_ZERO);
const options: [string, boolean, (value: boolean) => void][] = [
[t('10 million DOTs; status quo'), opt10m, setOpt10m],
[t('100 million DOTs; 11 decimals'), opt100m, setOpt100m],
[t('1 billion DOTs; 10 decimals'), opt1b, setOpt1b],
[t('10 billion DOTs; 9 decimals'), opt10b, setOpt10b]
];
return (
<main className={className}>
<div className='pollContainer'>
<h1>{t('poll on token decimals')}</h1>
<article className='keepAlive'>
<p>{t('This poll is setup to judge the sentiment of the Polkadot token holders in adjusting the number of decimals that is used to identify one full DOT. It does not change the overall supply, but rather just allows for a different representation of the current supply.')}</p>
<p>{t('You can indicate your vote for any combination of the options laid out below.')}</p>
<div className={`options ${canVote ? 'canVote' : ''}`}>
{options.map(([label, value, onChange], index) =>
<Columar key={index}>
<Columar.Column className='option'>
<div className='optionName'>{label}</div>
<Toggle
className='pollToggle'
isDisabled={!canVote}
label={
canVote
? value
? t<string>('Aye, I can support this')
: t<string>('Nay, I cannot support this')
: t<string>('Voting closed')
}
onChange={onChange}
value={canVote && value}
/>
</Columar.Column>
<Columar.Column>
{totals[index].isZero()
? <div className='result' />
: (
<div className='result'>
<Progress
total={DIV}
value={progress[index]}
/>
<FormatBalance value={totals[index]} />
</div>
)
}
</Columar.Column>
</Columar>
)}
</div>
{canVote && (
<>
<InputAddress
label={t('vote using my account')}
onChange={setAccountId}
type='account'
/>
<Button.Group>
<TxButton
accountId={accountId}
icon='paper-plane'
label={t('Vote')}
params={[[opt10m, opt100m, opt1b, opt10b]]}
tx='poll.vote'
/>
</Button.Group>
</>
)}
</article>
<div className='pollBlocksRight'>
{canVote && <BlockToTime blocks={blocksLeft} />}
<div>#{formatNumber(api.consts.poll.end as BlockNumber)}</div>
</div>
</div>
</main>
);
}
export default React.memo(styled(PollApp)`
.pollBlocksRight {
padding: 0.5rem 1rem;
text-align: right;
}
.pollContainer {
margin: 2rem auto;
max-width: 50rem;
}
.options {
margin: 1.5rem 0 1rem 0;
.ui--Columnar {
margin: 0 -1.25rem;
padding: 0 1.25rem;
&:nth-child(odd) {
background: #f9f8f7;
}
.ui--Column {
padding: 1rem 1.5rem;
}
}
.optionName {
font-size: 1.2rem;
font-weight: 100;
line-height: 1;
}
.pollToggle {
margin-top: 0.5rem;
text-align: right;
}
&:not(.canVote) {
.ui--Toggle {
opacity: 0;
.toggle {
display: none;
}
}
}
}
.result {
margin: 1rem 0 0 0;
text-align: right;
.ui--Progress {
margin-bottom: 0.5rem;
}
}
`);

View File

@ -0,0 +1,9 @@
// Copyright 2017-2020 @polkadot/app-poll authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { useTranslation as useTranslationBase, UseTranslationResponse } from 'react-i18next';
export function useTranslation (): UseTranslationResponse {
return useTranslationBase('app-poll');
}

View File

@ -31,7 +31,7 @@
"homepage": "https://github.com/polkadot-js/ui/tree/master/packages/ui-reactive#readme",
"dependencies": {
"@babel/runtime": "^7.10.4",
"@polkadot/api": "^1.24.0-beta.1",
"@polkadot/api": "^1.24.0-beta.2",
"@polkadot/extension-dapp": "^0.32.0-beta.5",
"rxjs-compat": "^6.6.0"
}

View File

@ -14,15 +14,15 @@
"@fortawesome/fontawesome-svg-core": "^1.2.29",
"@fortawesome/free-solid-svg-icons": "^5.13.1",
"@fortawesome/react-fontawesome": "^0.1.11",
"@polkadot/keyring": "^2.18.0-beta.2",
"@polkadot/keyring": "^2.18.0-beta.3",
"@polkadot/react-api": "0.49.0-beta.19",
"@polkadot/react-identicon": "^0.56.0-beta.0",
"@polkadot/react-qr": "^0.56.0-beta.0",
"@polkadot/react-query": "0.49.0-beta.19",
"@polkadot/ui-keyring": "^0.56.0-beta.0",
"@polkadot/ui-settings": "^0.56.0-beta.0",
"@polkadot/util": "^2.18.0-beta.2",
"@polkadot/util-crypto": "^2.18.0-beta.2",
"@polkadot/util": "^2.18.0-beta.3",
"@polkadot/util-crypto": "^2.18.0-beta.3",
"chart.js": "^2.9.3",
"codeflask": "^1.4.1",
"i18next": "^19.5.4",

View File

@ -56,6 +56,7 @@ i18next
'app-i18n',
'app-js',
'app-parachains',
'app-poll',
'app-settings',
'app-society',
'app-staking',

View File

@ -118,7 +118,7 @@ export default createGlobalStyle<Props>`
border-color: transparent; */
}
&:not(:hover) {
&:not(:hover):not(.keepAlive) {
.ui.button:not(.disabled) {
background: #eee !important;
color: #555 !important;

View File

@ -33,7 +33,7 @@ function format (value: Compact<any> | BN | string, currency: string, withSi?: b
return formatBalance(value);
}
return <>{prefix}{!isShort && (<>.<span className='ui--FormatBalance-postfix'>{`000${postfix || ''}`.slice(-3)}</span></>)} {currency}</>;
return <>{`${prefix}${isShort ? '' : '.'}`}{!isShort && (<><span className='ui--FormatBalance-postfix'>{`000${postfix || ''}`.slice(-3)}</span></>)} {currency}</>;
}
// function formatSi (value: Compact<any> | BN | string): React.ReactNode {

View File

@ -39,6 +39,8 @@
"@polkadot/app-js/*": [ "packages/page-js/src/*" ],
"@polkadot/app-parachains": [ "packages/page-parachains/src" ],
"@polkadot/app-parachains/*": [ "packages/page-parachains/src/*" ],
"@polkadot/app-poll": [ "packages/page-poll/src" ],
"@polkadot/app-poll/*": [ "packages/page-poll/src/*" ],
"@polkadot/app-settings": [ "packages/page-settings/src" ],
"@polkadot/app-settings/*": [ "packages/page-settings/src/*" ],
"@polkadot/app-society": [ "packages/page-society/src" ],

157
yarn.lock
View File

@ -2948,57 +2948,57 @@ __metadata:
languageName: node
linkType: hard
"@polkadot/api-contract@npm:^1.24.0-beta.1":
version: 1.24.0-beta.1
resolution: "@polkadot/api-contract@npm:1.24.0-beta.1"
"@polkadot/api-contract@npm:^1.24.0-beta.2":
version: 1.24.0-beta.2
resolution: "@polkadot/api-contract@npm:1.24.0-beta.2"
dependencies:
"@babel/runtime": ^7.10.4
"@polkadot/api": 1.24.0-beta.1
"@polkadot/rpc-core": 1.24.0-beta.1
"@polkadot/types": 1.24.0-beta.1
"@polkadot/api": 1.24.0-beta.2
"@polkadot/rpc-core": 1.24.0-beta.2
"@polkadot/types": 1.24.0-beta.2
"@polkadot/util": ^2.18.0-beta.2
bn.js: ^5.1.2
rxjs: ^6.6.0
checksum: 3/49e3a1ff5ce17bf10e44c58a912496fd5065c32a704d990c19bfec5774debafd8411f8cb9ee22a7a0a7dcb2097a31f07a98cbcc96fc1ed7e704dcf1c7efff981
checksum: 3/ab6bd14d50cc72338662b028076cb681d99a3d81a1ea220f7706d15c8fc65fc0b3d73dbb5cf0b4bb58a3bc41b21804ad926086e67c7dc67c885b4deeaa4a5bf5
languageName: node
linkType: hard
"@polkadot/api-derive@npm:1.24.0-beta.1":
version: 1.24.0-beta.1
resolution: "@polkadot/api-derive@npm:1.24.0-beta.1"
"@polkadot/api-derive@npm:1.24.0-beta.2":
version: 1.24.0-beta.2
resolution: "@polkadot/api-derive@npm:1.24.0-beta.2"
dependencies:
"@babel/runtime": ^7.10.4
"@polkadot/api": 1.24.0-beta.1
"@polkadot/rpc-core": 1.24.0-beta.1
"@polkadot/rpc-provider": 1.24.0-beta.1
"@polkadot/types": 1.24.0-beta.1
"@polkadot/api": 1.24.0-beta.2
"@polkadot/rpc-core": 1.24.0-beta.2
"@polkadot/rpc-provider": 1.24.0-beta.2
"@polkadot/types": 1.24.0-beta.2
"@polkadot/util": ^2.18.0-beta.2
"@polkadot/util-crypto": ^2.18.0-beta.2
bn.js: ^5.1.2
memoizee: ^0.4.14
rxjs: ^6.6.0
checksum: 3/523475cbca4a27bc5ef7412587ddbdf667ab72d8e0e4af141bfb440b89578218c07204198cceb5f68b4184a66568983628194f1fed189e11a211c976e52f072b
checksum: 3/a1de26a65b968f63e1bd4f626e74c0f14ab7b8f819d5a06469ebbb8ea383777906d6285ad7c4732c96e11168ead70f0cbbe0dc882247f17a4b69f8ef9350504c
languageName: node
linkType: hard
"@polkadot/api@npm:^1.24.0-beta.1":
version: 1.24.0-beta.1
resolution: "@polkadot/api@npm:1.24.0-beta.1"
"@polkadot/api@npm:^1.24.0-beta.2":
version: 1.24.0-beta.2
resolution: "@polkadot/api@npm:1.24.0-beta.2"
dependencies:
"@babel/runtime": ^7.10.4
"@polkadot/api-derive": 1.24.0-beta.1
"@polkadot/api-derive": 1.24.0-beta.2
"@polkadot/keyring": ^2.18.0-beta.2
"@polkadot/metadata": 1.24.0-beta.1
"@polkadot/rpc-core": 1.24.0-beta.1
"@polkadot/rpc-provider": 1.24.0-beta.1
"@polkadot/types": 1.24.0-beta.1
"@polkadot/types-known": 1.24.0-beta.1
"@polkadot/metadata": 1.24.0-beta.2
"@polkadot/rpc-core": 1.24.0-beta.2
"@polkadot/rpc-provider": 1.24.0-beta.2
"@polkadot/types": 1.24.0-beta.2
"@polkadot/types-known": 1.24.0-beta.2
"@polkadot/util": ^2.18.0-beta.2
"@polkadot/util-crypto": ^2.18.0-beta.2
bn.js: ^5.1.2
eventemitter3: ^4.0.4
rxjs: ^6.6.0
checksum: 3/b6e05580f41a7f740d45bba3046f2c1af91f6a4b2231f3ec92349fa315c7a9dd4066ed231509304ff1ff2761b1197cd2bef5836a061408fbfe4f05d477543081
checksum: 3/a4b95e7b7e49702cdd10749e9ae125ef244c1d366ae8bcdf766904086f3a4df037b478ae6655888cc2893d37612c4cc19f420f49385e76ef031006a14147cdc8
languageName: node
linkType: hard
@ -3038,7 +3038,7 @@ __metadata:
resolution: "@polkadot/app-contracts@workspace:packages/page-contracts"
dependencies:
"@babel/runtime": ^7.10.4
"@polkadot/api-contract": ^1.24.0-beta.1
"@polkadot/api-contract": ^1.24.0-beta.2
languageName: unknown
linkType: soft
@ -3129,6 +3129,15 @@ __metadata:
languageName: unknown
linkType: soft
"@polkadot/app-poll@workspace:packages/page-poll":
version: 0.0.0-use.local
resolution: "@polkadot/app-poll@workspace:packages/page-poll"
dependencies:
"@babel/runtime": ^7.10.4
"@polkadot/react-components": 0.49.0-beta.19
languageName: unknown
linkType: soft
"@polkadot/app-settings@workspace:packages/page-settings":
version: 0.0.0-use.local
resolution: "@polkadot/app-settings@workspace:packages/page-settings"
@ -3391,28 +3400,28 @@ __metadata:
languageName: node
linkType: hard
"@polkadot/keyring@npm:^2.18.0-beta.2":
version: 2.18.0-beta.2
resolution: "@polkadot/keyring@npm:2.18.0-beta.2"
"@polkadot/keyring@npm:^2.18.0-beta.3":
version: 2.18.0-beta.3
resolution: "@polkadot/keyring@npm:2.18.0-beta.3"
dependencies:
"@babel/runtime": ^7.10.4
"@polkadot/util": 2.18.0-beta.2
"@polkadot/util-crypto": 2.18.0-beta.2
checksum: 3/ada1c1e6450f8194e9f02d7161286b31e7b2a0dc98aa20c1360aff3a09c12cb48aba7f4be558e1c67acdb118b62471ba746f2cff1e990f70470a8819b0b0c333
"@polkadot/util": 2.18.0-beta.3
"@polkadot/util-crypto": 2.18.0-beta.3
checksum: 3/25689597caa25dbf19be20f750ed2fe9be4f5e9b5cf526e3dc5ed803845462aeb7c18f7717ba8a973627497ebfa3c6d5e242bc6cfe482a985d359e910dced710
languageName: node
linkType: hard
"@polkadot/metadata@npm:1.24.0-beta.1":
version: 1.24.0-beta.1
resolution: "@polkadot/metadata@npm:1.24.0-beta.1"
"@polkadot/metadata@npm:1.24.0-beta.2":
version: 1.24.0-beta.2
resolution: "@polkadot/metadata@npm:1.24.0-beta.2"
dependencies:
"@babel/runtime": ^7.10.4
"@polkadot/types": 1.24.0-beta.1
"@polkadot/types-known": 1.24.0-beta.1
"@polkadot/types": 1.24.0-beta.2
"@polkadot/types-known": 1.24.0-beta.2
"@polkadot/util": ^2.18.0-beta.2
"@polkadot/util-crypto": ^2.18.0-beta.2
bn.js: ^5.1.2
checksum: 3/36bd10e8dd5ece54e9e1958969f774632e0e994b257024ab7601fe2a0daee442b9b495a6da97b6d4db3d4f3b1878969f4dff5881453e08afc7e2b87059cffef4
checksum: 3/800682442a650cb5e14011c61d3728c86f17894bc728bdcbacb5f68251a3c86a6ab11c0a08244a731466b060f0c5f1e6524cc85e53e528ffb037c57bdada9e7a
languageName: node
linkType: hard
@ -3421,7 +3430,7 @@ __metadata:
resolution: "@polkadot/react-api@workspace:packages/react-api"
dependencies:
"@babel/runtime": ^7.10.4
"@polkadot/api": ^1.24.0-beta.1
"@polkadot/api": ^1.24.0-beta.2
"@polkadot/extension-dapp": ^0.32.0-beta.5
rxjs-compat: ^6.6.0
languageName: unknown
@ -3435,15 +3444,15 @@ __metadata:
"@fortawesome/fontawesome-svg-core": ^1.2.29
"@fortawesome/free-solid-svg-icons": ^5.13.1
"@fortawesome/react-fontawesome": ^0.1.11
"@polkadot/keyring": ^2.18.0-beta.2
"@polkadot/keyring": ^2.18.0-beta.3
"@polkadot/react-api": 0.49.0-beta.19
"@polkadot/react-identicon": ^0.56.0-beta.0
"@polkadot/react-qr": ^0.56.0-beta.0
"@polkadot/react-query": 0.49.0-beta.19
"@polkadot/ui-keyring": ^0.56.0-beta.0
"@polkadot/ui-settings": ^0.56.0-beta.0
"@polkadot/util": ^2.18.0-beta.2
"@polkadot/util-crypto": ^2.18.0-beta.2
"@polkadot/util": ^2.18.0-beta.3
"@polkadot/util-crypto": ^2.18.0-beta.3
"@types/codeflask": ^1.4.1
chart.js: ^2.9.3
codeflask: ^1.4.1
@ -3544,35 +3553,35 @@ __metadata:
languageName: unknown
linkType: soft
"@polkadot/rpc-core@npm:1.24.0-beta.1":
version: 1.24.0-beta.1
resolution: "@polkadot/rpc-core@npm:1.24.0-beta.1"
"@polkadot/rpc-core@npm:1.24.0-beta.2":
version: 1.24.0-beta.2
resolution: "@polkadot/rpc-core@npm:1.24.0-beta.2"
dependencies:
"@babel/runtime": ^7.10.4
"@polkadot/metadata": 1.24.0-beta.1
"@polkadot/rpc-provider": 1.24.0-beta.1
"@polkadot/types": 1.24.0-beta.1
"@polkadot/metadata": 1.24.0-beta.2
"@polkadot/rpc-provider": 1.24.0-beta.2
"@polkadot/types": 1.24.0-beta.2
"@polkadot/util": ^2.18.0-beta.2
memoizee: ^0.4.14
rxjs: ^6.6.0
checksum: 3/f69a2d211eda8a41b95dfb6a3720e2ca66fe0f8bab78ce3509ff8aaa9dc20573ce1fb66d92d916821c7e2dea3a4ee6eb02780bcac2c00db12c8997568d8d8efe
checksum: 3/493b05cd5f48ab2a0bd5e523350934885fac0e62763cd071207f21c6b03d191ab87d2c47464b8f97c9711451fe1fbb04903e3798a549dd481c1776ab0b3ee6be
languageName: node
linkType: hard
"@polkadot/rpc-provider@npm:1.24.0-beta.1":
version: 1.24.0-beta.1
resolution: "@polkadot/rpc-provider@npm:1.24.0-beta.1"
"@polkadot/rpc-provider@npm:1.24.0-beta.2":
version: 1.24.0-beta.2
resolution: "@polkadot/rpc-provider@npm:1.24.0-beta.2"
dependencies:
"@babel/runtime": ^7.10.4
"@polkadot/metadata": 1.24.0-beta.1
"@polkadot/types": 1.24.0-beta.1
"@polkadot/metadata": 1.24.0-beta.2
"@polkadot/types": 1.24.0-beta.2
"@polkadot/util": ^2.18.0-beta.2
"@polkadot/util-crypto": ^2.18.0-beta.2
bn.js: ^5.1.2
eventemitter3: ^4.0.4
isomorphic-fetch: ^2.2.1
websocket: ^1.0.31
checksum: 3/80ae9f48b16bedb0324df98efa5e268d5f9ffa3e38e79eaff7303a685d435d21a296e585b209f9f758f76254592c7131437946594b3648e0e314c3baac48e545
checksum: 3/76f1ea98f0487b221f74d35b2aaaf5cb7189d6530d8d2f920a035cdeee5240c639507ecf2b639b7de20edb6dc7db0842b148494ca8588eeeaa132d4ef772eba7
languageName: node
linkType: hard
@ -3585,31 +3594,31 @@ __metadata:
languageName: node
linkType: hard
"@polkadot/types-known@npm:1.24.0-beta.1":
version: 1.24.0-beta.1
resolution: "@polkadot/types-known@npm:1.24.0-beta.1"
"@polkadot/types-known@npm:1.24.0-beta.2":
version: 1.24.0-beta.2
resolution: "@polkadot/types-known@npm:1.24.0-beta.2"
dependencies:
"@babel/runtime": ^7.10.4
"@polkadot/types": 1.24.0-beta.1
"@polkadot/types": 1.24.0-beta.2
"@polkadot/util": ^2.18.0-beta.2
bn.js: ^5.1.2
checksum: 3/11c9fe352699ffa8b16840e854908b30e17fa67cea26487383525513d73db95e848aeb3d1cd99d43fa95e54668db865a8f647e62757473e797ae5008ad2f34dd
checksum: 3/a10f77ca8056cede400f024dcf2486a1c42b2e36b828dc0a6673c5faecf7201261c626f0c0292a134a0c97edbb49ff8ea1937415316cadad4d464fda838d7bc6
languageName: node
linkType: hard
"@polkadot/types@npm:^1.24.0-beta.1":
version: 1.24.0-beta.1
resolution: "@polkadot/types@npm:1.24.0-beta.1"
"@polkadot/types@npm:^1.24.0-beta.2":
version: 1.24.0-beta.2
resolution: "@polkadot/types@npm:1.24.0-beta.2"
dependencies:
"@babel/runtime": ^7.10.4
"@polkadot/metadata": 1.24.0-beta.1
"@polkadot/metadata": 1.24.0-beta.2
"@polkadot/util": ^2.18.0-beta.2
"@polkadot/util-crypto": ^2.18.0-beta.2
"@types/bn.js": ^4.11.6
bn.js: ^5.1.2
memoizee: ^0.4.14
rxjs: ^6.6.0
checksum: 3/f9463d5b15a22bf1ee49246eeb32b02ce644dab7d167292fcb346b6c8eb549795ed0142691b94fdd8e9ea8adfe9e64b857b999b514c968e74fe908d7a0d81a3c
checksum: 3/c19c900c5cb5fa6e9e2e3b0e0ca8638a3fe37091d286a0487c833ac9bfda9f116b8f28bf7f82af2f3961a5f32b5a0bc420117d97aa30f15355d20ce79120d199
languageName: node
linkType: hard
@ -3661,12 +3670,12 @@ __metadata:
languageName: node
linkType: hard
"@polkadot/util-crypto@npm:^2.18.0-beta.2":
version: 2.18.0-beta.2
resolution: "@polkadot/util-crypto@npm:2.18.0-beta.2"
"@polkadot/util-crypto@npm:^2.18.0-beta.3":
version: 2.18.0-beta.3
resolution: "@polkadot/util-crypto@npm:2.18.0-beta.3"
dependencies:
"@babel/runtime": ^7.10.4
"@polkadot/util": 2.18.0-beta.2
"@polkadot/util": 2.18.0-beta.3
"@polkadot/wasm-crypto": ^1.2.1
base-x: ^3.0.8
bip39: ^3.0.2
@ -3677,13 +3686,13 @@ __metadata:
pbkdf2: ^3.1.1
tweetnacl: ^1.0.3
xxhashjs: ^0.2.2
checksum: 3/6a2109faddea7f15ecf708b1f1748d0e77961ba16f5f55c2d06298d08586a6ad1b13ae852556dba3485b32d46875d2294bb8cad7dc3b1a3639efd45fbd29d25f
checksum: 3/3abdfedc632150b580f602ff3ece5916c9b99c7ad6ebcc2638b4f9c7c33e0edb0bc5e8a9d109efdccbb969226d7a344a341ccb93e528d6aa745c772a7bcb9e04
languageName: node
linkType: hard
"@polkadot/util@npm:^2.18.0-beta.2":
version: 2.18.0-beta.2
resolution: "@polkadot/util@npm:2.18.0-beta.2"
"@polkadot/util@npm:^2.18.0-beta.3":
version: 2.18.0-beta.3
resolution: "@polkadot/util@npm:2.18.0-beta.3"
dependencies:
"@babel/runtime": ^7.10.4
"@types/bn.js": ^4.11.6
@ -3691,7 +3700,7 @@ __metadata:
camelcase: ^5.3.1
chalk: ^4.1.0
ip-regex: ^4.1.0
checksum: 3/d4031af560e87172dcce731231e5b256f286feb94bc1b33114ef427d4a3bab8b013e8f41bdfd89c4e6860ddff38de102bf5337eea2c0ac1aa847bb1540dbe3fc
checksum: 3/40dd86bfee5e46ddb7adf396fa1b4ff27619b02ee692742df308c37b65c19829a71529832e178692152b039c404bfb1a246974a3a49b4eac733d30ca4617f765
languageName: node
linkType: hard