Rollback latest (something went wrong) (#2039)
* Revert "[CI Skip] 0.38.0-beta.64" This reverts commit632c224df4. * Revert "Apply useToggle as appropriate (#2036)" This reverts commit62f74422f2. * Revert "[CI Skip] 0.38.0-beta.63" This reverts commit635f61637c. * Revert "Small updates for V2 democracy (#2038)" This reverts commit32db955f8c. * Revert last bumps
This commit is contained in:
parent
632c224df4
commit
6dab5e1295
@ -10,5 +10,5 @@
|
||||
"packages": [
|
||||
"packages/*"
|
||||
],
|
||||
"version": "0.38.0-beta.64"
|
||||
"version": "0.38.0"
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0-beta.62",
|
||||
"private": true,
|
||||
"engines": {
|
||||
"node": ">=10.13.0",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/app-123code",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"description": "A basic app that shows the ropes on customisation",
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
@ -11,6 +11,6 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.5",
|
||||
"@polkadot/react-components": "^0.38.0-beta.64"
|
||||
"@polkadot/react-components": "^0.38.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/app-accounts",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"main": "index.js",
|
||||
"repository": "https://github.com/polkadot-js/apps.git",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
@ -11,7 +11,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.5",
|
||||
"@polkadot/react-components": "^0.38.0-beta.64",
|
||||
"@polkadot/react-components": "^0.38.0",
|
||||
"@polkadot/react-qr": "^0.48.0-beta.3",
|
||||
"@types/file-saver": "^2.0.0",
|
||||
"@types/yargs": "^13.0.2",
|
||||
|
||||
@ -9,7 +9,7 @@ import React, { useState, useEffect } from 'react';
|
||||
import { Label } from 'semantic-ui-react';
|
||||
import styled from 'styled-components';
|
||||
import { AddressInfo, AddressSmall, Button, ChainLock, Forget, Icon, InputTags, LinkPolkascan, Menu, Popup, Input } from '@polkadot/react-components';
|
||||
import { useApi, useToggle } from '@polkadot/react-hooks';
|
||||
import { useApi } from '@polkadot/react-hooks';
|
||||
import keyring from '@polkadot/ui-keyring';
|
||||
|
||||
import Backup from './modals/Backup';
|
||||
@ -31,16 +31,16 @@ function Account ({ address, allowTags, className, isFavorite, t, toggleFavorite
|
||||
const [tags, setTags] = useState<string[]>([]);
|
||||
const [accName, setAccName] = useState('');
|
||||
const [genesisHash, setGenesisHash] = useState<string | null>(null);
|
||||
const [isVisible, setIsVisible] = useState(true);
|
||||
const [isBackupOpen, setIsBackupOpen] = useState(false);
|
||||
const [isEditingName, setIsEditingName] = useState(false);
|
||||
const [isEditingTags, setIsEditingTags] = useState(false);
|
||||
const [{ isDevelopment, isEditable, isExternal }, setFlags] = useState({ isDevelopment: false, isEditable: false, isExternal: false });
|
||||
const [isBackupOpen, toggleBackup] = useToggle();
|
||||
const [isEditingName, toggleEditName] = useToggle();
|
||||
const [isEditingTags, toggleEditTags] = useToggle();
|
||||
const [isDeriveOpen, toggleDerive] = useToggle();
|
||||
const [isForgetOpen, toggleForget] = useToggle();
|
||||
const [isPasswordOpen, togglePassword] = useToggle();
|
||||
const [isSettingsOpen, toggleSettings] = useToggle();
|
||||
const [isTransferOpen, toggleTransfer] = useToggle();
|
||||
const [isDeriveOpen, setIsDeriveOpen] = useState(false);
|
||||
const [isForgetOpen, setIsForgetOpen] = useState(false);
|
||||
const [isPasswordOpen, setIsPasswordOpen] = useState(false);
|
||||
const [isSettingPopupOpen, setIsSettingPopupOpen] = useState(false);
|
||||
const [isTransferOpen, setIsTransferOpen] = useState(false);
|
||||
const [isVisible, setIsVisible] = useState(true);
|
||||
|
||||
const _setTags = (tags: string[]): void => setTags(tags.sort());
|
||||
|
||||
@ -73,8 +73,16 @@ function Account ({ address, allowTags, className, isFavorite, t, toggleFavorite
|
||||
return null;
|
||||
}
|
||||
|
||||
const _toggleEditName = (): void => setIsEditingName(!isEditingName);
|
||||
const _toggleEditTags = (): void => setIsEditingTags(!isEditingTags);
|
||||
const _toggleBackup = (): void => setIsBackupOpen(!isBackupOpen);
|
||||
const _toggleDerive = (): void => setIsDeriveOpen(!isDeriveOpen);
|
||||
const _toggleForget = (): void => setIsForgetOpen(!isForgetOpen);
|
||||
const _togglePass = (): void => setIsPasswordOpen(!isPasswordOpen);
|
||||
const _toggleSettingPopup = (): void => setIsSettingPopupOpen(!isSettingPopupOpen);
|
||||
const _toggleTransfer = (): void => setIsTransferOpen(!isTransferOpen);
|
||||
const _saveName = (): void => {
|
||||
toggleEditName();
|
||||
_toggleEditName();
|
||||
|
||||
const meta = { name: accName, whenEdited: Date.now() };
|
||||
|
||||
@ -89,7 +97,7 @@ function Account ({ address, allowTags, className, isFavorite, t, toggleFavorite
|
||||
}
|
||||
};
|
||||
const _saveTags = (): void => {
|
||||
toggleEditTags();
|
||||
_toggleEditTags();
|
||||
|
||||
const meta = { tags, whenEdited: Date.now() };
|
||||
|
||||
@ -157,7 +165,7 @@ function Account ({ address, allowTags, className, isFavorite, t, toggleFavorite
|
||||
)
|
||||
: undefined
|
||||
}
|
||||
onClickName={toggleEditName}
|
||||
onClickName={_toggleEditName}
|
||||
toggle={isEditingName}
|
||||
value={address}
|
||||
/>
|
||||
@ -165,14 +173,14 @@ function Account ({ address, allowTags, className, isFavorite, t, toggleFavorite
|
||||
<Backup
|
||||
address={address}
|
||||
key='modal-backup-account'
|
||||
onClose={toggleBackup}
|
||||
onClose={_toggleBackup}
|
||||
/>
|
||||
)}
|
||||
{isDeriveOpen && (
|
||||
<Derive
|
||||
from={address}
|
||||
key='modal-derive-account'
|
||||
onClose={toggleDerive}
|
||||
onClose={_toggleDerive}
|
||||
/>
|
||||
)}
|
||||
{isForgetOpen && (
|
||||
@ -180,20 +188,20 @@ function Account ({ address, allowTags, className, isFavorite, t, toggleFavorite
|
||||
address={address}
|
||||
onForget={_onForget}
|
||||
key='modal-forget-account'
|
||||
onClose={toggleForget}
|
||||
onClose={_toggleForget}
|
||||
/>
|
||||
)}
|
||||
{isPasswordOpen && (
|
||||
<ChangePass
|
||||
address={address}
|
||||
key='modal-change-pass'
|
||||
onClose={togglePassword}
|
||||
onClose={_togglePass}
|
||||
/>
|
||||
)}
|
||||
{isTransferOpen && (
|
||||
<Transfer
|
||||
key='modal-transfer'
|
||||
onClose={toggleTransfer}
|
||||
onClose={_toggleTransfer}
|
||||
senderId={address}
|
||||
/>
|
||||
)}
|
||||
@ -213,7 +221,7 @@ function Account ({ address, allowTags, className, isFavorite, t, toggleFavorite
|
||||
/>
|
||||
)
|
||||
: (
|
||||
<div className='tags--toggle' onClick={toggleEditTags}>
|
||||
<div className='tags--toggle' onClick={_toggleEditTags}>
|
||||
{tags.length
|
||||
? tags.map((tag): React.ReactNode => (
|
||||
<Label key={tag} size='tiny' color='grey'>{tag}</Label>
|
||||
@ -244,19 +252,19 @@ function Account ({ address, allowTags, className, isFavorite, t, toggleFavorite
|
||||
icon='paper plane'
|
||||
isPrimary
|
||||
label={t('send')}
|
||||
onClick={toggleTransfer}
|
||||
onClick={_toggleTransfer}
|
||||
size='small'
|
||||
tooltip={t('Send funds from this account')}
|
||||
/>
|
||||
<Popup
|
||||
className='theme--default'
|
||||
onClose={toggleSettings}
|
||||
open={isSettingsOpen}
|
||||
onClose={_toggleSettingPopup}
|
||||
open={isSettingPopupOpen}
|
||||
position='bottom right'
|
||||
trigger={
|
||||
<Button
|
||||
icon='setting'
|
||||
onClick={toggleSettings}
|
||||
onClick={_toggleSettingPopup}
|
||||
size='small'
|
||||
/>
|
||||
}
|
||||
@ -264,11 +272,11 @@ function Account ({ address, allowTags, className, isFavorite, t, toggleFavorite
|
||||
<Menu
|
||||
vertical
|
||||
text
|
||||
onClick={toggleSettings}
|
||||
onClick={_toggleSettingPopup}
|
||||
>
|
||||
<Menu.Item
|
||||
disabled={!isEditable || isExternal}
|
||||
onClick={toggleDerive}
|
||||
onClick={_toggleDerive}
|
||||
>
|
||||
{t('Derive account from source')}
|
||||
</Menu.Item>
|
||||
@ -277,19 +285,19 @@ function Account ({ address, allowTags, className, isFavorite, t, toggleFavorite
|
||||
</Menu.Item>
|
||||
<Menu.Item
|
||||
disabled={!isEditable || isExternal || isDevelopment}
|
||||
onClick={toggleBackup}
|
||||
onClick={_toggleBackup}
|
||||
>
|
||||
{t('Create a backup file for this account')}
|
||||
</Menu.Item>
|
||||
<Menu.Item
|
||||
disabled={!isEditable || isExternal || isDevelopment}
|
||||
onClick={togglePassword}
|
||||
onClick={_togglePass}
|
||||
>
|
||||
{t("Change this account's password")}
|
||||
</Menu.Item>
|
||||
<Menu.Item
|
||||
disabled={!isEditable || isDevelopment}
|
||||
onClick={toggleForget}
|
||||
onClick={_toggleForget}
|
||||
>
|
||||
{t('Forget this account')}
|
||||
</Menu.Item>
|
||||
|
||||
@ -9,7 +9,7 @@ import React, { useEffect, useState } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import keyring from '@polkadot/ui-keyring';
|
||||
import { getLedger, isLedger } from '@polkadot/react-api';
|
||||
import { useAccounts, useFavorites, useToggle } from '@polkadot/react-hooks';
|
||||
import { useAccounts, useFavorites } from '@polkadot/react-hooks';
|
||||
import { Button, InputTags, Table } from '@polkadot/react-components';
|
||||
|
||||
import CreateModal from './modals/Create';
|
||||
@ -41,9 +41,9 @@ async function queryLedger (): Promise<void> {
|
||||
|
||||
function Overview ({ className, onStatusChange, t }: Props): React.ReactElement<Props> {
|
||||
const { allAccounts, hasAccounts } = useAccounts();
|
||||
const [isCreateOpen, toggleCreate] = useToggle();
|
||||
const [isImportOpen, toggleImport] = useToggle();
|
||||
const [isQrOpen, toggleQr] = useToggle();
|
||||
const [isCreateOpen, setIsCreateOpen] = useState(false);
|
||||
const [isImportOpen, setIsImportOpen] = useState(false);
|
||||
const [isQrOpen, setIsQrOpen] = useState(false);
|
||||
const [favorites, toggleFavorite] = useFavorites(STORE_FAVS);
|
||||
const [sortedAccounts, setSortedAccounts] = useState<SortedAccount[]>([]);
|
||||
const [tags, setTags] = useState<string[]>([]);
|
||||
@ -62,24 +62,28 @@ function Overview ({ className, onStatusChange, t }: Props): React.ReactElement<
|
||||
);
|
||||
}, [allAccounts, favorites]);
|
||||
|
||||
const _toggleCreate = (): void => setIsCreateOpen(!isCreateOpen);
|
||||
const _toggleImport = (): void => setIsImportOpen(!isImportOpen);
|
||||
const _toggleQr = (): void => setIsQrOpen(!isQrOpen);
|
||||
|
||||
return (
|
||||
<div className={className}>
|
||||
<Banner />
|
||||
{isCreateOpen && (
|
||||
<CreateModal
|
||||
onClose={toggleCreate}
|
||||
onClose={_toggleCreate}
|
||||
onStatusChange={onStatusChange}
|
||||
/>
|
||||
)}
|
||||
{isImportOpen && (
|
||||
<ImportModal
|
||||
onClose={toggleImport}
|
||||
onClose={_toggleImport}
|
||||
onStatusChange={onStatusChange}
|
||||
/>
|
||||
)}
|
||||
{isQrOpen && (
|
||||
<QrModal
|
||||
onClose={toggleQr}
|
||||
onClose={_toggleQr}
|
||||
onStatusChange={onStatusChange}
|
||||
/>
|
||||
)}
|
||||
@ -88,21 +92,21 @@ function Overview ({ className, onStatusChange, t }: Props): React.ReactElement<
|
||||
icon='add'
|
||||
isPrimary
|
||||
label={t('Add account')}
|
||||
onClick={toggleCreate}
|
||||
onClick={_toggleCreate}
|
||||
/>
|
||||
<Button.Or />
|
||||
<Button
|
||||
icon='sync'
|
||||
isPrimary
|
||||
label={t('Restore JSON')}
|
||||
onClick={toggleImport}
|
||||
onClick={_toggleImport}
|
||||
/>
|
||||
<Button.Or />
|
||||
<Button
|
||||
icon='qrcode'
|
||||
isPrimary
|
||||
label={t('Add via Qr')}
|
||||
onClick={toggleQr}
|
||||
onClick={_toggleQr}
|
||||
/>
|
||||
{isLedger() && (
|
||||
<>
|
||||
|
||||
@ -13,7 +13,7 @@ import React, { useState } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { DEV_PHRASE } from '@polkadot/keyring/defaults';
|
||||
import { AddressRow, Button, Dropdown, Input, InputAddress, Modal, Password } from '@polkadot/react-components';
|
||||
import { useApi, useToggle } from '@polkadot/react-hooks';
|
||||
import { useApi } from '@polkadot/react-hooks';
|
||||
import keyring from '@polkadot/ui-keyring';
|
||||
import uiSettings from '@polkadot/ui-settings';
|
||||
import { isHex, u8aToHex } from '@polkadot/util';
|
||||
@ -153,9 +153,9 @@ function createAccount (suri: string, pairType: KeypairType, name: string, passw
|
||||
function Create ({ className, onClose, onStatusChange, seed: propsSeed, t, type: propsType }: Props): React.ReactElement<Props> {
|
||||
const { isDevelopment } = useApi();
|
||||
const [{ address, deriveError, derivePath, isSeedValid, pairType, seed, seedType }, setAddress] = useState<AddressState>(generateSeed(propsSeed, '', propsSeed ? 'raw' : 'bip', propsType));
|
||||
const [isConfirmationOpen, setIsConfirmationOpen] = useState(false);
|
||||
const [{ isNameValid, name }, setName] = useState({ isNameValid: false, name: '' });
|
||||
const [{ isPassValid, password }, setPassword] = useState({ isPassValid: false, password: '' });
|
||||
const [isConfirmationOpen, toggleConfirmation] = useToggle();
|
||||
const isValid = !!address && !deriveError && isNameValid && isPassValid && isSeedValid;
|
||||
|
||||
const _onChangePass = (password: string): void =>
|
||||
@ -172,6 +172,7 @@ function Create ({ className, onClose, onStatusChange, seed: propsSeed, t, type:
|
||||
}
|
||||
};
|
||||
const _onChangeName = (name: string): void => setName({ isNameValid: !!name.trim(), name });
|
||||
const _toggleConfirmation = (): void => setIsConfirmationOpen(!isConfirmationOpen);
|
||||
|
||||
const _onCommit = (): void => {
|
||||
if (!isValid) {
|
||||
@ -180,7 +181,7 @@ function Create ({ className, onClose, onStatusChange, seed: propsSeed, t, type:
|
||||
|
||||
const status = createAccount(`${seed}${derivePath}`, pairType, name, password, t('created account'));
|
||||
|
||||
toggleConfirmation();
|
||||
_toggleConfirmation();
|
||||
onStatusChange(status);
|
||||
onClose();
|
||||
};
|
||||
@ -196,7 +197,7 @@ function Create ({ className, onClose, onStatusChange, seed: propsSeed, t, type:
|
||||
address={address}
|
||||
name={name}
|
||||
onCommit={_onCommit}
|
||||
onClose={toggleConfirmation}
|
||||
onClose={_toggleConfirmation}
|
||||
/>
|
||||
)}
|
||||
<Modal.Content>
|
||||
@ -300,7 +301,7 @@ function Create ({ className, onClose, onStatusChange, seed: propsSeed, t, type:
|
||||
isDisabled={!isValid}
|
||||
isPrimary
|
||||
label={t('Save')}
|
||||
onClick={toggleConfirmation}
|
||||
onClick={_toggleConfirmation}
|
||||
/>
|
||||
</Button.Group>
|
||||
</Modal.Actions>
|
||||
|
||||
@ -9,7 +9,7 @@ import { KeypairType } from '@polkadot/util-crypto/types';
|
||||
|
||||
import React, { useContext, useEffect, useState } from 'react';
|
||||
import { AddressRow, Button, Input, InputAddress, Modal, Password, StatusContext } from '@polkadot/react-components';
|
||||
import { useDebounce, useToggle } from '@polkadot/react-hooks';
|
||||
import { useDebounce } from '@polkadot/react-hooks';
|
||||
import keyring from '@polkadot/ui-keyring';
|
||||
import { keyExtractPath } from '@polkadot/util-crypto';
|
||||
|
||||
@ -71,12 +71,12 @@ function Derive ({ className, from, onClose, t }: Props): React.ReactElement {
|
||||
const { queueAction } = useContext(StatusContext);
|
||||
const [source] = useState(keyring.getPair(from));
|
||||
const [{ address, deriveError }, setDerived] = useState<DerivedAddress>({ address: null, deriveError: null });
|
||||
const [isConfirmationOpen, setIsConfirmationOpen] = useState(false);
|
||||
const [isLocked, setIsLocked] = useState(source.isLocked);
|
||||
const [{ isNameValid, name }, setName] = useState({ isNameValid: false, name: '' });
|
||||
const [{ isPassValid, password }, setPassword] = useState({ isPassValid: false, password: '' });
|
||||
const [rootPass, setRootPass] = useState('');
|
||||
const [suri, setSuri] = useState('');
|
||||
const [isConfirmationOpen, toggleConfirmation] = useToggle();
|
||||
const debouncedSuri = useDebounce(suri);
|
||||
const isValid = !!address && !deriveError && isNameValid && isPassValid;
|
||||
|
||||
@ -101,6 +101,7 @@ function Derive ({ className, from, onClose, t }: Props): React.ReactElement {
|
||||
|
||||
const _onChangeName = (name: string): void => setName({ isNameValid: !!name.trim(), name });
|
||||
const _onChangePass = (password: string): void => setPassword({ isPassValid: keyring.isPassValid(password), password });
|
||||
const _toggleConfirmation = (): void => setIsConfirmationOpen(!isConfirmationOpen);
|
||||
const _onUnlock = (): void => {
|
||||
try {
|
||||
source.decodePkcs8(rootPass);
|
||||
@ -118,7 +119,7 @@ function Derive ({ className, from, onClose, t }: Props): React.ReactElement {
|
||||
|
||||
const status = createAccount(source, suri, name, password, t('created account'));
|
||||
|
||||
toggleConfirmation();
|
||||
_toggleConfirmation();
|
||||
queueAction(status);
|
||||
onClose();
|
||||
};
|
||||
@ -143,7 +144,7 @@ function Derive ({ className, from, onClose, t }: Props): React.ReactElement {
|
||||
address={address}
|
||||
name={name}
|
||||
onCommit={_onCommit}
|
||||
onClose={toggleConfirmation}
|
||||
onClose={_toggleConfirmation}
|
||||
/>
|
||||
)}
|
||||
<Modal.Content>
|
||||
@ -220,7 +221,7 @@ function Derive ({ className, from, onClose, t }: Props): React.ReactElement {
|
||||
isDisabled={!isValid}
|
||||
isPrimary
|
||||
label={t('Save')}
|
||||
onClick={toggleConfirmation}
|
||||
onClick={_toggleConfirmation}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/app-address-book",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"main": "index.js",
|
||||
"repository": "https://github.com/polkadot-js/apps.git",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
@ -11,6 +11,6 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.5",
|
||||
"@polkadot/react-components": "^0.38.0-beta.64"
|
||||
"@polkadot/react-components": "^0.38.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ import React, { useEffect, useState } from 'react';
|
||||
import { Label } from 'semantic-ui-react';
|
||||
import styled from 'styled-components';
|
||||
import { AddressSmall, AddressInfo, Button, ChainLock, Icon, InputTags, Input, LinkPolkascan, Forget, Menu, Popup } from '@polkadot/react-components';
|
||||
import { useApi, useToggle } from '@polkadot/react-hooks';
|
||||
import { useApi } from '@polkadot/react-hooks';
|
||||
import keyring from '@polkadot/ui-keyring';
|
||||
|
||||
import Transfer from '@polkadot/app-accounts/modals/Transfer';
|
||||
@ -36,12 +36,12 @@ function Address ({ address, allowTags, className, isFavorite, t, toggleFavorite
|
||||
const [accName, setAccName] = useState('');
|
||||
const [current, setCurrent] = useState<KeyringAddress | null>(null);
|
||||
const [genesisHash, setGenesisHash] = useState<string | null>(null);
|
||||
const [isEditingName, setIsEditingName] = useState(false);
|
||||
const [isEditingTags, setIsEditingTags] = useState(false);
|
||||
const [isForgetOpen, setIsForgetOpen] = useState(false);
|
||||
const [isSettingPopupOpen, setIsSettingPopupOpen] = useState(false);
|
||||
const [isTransferOpen, setIsTransferOpen] = useState(false);
|
||||
const [isVisible, setIsVisible] = useState(true);
|
||||
const [isEditingName, toggleEditName] = useToggle();
|
||||
const [isEditingTags, toggleEditTags] = useToggle();
|
||||
const [isForgetOpen, toggleForget] = useToggle();
|
||||
const [isSettingsOpen, toggleSettings] = useToggle();
|
||||
const [isTransferOpen, toggleTransfer] = useToggle();
|
||||
|
||||
const _setTags = (tags: string[]): void => setTags(tags.sort());
|
||||
|
||||
@ -75,6 +75,11 @@ function Address ({ address, allowTags, className, isFavorite, t, toggleFavorite
|
||||
return null;
|
||||
}
|
||||
|
||||
const _toggleEditName = (): void => setIsEditingName(!isEditingName);
|
||||
const _toggleEditTags = (): void => setIsEditingTags(!isEditingTags);
|
||||
const _toggleForget = (): void => setIsForgetOpen(!isForgetOpen);
|
||||
const _toggleSettingPopup = (): void => setIsSettingPopupOpen(!isSettingPopupOpen);
|
||||
const _toggleTransfer = (): void => setIsTransferOpen(!isTransferOpen);
|
||||
const _onForget = (): void => {
|
||||
if (address) {
|
||||
const status: Partial<ActionStatus> = {
|
||||
@ -103,7 +108,7 @@ function Address ({ address, allowTags, className, isFavorite, t, toggleFavorite
|
||||
};
|
||||
const _onFavorite = (): void => toggleFavorite(address);
|
||||
const _saveName = (): void => {
|
||||
toggleEditName();
|
||||
_toggleEditName();
|
||||
|
||||
const meta = { name: accName, whenEdited: Date.now() };
|
||||
|
||||
@ -118,7 +123,7 @@ function Address ({ address, allowTags, className, isFavorite, t, toggleFavorite
|
||||
}
|
||||
};
|
||||
const _saveTags = (): void => {
|
||||
toggleEditTags();
|
||||
_toggleEditTags();
|
||||
|
||||
const meta = { tags, whenEdited: Date.now() };
|
||||
|
||||
@ -159,7 +164,7 @@ function Address ({ address, allowTags, className, isFavorite, t, toggleFavorite
|
||||
)
|
||||
: undefined
|
||||
}
|
||||
onClickName={toggleEditName}
|
||||
onClickName={_toggleEditName}
|
||||
toggle={isEditingName}
|
||||
value={address}
|
||||
/>
|
||||
@ -171,13 +176,13 @@ function Address ({ address, allowTags, className, isFavorite, t, toggleFavorite
|
||||
onForget={_onForget}
|
||||
key='modal-forget-account'
|
||||
mode='address'
|
||||
onClose={toggleForget}
|
||||
onClose={_toggleForget}
|
||||
/>
|
||||
)}
|
||||
{isTransferOpen && (
|
||||
<Transfer
|
||||
key='modal-transfer'
|
||||
onClose={toggleTransfer}
|
||||
onClose={_toggleTransfer}
|
||||
recipientId={address}
|
||||
/>
|
||||
)}
|
||||
@ -199,7 +204,7 @@ function Address ({ address, allowTags, className, isFavorite, t, toggleFavorite
|
||||
/>
|
||||
)
|
||||
: (
|
||||
<div className='tags--toggle' onClick={toggleEditTags}>
|
||||
<div className='tags--toggle' onClick={_toggleEditTags}>
|
||||
{tags.length
|
||||
? tags.map((tag): React.ReactNode => (
|
||||
<Label key={tag} size='tiny' color='grey'>{tag}</Label>
|
||||
@ -231,19 +236,19 @@ function Address ({ address, allowTags, className, isFavorite, t, toggleFavorite
|
||||
isPrimary
|
||||
key='deposit'
|
||||
label={t('deposit')}
|
||||
onClick={toggleTransfer}
|
||||
onClick={_toggleTransfer}
|
||||
size='small'
|
||||
tooltip={t('Send funds to this address')}
|
||||
/>
|
||||
<Popup
|
||||
className='theme--default'
|
||||
onClose={toggleSettings}
|
||||
open={isSettingsOpen}
|
||||
onClose={_toggleSettingPopup}
|
||||
open={isSettingPopupOpen}
|
||||
position='bottom right'
|
||||
trigger={
|
||||
<Button
|
||||
icon='setting'
|
||||
onClick={toggleSettings}
|
||||
onClick={_toggleSettingPopup}
|
||||
size='small'
|
||||
/>
|
||||
}
|
||||
@ -251,11 +256,11 @@ function Address ({ address, allowTags, className, isFavorite, t, toggleFavorite
|
||||
<Menu
|
||||
vertical
|
||||
text
|
||||
onClick={toggleSettings}
|
||||
onClick={_toggleSettingPopup}
|
||||
>
|
||||
<Menu.Item
|
||||
disabled={!isEditable}
|
||||
onClick={toggleForget}
|
||||
onClick={_toggleForget}
|
||||
>
|
||||
{t('Forget this address')}
|
||||
</Menu.Item>
|
||||
|
||||
@ -8,7 +8,7 @@ import { ComponentProps } from './types';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { Button, InputTags, Table } from '@polkadot/react-components';
|
||||
import { useAddresses, useFavorites, useToggle } from '@polkadot/react-hooks';
|
||||
import { useAddresses, useFavorites } from '@polkadot/react-hooks';
|
||||
|
||||
import CreateModal from './modals/Create';
|
||||
import Address from './Address';
|
||||
@ -23,10 +23,10 @@ const STORE_FAVS = 'accounts:favorites';
|
||||
|
||||
function Overview ({ className, onStatusChange, t }: Props): React.ReactElement<Props> {
|
||||
const { hasAddresses, allAddresses } = useAddresses();
|
||||
const [isCreateOpen, setIsCreateOpen] = useState(false);
|
||||
const [favorites, toggleFavorite] = useFavorites(STORE_FAVS);
|
||||
const [sortedAddresses, setSortedAddresses] = useState<SortedAddress[]>([]);
|
||||
const [tags, setTags] = useState<string[]>([]);
|
||||
const [isCreateOpen, toggleCreate] = useToggle();
|
||||
|
||||
useEffect((): void => {
|
||||
setSortedAddresses(
|
||||
@ -42,6 +42,8 @@ function Overview ({ className, onStatusChange, t }: Props): React.ReactElement<
|
||||
);
|
||||
}, [allAddresses, favorites]);
|
||||
|
||||
const _toggleCreate = (): void => setIsCreateOpen(!isCreateOpen);
|
||||
|
||||
return (
|
||||
<div className={className}>
|
||||
<Button.Group>
|
||||
@ -49,12 +51,12 @@ function Overview ({ className, onStatusChange, t }: Props): React.ReactElement<
|
||||
icon='add'
|
||||
isPrimary
|
||||
label={t('Add contact')}
|
||||
onClick={toggleCreate}
|
||||
onClick={_toggleCreate}
|
||||
/>
|
||||
</Button.Group>
|
||||
{isCreateOpen && (
|
||||
<CreateModal
|
||||
onClose={toggleCreate}
|
||||
onClose={_toggleCreate}
|
||||
onStatusChange={onStatusChange}
|
||||
/>
|
||||
)}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/app-claims",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"description": "An app for claiming Polkadot tokens",
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
@ -12,6 +12,6 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.5",
|
||||
"@polkadot/react-components": "^0.38.0-beta.64"
|
||||
"@polkadot/react-components": "^0.38.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/app-contracts",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"description": "Deployment and management of substrate contracts",
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
@ -12,6 +12,6 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.5",
|
||||
"@polkadot/api-contract": "^0.99.0-beta.16",
|
||||
"@polkadot/react-components": "^0.38.0-beta.64"
|
||||
"@polkadot/react-components": "^0.38.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,7 +13,6 @@ import styled from 'styled-components';
|
||||
import { Button, Dropdown, IconLink, InputAddress, InputBalance, InputNumber, Modal, Toggle, TxButton } from '@polkadot/react-components';
|
||||
import { PromiseContract as ApiContract } from '@polkadot/api-contract';
|
||||
import { withApi, withMulti } from '@polkadot/react-api';
|
||||
import { useToggle } from '@polkadot/react-hooks';
|
||||
import { createValue } from '@polkadot/react-params/values';
|
||||
import { isNull } from '@polkadot/util';
|
||||
|
||||
@ -43,13 +42,14 @@ function Call (props: Props): React.ReactElement<Props> | null {
|
||||
|
||||
const hasRpc = api.rpc.contracts && api.rpc.contracts.call;
|
||||
let callMessage = callContract.getMessage(callMessageIndex);
|
||||
|
||||
const [accountId, setAccountId] = useState<StringOrNull>(null);
|
||||
const [endowment, setEndowment] = useState<BN>(new BN(0));
|
||||
const [gasLimit, setGasLimit] = useState<BN>(new BN(GAS_LIMIT));
|
||||
const [isBusy, setIsBusy] = useState(false);
|
||||
const [outcomes, setOutcomes] = useState<ContractCallOutcome[]>([]);
|
||||
const [params, setParams] = useState<any[]>(callMessage ? callMessage.def.args.map(({ type }): any => createValue({ type })) : []);
|
||||
const [useRpc, setUseRpc] = useState(callMessage && !callMessage.def.mutates);
|
||||
const [isBusy, toggleBusy] = useToggle();
|
||||
|
||||
useEffect((): void => {
|
||||
callMessage = callContract.getMessage(callMessageIndex);
|
||||
@ -76,7 +76,9 @@ function Call (props: Props): React.ReactElement<Props> | null {
|
||||
|
||||
const _onChangeEndowment = (endowment?: BN): void => endowment && setEndowment(endowment);
|
||||
const _onChangeGasLimit = (gasLimit?: BN): void => gasLimit && setGasLimit(gasLimit);
|
||||
|
||||
const _onChangeParams = (params: any[]): void => setParams(params);
|
||||
const _toggleBusy = (): void => setIsBusy(!isBusy);
|
||||
|
||||
const _constructTx = (): any[] => {
|
||||
if (!accountId || !callMessage || !callMessage.fn || !callContract || !callContract.address) {
|
||||
@ -216,9 +218,9 @@ function Call (props: Props): React.ReactElement<Props> | null {
|
||||
isDisabled={!isValid}
|
||||
isPrimary
|
||||
label={t('Call')}
|
||||
onClick={toggleBusy}
|
||||
onFailed={toggleBusy}
|
||||
onSuccess={toggleBusy}
|
||||
onClick={_toggleBusy}
|
||||
onFailed={_toggleBusy}
|
||||
onSuccess={_toggleBusy}
|
||||
params={_constructTx}
|
||||
tx={api.tx.contracts ? 'contracts.call' : 'contract.call'}
|
||||
/>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/app-council",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"description": "Council",
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
@ -11,7 +11,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.5",
|
||||
"@polkadot/react-components": "^0.38.0-beta.64",
|
||||
"@polkadot/react-query": "^0.38.0-beta.64"
|
||||
"@polkadot/react-components": "^0.38.0",
|
||||
"@polkadot/react-query": "^0.38.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/app-dashboard",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"description": "Dashboard for all apps, allowing for an overview and quick navigation",
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
@ -11,7 +11,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.5",
|
||||
"@polkadot/apps-routing": "^0.38.0-beta.64",
|
||||
"@polkadot/react-components": "^0.38.0-beta.64"
|
||||
"@polkadot/apps-routing": "^0.38.0",
|
||||
"@polkadot/react-components": "^0.38.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/app-democracy",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"description": "A referendum & proposal app",
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
@ -11,7 +11,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.5",
|
||||
"@polkadot/react-components": "^0.38.0-beta.64",
|
||||
"@polkadot/react-query": "^0.38.0-beta.64"
|
||||
"@polkadot/react-components": "^0.38.0",
|
||||
"@polkadot/react-query": "^0.38.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,18 +3,23 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { I18nProps as Props } from '@polkadot/react-components/types';
|
||||
import { BlockNumber, Hash, ReferendumIndex } from '@polkadot/types/interfaces';
|
||||
import { Hash, ReferendumIndex } from '@polkadot/types/interfaces';
|
||||
import { ITuple } from '@polkadot/types/types';
|
||||
|
||||
import React from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import { Table } from '@polkadot/react-components';
|
||||
import { useApi, useCall } from '@polkadot/react-hooks';
|
||||
import { Option, StorageKey, Vec } from '@polkadot/types';
|
||||
import { u8aToHex } from '@polkadot/util';
|
||||
|
||||
import translate from '../translate';
|
||||
import DispatchEntry from './DispatchEntry';
|
||||
import DispatchBlock from './DispatchBlock';
|
||||
|
||||
function DispatchQueue ({ className, t }: Props): React.ReactElement<Props> | null {
|
||||
const { api } = useApi();
|
||||
const queued = useCall<[BlockNumber, Hash, ReferendumIndex][]>(api.query.democracy.dispatchQueue, []);
|
||||
const [keyPrefix] = useState(u8aToHex(api.query.democracy.dispatchQueue.creator.iterKey));
|
||||
const queued = useCall<[StorageKey, Option<Vec<Option<ITuple<[Hash, ReferendumIndex]>>>>
|
||||
][]>(api.query.democracy.dispatchQueue.entries as any, []);
|
||||
|
||||
if (!queued?.length) {
|
||||
return null;
|
||||
@ -27,12 +32,12 @@ function DispatchQueue ({ className, t }: Props): React.ReactElement<Props> | nu
|
||||
? (
|
||||
<Table>
|
||||
<Table.Body>
|
||||
{queued.map(([blockNumber, hash, referendumIndex]): React.ReactNode => (
|
||||
<DispatchEntry
|
||||
blockNumber={blockNumber}
|
||||
hash={hash}
|
||||
key={referendumIndex.toString()}
|
||||
referendumIndex={referendumIndex}
|
||||
{queued.map(([storageKey, entries]): React.ReactNode => (
|
||||
<DispatchBlock
|
||||
entries={entries}
|
||||
key={storageKey.toString()}
|
||||
keyPrefix={keyPrefix}
|
||||
storageKey={storageKey}
|
||||
/>
|
||||
))}
|
||||
</Table.Body>
|
||||
|
||||
@ -8,7 +8,7 @@ import { I18nProps } from '@polkadot/react-components/types';
|
||||
import BN from 'bn.js';
|
||||
import React, { useState } from 'react';
|
||||
import { Button, InputAddress, Modal, TxButton } from '@polkadot/react-components';
|
||||
import { useAccounts, useToggle } from '@polkadot/react-hooks';
|
||||
import { useAccounts } from '@polkadot/react-hooks';
|
||||
|
||||
import translate from '../translate';
|
||||
|
||||
@ -20,13 +20,14 @@ interface Props extends I18nProps {
|
||||
function Seconding ({ depositors, proposalId, t }: Props): React.ReactElement<Props> | null {
|
||||
const { hasAccounts } = useAccounts();
|
||||
const [accountId, setAccountId] = useState<string | null>(null);
|
||||
const [isSecondingOpen, toggleSeconding] = useToggle();
|
||||
const [isSecondingOpen, setIsSecondingOpen] = useState(false);
|
||||
|
||||
if (!hasAccounts) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const isDepositor = depositors.some((depositor): boolean => depositor.eq(accountId));
|
||||
const _toggleSeconding = (): void => setIsSecondingOpen(!isSecondingOpen);
|
||||
|
||||
return (
|
||||
<>
|
||||
@ -49,7 +50,7 @@ function Seconding ({ depositors, proposalId, t }: Props): React.ReactElement<Pr
|
||||
<Button.Group>
|
||||
<Button
|
||||
isNegative
|
||||
onClick={toggleSeconding}
|
||||
onClick={_toggleSeconding}
|
||||
label={t('Cancel')}
|
||||
icon='cancel'
|
||||
/>
|
||||
@ -60,7 +61,7 @@ function Seconding ({ depositors, proposalId, t }: Props): React.ReactElement<Pr
|
||||
isPrimary
|
||||
label={t('Second')}
|
||||
icon='sign-in'
|
||||
onStart={toggleSeconding}
|
||||
onStart={_toggleSeconding}
|
||||
params={[proposalId]}
|
||||
tx='democracy.second'
|
||||
/>
|
||||
@ -72,7 +73,7 @@ function Seconding ({ depositors, proposalId, t }: Props): React.ReactElement<Pr
|
||||
isPrimary
|
||||
label={t('Second')}
|
||||
icon='toggle off'
|
||||
onClick={toggleSeconding}
|
||||
onClick={_toggleSeconding}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
@ -1,26 +1,37 @@
|
||||
/* eslint-disable @typescript-eslint/camelcase */
|
||||
// Copyright 2017-2019 @polkadot/app-democracy 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 { I18nProps as Props } from '@polkadot/react-components/types';
|
||||
import { I18nProps } from '@polkadot/react-components/types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import React from 'react';
|
||||
import { SummaryBox, CardSummary } from '@polkadot/react-components';
|
||||
import { useApi, useCall } from '@polkadot/react-hooks';
|
||||
import { withCalls } from '@polkadot/react-api';
|
||||
import { formatNumber } from '@polkadot/util';
|
||||
|
||||
import translate from '../translate';
|
||||
|
||||
const ZERO = new BN(0);
|
||||
interface Props extends I18nProps {
|
||||
chain_bestNumber?: BN;
|
||||
democracy_nextTally?: BN;
|
||||
democracy_publicPropCount?: BN;
|
||||
democracy_referendumCount?: BN;
|
||||
}
|
||||
|
||||
function Summary ({ t }: Props): React.ReactElement<Props> {
|
||||
function Summary (props: Props): React.ReactElement<Props> {
|
||||
const { api } = useApi();
|
||||
const activeProposals = useCall<any[]>(api.derive.democracy.proposals, []);
|
||||
const bestNumber = useCall<BN>(api.derive.chain.bestNumber, []);
|
||||
const nextActive = useCall<BN>(api.query.democracy?.lowestUnbaked || api.query.democracy.nextTally, []);
|
||||
const publicPropCount = useCall<BN>(api.query.democracy.publicPropCount, []);
|
||||
const referendumCount = useCall<BN>(api.query.democracy.referendumCount, []);
|
||||
|
||||
const {
|
||||
chain_bestNumber,
|
||||
democracy_nextTally = new BN(0),
|
||||
democracy_publicPropCount,
|
||||
democracy_referendumCount = new BN(0),
|
||||
t
|
||||
} = props;
|
||||
|
||||
return (
|
||||
<SummaryBox>
|
||||
@ -29,23 +40,23 @@ function Summary ({ t }: Props): React.ReactElement<Props> {
|
||||
{formatNumber(activeProposals?.length)}
|
||||
</CardSummary>
|
||||
<CardSummary label={t('total')}>
|
||||
{formatNumber(publicPropCount)}
|
||||
{formatNumber(democracy_publicPropCount)}
|
||||
</CardSummary>
|
||||
</section>
|
||||
<section>
|
||||
<CardSummary label={t('referenda')}>
|
||||
{formatNumber((referendumCount || ZERO).sub(nextActive || ZERO))}
|
||||
{formatNumber(democracy_referendumCount.sub(democracy_nextTally))}
|
||||
</CardSummary>
|
||||
<CardSummary label={t('total')}>
|
||||
{formatNumber(referendumCount)}
|
||||
{formatNumber(democracy_referendumCount)}
|
||||
</CardSummary>
|
||||
</section>
|
||||
{bestNumber && (
|
||||
{chain_bestNumber && (
|
||||
<section className='ui--media-medium'>
|
||||
<CardSummary
|
||||
label={t('launch period')}
|
||||
progress={{
|
||||
value: bestNumber.mod(api.consts.democracy.launchPeriod).addn(1),
|
||||
value: chain_bestNumber.mod(api.consts.democracy.launchPeriod).addn(1),
|
||||
total: api.consts.democracy.launchPeriod
|
||||
}}
|
||||
/>
|
||||
@ -55,4 +66,11 @@ function Summary ({ t }: Props): React.ReactElement<Props> {
|
||||
);
|
||||
}
|
||||
|
||||
export default translate(Summary);
|
||||
export default translate(
|
||||
withCalls<Props>(
|
||||
'query.democracy.nextTally',
|
||||
'query.democracy.publicPropCount',
|
||||
'query.democracy.referendumCount',
|
||||
'derive.chain.bestNumber'
|
||||
)(Summary)
|
||||
);
|
||||
|
||||
@ -7,7 +7,7 @@ import { I18nProps } from '@polkadot/react-components/types';
|
||||
import BN from 'bn.js';
|
||||
import React, { useState } from 'react';
|
||||
import { Button, Modal, VoteAccount, VoteActions, VoteToggle } from '@polkadot/react-components';
|
||||
import { useAccounts, useToggle } from '@polkadot/react-hooks';
|
||||
import { useAccounts } from '@polkadot/react-hooks';
|
||||
import { isBoolean } from '@polkadot/util';
|
||||
|
||||
import translate from '../translate';
|
||||
@ -19,13 +19,14 @@ interface Props extends I18nProps {
|
||||
function Voting ({ referendumId, t }: Props): React.ReactElement<Props> | null {
|
||||
const { hasAccounts } = useAccounts();
|
||||
const [accountId, setAccountId] = useState<string | null>(null);
|
||||
const [isVotingOpen, setIsVotingOpen] = useState(false);
|
||||
const [voteValue, setVoteValue] = useState(true);
|
||||
const [isVotingOpen, toggleVoting] = useToggle();
|
||||
|
||||
if (!hasAccounts) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const _toggleVoting = (): void => setIsVotingOpen(!isVotingOpen);
|
||||
const _onChangeVote = (vote?: boolean): void => setVoteValue(isBoolean(vote) ? vote : true);
|
||||
|
||||
return (
|
||||
@ -45,7 +46,7 @@ function Voting ({ referendumId, t }: Props): React.ReactElement<Props> | null {
|
||||
</Modal.Content>
|
||||
<VoteActions
|
||||
accountId={accountId}
|
||||
onClick={toggleVoting}
|
||||
onClick={_toggleVoting}
|
||||
params={[referendumId, voteValue]}
|
||||
tx='democracy.vote'
|
||||
/>
|
||||
@ -55,7 +56,7 @@ function Voting ({ referendumId, t }: Props): React.ReactElement<Props> | null {
|
||||
icon='check'
|
||||
isPrimary
|
||||
label={t('Vote')}
|
||||
onClick={toggleVoting}
|
||||
onClick={_toggleVoting}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
@ -4,10 +4,9 @@
|
||||
|
||||
import { I18nProps as Props } from '@polkadot/react-components/types';
|
||||
|
||||
import React from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { Button } from '@polkadot/react-components';
|
||||
import { useToggle } from '@polkadot/react-hooks';
|
||||
|
||||
import translate from '../translate';
|
||||
import DispatchQueue from './DispatchQueue';
|
||||
@ -19,8 +18,11 @@ import PreImage from './PreImage';
|
||||
import Propose from './Propose';
|
||||
|
||||
function Overview ({ className, t }: Props): React.ReactElement {
|
||||
const [isPreimageOpen, togglePreimage] = useToggle();
|
||||
const [isProposeOpen, togglePropose] = useToggle();
|
||||
const [isPreimageOpen, setIsPreimageOpen] = useState(false);
|
||||
const [isProposeOpen, setIsProposeOpen] = useState(false);
|
||||
|
||||
const _togglePreimage = (): void => setIsPreimageOpen(!isPreimageOpen);
|
||||
const _togglePropose = (): void => setIsProposeOpen(!isProposeOpen);
|
||||
|
||||
return (
|
||||
<div className={className}>
|
||||
@ -30,21 +32,21 @@ function Overview ({ className, t }: Props): React.ReactElement {
|
||||
icon='add'
|
||||
isPrimary
|
||||
label={t('Submit preimage')}
|
||||
onClick={togglePreimage}
|
||||
onClick={_togglePreimage}
|
||||
/>
|
||||
<Button.Or />
|
||||
<Button
|
||||
icon='add'
|
||||
isPrimary
|
||||
label={t('Submit proposal')}
|
||||
onClick={togglePropose}
|
||||
onClick={_togglePropose}
|
||||
/>
|
||||
</Button.Group>
|
||||
{isPreimageOpen && (
|
||||
<PreImage onClose={togglePreimage} />
|
||||
<PreImage onClose={_togglePreimage} />
|
||||
)}
|
||||
{isProposeOpen && (
|
||||
<Propose onClose={togglePropose} />
|
||||
<Propose onClose={_togglePropose} />
|
||||
)}
|
||||
<Referendums />
|
||||
<Proposals />
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/app-explorer",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"main": "index.js",
|
||||
"repository": "https://github.com/polkadot-js/apps.git",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
@ -11,6 +11,6 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.5",
|
||||
"@polkadot/react-components": "^0.38.0-beta.64"
|
||||
"@polkadot/react-components": "^0.38.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/app-extrinsics",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"main": "index.js",
|
||||
"repository": "https://github.com/polkadot-js/apps.git",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
@ -11,8 +11,8 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.5",
|
||||
"@polkadot/react-components": "^0.38.0-beta.64",
|
||||
"@polkadot/react-params": "^0.38.0-beta.64",
|
||||
"@polkadot/react-signer": "^0.38.0-beta.64"
|
||||
"@polkadot/react-components": "^0.38.0",
|
||||
"@polkadot/react-params": "^0.38.0",
|
||||
"@polkadot/react-signer": "^0.38.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/app-generic-asset",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"description": "A basic GenericAsset transfer app",
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
@ -11,6 +11,6 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.5",
|
||||
"@polkadot/react-components": "^0.38.0-beta.64"
|
||||
"@polkadot/react-components": "^0.38.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,10 +5,9 @@
|
||||
import { I18nProps } from '@polkadot/react-components/types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import React from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import { Button, CardGrid } from '@polkadot/react-components';
|
||||
import { withMulti, withObservable } from '@polkadot/react-api';
|
||||
import { useToggle } from '@polkadot/react-hooks';
|
||||
|
||||
import assetRegistry, { AssetsSubjectInfo } from './assetsRegistry';
|
||||
import AssetCard from './AssetCard';
|
||||
@ -20,12 +19,13 @@ type Props = I18nProps & {
|
||||
};
|
||||
|
||||
function Assets ({ assets, t }: Props): React.ReactElement<Props> {
|
||||
const [isCreateOpen, toggleCreate] = useToggle();
|
||||
const [isCreateOpen, setIsCreateOpen] = useState(false);
|
||||
const emptyScreen = !isCreateOpen && (!assets || Object.keys(assets).length === 0);
|
||||
|
||||
const _onForget = (id: string): void => assetRegistry.remove(id);
|
||||
const _onRegister = (id: BN, name: string): void => assetRegistry.add(id.toString(), name);
|
||||
const _onSaveName = (id: string, name: string): void => assetRegistry.add(id, name);
|
||||
const _toggleCreate = (): void => setIsCreateOpen(!isCreateOpen);
|
||||
|
||||
return (
|
||||
<CardGrid
|
||||
@ -35,7 +35,7 @@ function Assets ({ assets, t }: Props): React.ReactElement<Props> {
|
||||
isPrimary
|
||||
label={t('Register Asset')}
|
||||
icon='registered'
|
||||
onClick={toggleCreate}
|
||||
onClick={_toggleCreate}
|
||||
/>
|
||||
</Button.Group>
|
||||
}
|
||||
@ -44,7 +44,7 @@ function Assets ({ assets, t }: Props): React.ReactElement<Props> {
|
||||
>
|
||||
{isCreateOpen && (
|
||||
<CreateModal
|
||||
onClose={toggleCreate}
|
||||
onClose={_toggleCreate}
|
||||
onRegister={_onRegister}
|
||||
/>
|
||||
)}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/app-js",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"description": "A simple JavaScript console for playing with the API",
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
@ -11,7 +11,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.5",
|
||||
"@polkadot/react-components": "^0.38.0-beta.64",
|
||||
"@polkadot/react-components": "^0.38.0",
|
||||
"snappyjs": "^0.6.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/app-parachains",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"description": "Parachains",
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
@ -11,7 +11,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.5",
|
||||
"@polkadot/react-components": "^0.38.0-beta.64",
|
||||
"@polkadot/react-query": "^0.38.0-beta.64"
|
||||
"@polkadot/react-components": "^0.38.0",
|
||||
"@polkadot/react-query": "^0.38.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/app-settings",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"description": "Settings management",
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
@ -11,8 +11,8 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.5",
|
||||
"@polkadot/react-components": "^0.38.0-beta.64",
|
||||
"@polkadot/react-query": "^0.38.0-beta.64",
|
||||
"@polkadot/react-components": "^0.38.0",
|
||||
"@polkadot/react-query": "^0.38.0",
|
||||
"query-string": "^6.8.3"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/app-staking",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"description": "A basic staking app",
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
@ -11,8 +11,8 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.5",
|
||||
"@polkadot/app-explorer": "^0.38.0-beta.64",
|
||||
"@polkadot/react-components": "^0.38.0-beta.64",
|
||||
"@polkadot/react-query": "^0.38.0-beta.64"
|
||||
"@polkadot/app-explorer": "^0.38.0",
|
||||
"@polkadot/react-components": "^0.38.0",
|
||||
"@polkadot/react-query": "^0.38.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ import { AccountId, StakingLedger } from '@polkadot/types/interfaces';
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Button, Table } from '@polkadot/react-components';
|
||||
import { useApi, useAccounts, useCall, useToggle } from '@polkadot/react-hooks';
|
||||
import { useCall, useApi, useAccounts } from '@polkadot/react-hooks';
|
||||
import { Option } from '@polkadot/types';
|
||||
|
||||
import Account from './Account';
|
||||
@ -52,14 +52,15 @@ function Actions ({ allStashes, className, isVisible, next, recentlyOnline, stak
|
||||
const { allAccounts } = useAccounts();
|
||||
const queryBonded = useCall<Option<AccountId>[]>(api.query.staking.bonded.multi as any, [allAccounts]);
|
||||
const queryLedger = useCall<Option<StakingLedger>[]>(api.query.staking.ledger.multi as any, [allAccounts]);
|
||||
const [isNewStakeOpen, setIsNewStateOpen] = useState(false);
|
||||
const [foundStashes, setFoundStashes] = useState<[string, boolean][] | null>(null);
|
||||
const [stashTypes, setStashTypes] = useState<Record<string, number>>({});
|
||||
const [isNewStakeOpen, toggleNewStake] = useToggle();
|
||||
|
||||
useEffect((): void => {
|
||||
setFoundStashes(getStashes(allAccounts, stashTypes, queryBonded, queryLedger));
|
||||
}, [allAccounts, queryBonded, queryLedger, stashTypes]);
|
||||
|
||||
const _toggleNewStake = (): void => setIsNewStateOpen(!isNewStakeOpen);
|
||||
const _onUpdateType = (stashId: string, type: 'validator' | 'nominator' | 'started' | 'other'): void =>
|
||||
setStashTypes({
|
||||
...stashTypes,
|
||||
@ -78,11 +79,11 @@ function Actions ({ allStashes, className, isVisible, next, recentlyOnline, stak
|
||||
key='new-stake'
|
||||
label={t('New stake')}
|
||||
icon='add'
|
||||
onClick={toggleNewStake}
|
||||
onClick={_toggleNewStake}
|
||||
/>
|
||||
</Button.Group>
|
||||
{isNewStakeOpen && (
|
||||
<StartStaking onClose={toggleNewStake} />
|
||||
<StartStaking onClose={_toggleNewStake} />
|
||||
)}
|
||||
{foundStashes?.length
|
||||
? (
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/app-storage",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"main": "index.js",
|
||||
"repository": "https://github.com/polkadot-js/apps.git",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
@ -11,7 +11,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.5",
|
||||
"@polkadot/react-components": "^0.38.0-beta.64",
|
||||
"@polkadot/react-params": "^0.38.0-beta.64"
|
||||
"@polkadot/react-components": "^0.38.0",
|
||||
"@polkadot/react-params": "^0.38.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/app-sudo",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"description": "A basic app that shows the ropes on customisation",
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
@ -12,6 +12,6 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.5",
|
||||
"@polkadot/react-components": "^0.38.0-beta.64"
|
||||
"@polkadot/react-components": "^0.38.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/app-tech-comm",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"description": "Council",
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
@ -11,7 +11,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.5",
|
||||
"@polkadot/react-components": "^0.38.0-beta.64",
|
||||
"@polkadot/react-query": "^0.38.0-beta.64"
|
||||
"@polkadot/react-components": "^0.38.0",
|
||||
"@polkadot/react-query": "^0.38.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ import { I18nProps } from '@polkadot/react-components/types';
|
||||
import BN from 'bn.js';
|
||||
import React, { useState } from 'react';
|
||||
import { Button, Modal, VoteAccount, VoteActions, VoteToggle } from '@polkadot/react-components';
|
||||
import { useAccounts, useToggle } from '@polkadot/react-hooks';
|
||||
import { useAccounts } from '@polkadot/react-hooks';
|
||||
import { isBoolean } from '@polkadot/util';
|
||||
|
||||
import translate from '../translate';
|
||||
@ -20,13 +20,14 @@ interface Props extends I18nProps {
|
||||
function Voting ({ hash, proposalId, t }: Props): React.ReactElement<Props> | null {
|
||||
const { hasAccounts } = useAccounts();
|
||||
const [accountId, setAccountId] = useState<string | null>(null);
|
||||
const [isVotingOpen, setIsVotingOpen] = useState(false);
|
||||
const [voteValue, setVoteValue] = useState(true);
|
||||
const [isVotingOpen, toggleVoting] = useToggle();
|
||||
|
||||
if (!hasAccounts) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const _toggleVoting = (): void => setIsVotingOpen(!isVotingOpen);
|
||||
const _onChangeVote = (vote?: boolean): void => setVoteValue(isBoolean(vote) ? vote : true);
|
||||
|
||||
return (
|
||||
@ -46,7 +47,7 @@ function Voting ({ hash, proposalId, t }: Props): React.ReactElement<Props> | nu
|
||||
</Modal.Content>
|
||||
<VoteActions
|
||||
accountId={accountId}
|
||||
onClick={toggleVoting}
|
||||
onClick={_toggleVoting}
|
||||
params={[hash, proposalId, voteValue]}
|
||||
tx='technicalCommittee.vote'
|
||||
/>
|
||||
@ -56,7 +57,7 @@ function Voting ({ hash, proposalId, t }: Props): React.ReactElement<Props> | nu
|
||||
icon='check'
|
||||
isPrimary
|
||||
label={t('Vote')}
|
||||
onClick={toggleVoting}
|
||||
onClick={_toggleVoting}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
@ -6,9 +6,8 @@ import { I18nProps } from '@polkadot/react-components/types';
|
||||
import { Hash } from '@polkadot/types/interfaces';
|
||||
import { ComponentProps } from '../types';
|
||||
|
||||
import React from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import { Button, Table } from '@polkadot/react-components';
|
||||
import { useToggle } from '@polkadot/react-hooks';
|
||||
|
||||
import translate from '../translate';
|
||||
import Proposal from './Proposal';
|
||||
@ -17,14 +16,15 @@ import Propose from './Propose';
|
||||
interface Props extends ComponentProps, I18nProps {}
|
||||
|
||||
function Proposals ({ className, members, proposals, t }: Props): React.ReactElement<Props> {
|
||||
const [isProposeOpen, toggleProposal] = useToggle();
|
||||
const [isProposeOpen, setIsProposeOpen] = useState(false);
|
||||
const _toggleProposal = (): void => setIsProposeOpen(!isProposeOpen);
|
||||
|
||||
return (
|
||||
<div className={className}>
|
||||
{isProposeOpen && (
|
||||
<Propose
|
||||
memberCount={members?.length}
|
||||
onClose={toggleProposal}
|
||||
onClose={_toggleProposal}
|
||||
/>
|
||||
)}
|
||||
<Button.Group>
|
||||
@ -32,7 +32,7 @@ function Proposals ({ className, members, proposals, t }: Props): React.ReactEle
|
||||
isPrimary
|
||||
label={t('Submit proposal')}
|
||||
icon='add'
|
||||
onClick={toggleProposal}
|
||||
onClick={_toggleProposal}
|
||||
/>
|
||||
</Button.Group>
|
||||
{proposals?.length
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/app-toolbox",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"main": "index.js",
|
||||
"repository": "https://github.com/polkadot-js/apps.git",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
@ -11,6 +11,6 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.5",
|
||||
"@polkadot/react-components": "^0.38.0-beta.64"
|
||||
"@polkadot/react-components": "^0.38.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,6 @@ import React, { useEffect, useState } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { web3FromSource } from '@polkadot/extension-dapp';
|
||||
import { Button, Input, InputAddress, Output, Static } from '@polkadot/react-components';
|
||||
import { useToggle } from '@polkadot/react-hooks';
|
||||
import keyring from '@polkadot/ui-keyring';
|
||||
import { hexToU8a, isFunction, isHex, stringToHex, stringToU8a, u8aToHex } from '@polkadot/util';
|
||||
|
||||
@ -38,7 +37,7 @@ function Sign ({ className, t }: Props): React.ReactElement<Props> {
|
||||
const [isLocked, setIsLocked] = useState(false);
|
||||
const [{ isUsable, signer }, setSigner] = useState<{ isUsable: boolean; signer: Signer | null }>({ isUsable: true, signer: null });
|
||||
const [signature, setSignature] = useState('');
|
||||
const [isUnlockVisible, toggleUnlock] = useToggle();
|
||||
const [isUnlockVisible, setIsUnlockVisible] = useState<boolean>(false);
|
||||
|
||||
useEffect((): void => {
|
||||
const isExternal = currentPair?.meta.isExternal || false;
|
||||
@ -46,7 +45,11 @@ function Sign ({ className, t }: Props): React.ReactElement<Props> {
|
||||
const isInjected = currentPair?.meta.isInjected || false;
|
||||
const isUsable = !(isExternal || isHardware || isInjected);
|
||||
|
||||
setAccountState({ isExternal, isHardware, isInjected });
|
||||
setAccountState({
|
||||
isExternal,
|
||||
isHardware,
|
||||
isInjected
|
||||
});
|
||||
setIsLocked(
|
||||
isInjected
|
||||
? false
|
||||
@ -68,6 +71,7 @@ function Sign ({ className, t }: Props): React.ReactElement<Props> {
|
||||
}
|
||||
}, [currentPair]);
|
||||
|
||||
const _toggleUnlock = (): void => setIsUnlockVisible(!isUnlockVisible);
|
||||
const _onChangeAccount = (accountId: string | null): void => setCurrentPair(keyring.getPair(accountId || ''));
|
||||
const _onChangeData = (data: string): void => setData({ data, isHexData: isHex(data) });
|
||||
const _onSign = (): void => {
|
||||
@ -99,7 +103,7 @@ function Sign ({ className, t }: Props): React.ReactElement<Props> {
|
||||
};
|
||||
const _onUnlock = (): void => {
|
||||
setIsLocked(false);
|
||||
toggleUnlock();
|
||||
_toggleUnlock();
|
||||
};
|
||||
|
||||
return (
|
||||
@ -159,7 +163,7 @@ function Sign ({ className, t }: Props): React.ReactElement<Props> {
|
||||
<Button.Group>
|
||||
<Button
|
||||
isPrimary
|
||||
onClick={toggleUnlock}
|
||||
onClick={_toggleUnlock}
|
||||
label={t('Unlock account')}
|
||||
icon='unlock'
|
||||
/>
|
||||
@ -182,7 +186,7 @@ function Sign ({ className, t }: Props): React.ReactElement<Props> {
|
||||
</div>
|
||||
{isUnlockVisible && (
|
||||
<Unlock
|
||||
onClose={toggleUnlock}
|
||||
onClose={_toggleUnlock}
|
||||
onUnlock={_onUnlock}
|
||||
pair={currentPair}
|
||||
/>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/app-transfer",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"description": "A basic transfer app",
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
@ -11,7 +11,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.5",
|
||||
"@polkadot/react-components": "^0.38.0-beta.64",
|
||||
"@polkadot/react-query": "^0.38.0-beta.64"
|
||||
"@polkadot/react-components": "^0.38.0",
|
||||
"@polkadot/react-query": "^0.38.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/app-treasury",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"description": "A referendum & proposal app",
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
@ -12,7 +12,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.5",
|
||||
"@polkadot/react-components": "^0.38.0-beta.64",
|
||||
"@polkadot/react-query": "^0.38.0-beta.64"
|
||||
"@polkadot/react-components": "^0.38.0",
|
||||
"@polkadot/react-query": "^0.38.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ import { I18nProps as Props } from '@polkadot/react-components/types';
|
||||
import BN from 'bn.js';
|
||||
import React, { useState } from 'react';
|
||||
import { Button, InputAddress, InputBalance, Modal, TxButton } from '@polkadot/react-components';
|
||||
import { useAccounts, useToggle } from '@polkadot/react-hooks';
|
||||
import { useAccounts } from '@polkadot/react-hooks';
|
||||
|
||||
import translate from '../translate';
|
||||
|
||||
@ -15,13 +15,15 @@ function Propose ({ className, t }: Props): React.ReactElement<Props> | null {
|
||||
const { hasAccounts } = useAccounts();
|
||||
const [accountId, setAccountId] = useState<string | null>(null);
|
||||
const [beneficiary, setBeneficiary] = useState<string | null>(null);
|
||||
const [isProposeOpen, setIsProposeOpen] = useState(false);
|
||||
const [value, setValue] = useState<BN | undefined>();
|
||||
const [isProposeOpen, togglePropose] = useToggle();
|
||||
|
||||
if (!hasAccounts) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const _togglePropose = (): void => setIsProposeOpen(!isProposeOpen);
|
||||
|
||||
const hasValue = value?.gtn(0);
|
||||
|
||||
return (
|
||||
@ -62,7 +64,7 @@ function Propose ({ className, t }: Props): React.ReactElement<Props> | null {
|
||||
icon='cancel'
|
||||
isNegative
|
||||
label={t('Cancel')}
|
||||
onClick={togglePropose}
|
||||
onClick={_togglePropose}
|
||||
/>
|
||||
<Button.Or />
|
||||
<TxButton
|
||||
@ -71,7 +73,7 @@ function Propose ({ className, t }: Props): React.ReactElement<Props> | null {
|
||||
isDisabled={!accountId || !hasValue}
|
||||
isPrimary
|
||||
label={t('Submit proposal')}
|
||||
onClick={togglePropose}
|
||||
onClick={_togglePropose}
|
||||
params={[value, beneficiary]}
|
||||
tx='treasury.proposeSpend'
|
||||
/>
|
||||
@ -83,7 +85,7 @@ function Propose ({ className, t }: Props): React.ReactElement<Props> | null {
|
||||
icon='check'
|
||||
isPrimary
|
||||
label={t('Submit proposal')}
|
||||
onClick={togglePropose}
|
||||
onClick={_togglePropose}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
@ -8,7 +8,7 @@ import { I18nProps } from '@polkadot/react-components/types';
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Button, Dropdown, Input, Modal, VoteAccount, VoteActions, VoteToggle } from '@polkadot/react-components';
|
||||
import { useAccounts, useToggle } from '@polkadot/react-hooks';
|
||||
import { useAccounts } from '@polkadot/react-hooks';
|
||||
import { isBoolean } from '@polkadot/util';
|
||||
|
||||
import translate from '../translate';
|
||||
@ -28,8 +28,8 @@ function Voting ({ proposals, t }: Props): React.ReactElement<Props> | null {
|
||||
const [councilOptId, setCouncilOptId] = useState<number>(0);
|
||||
const [accountId, setAccountId] = useState<string | null>(null);
|
||||
const [{ councilId, councilHash }, setCouncilInfo] = useState<{ councilId: ProposalIndex | null; councilHash: Hash | null }>({ councilId: null, councilHash: null });
|
||||
const [isVotingOpen, setIsVotingOpen] = useState(false);
|
||||
const [voteValue, setVoteValue] = useState(true);
|
||||
const [isVotingOpen, toggleVoting] = useToggle();
|
||||
|
||||
useEffect((): void => {
|
||||
const available = proposals
|
||||
@ -47,6 +47,7 @@ function Voting ({ proposals, t }: Props): React.ReactElement<Props> | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
const _toggleVoting = (): void => setIsVotingOpen(!isVotingOpen);
|
||||
const _onChangeVote = (vote?: boolean): void => setVoteValue(isBoolean(vote) ? vote : true);
|
||||
const _onChangeProposal = (optionId: number): void => {
|
||||
const councilProp = proposals.find(({ votes }): boolean => !!(votes?.index.eq(optionId)));
|
||||
@ -90,7 +91,7 @@ function Voting ({ proposals, t }: Props): React.ReactElement<Props> | null {
|
||||
<VoteActions
|
||||
accountId={accountId}
|
||||
isDisabled={!councilHash}
|
||||
onClick={toggleVoting}
|
||||
onClick={_toggleVoting}
|
||||
params={[councilHash, councilId, voteValue]}
|
||||
tx='council.vote'
|
||||
/>
|
||||
@ -100,7 +101,7 @@ function Voting ({ proposals, t }: Props): React.ReactElement<Props> | null {
|
||||
icon='check'
|
||||
isPrimary
|
||||
label={t('Vote')}
|
||||
onClick={toggleVoting}
|
||||
onClick={_toggleVoting}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/apps-routing",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"main": "index.js",
|
||||
"repository": "https://github.com/polkadot-js/apps.git",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/apps",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"description": "An Apps portal into the Polkadot network",
|
||||
"main": "index.js",
|
||||
"homepage": ".",
|
||||
@ -14,8 +14,8 @@
|
||||
"dependencies": {
|
||||
"@babel/polyfill": "^7.7.0",
|
||||
"@babel/runtime": "^7.7.5",
|
||||
"@polkadot/react-components": "^0.38.0-beta.64",
|
||||
"@polkadot/react-signer": "^0.38.0-beta.64",
|
||||
"@polkadot/react-components": "^0.38.0",
|
||||
"@polkadot/react-signer": "^0.38.0",
|
||||
"@polkadot/ui-assets": "^0.48.0-beta.3",
|
||||
"query-string": "^6.8.3"
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/react-api",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"description": "A collection of RxJs React components the Polkadot JS API",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/react-components",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"main": "index.js",
|
||||
"repository": "https://github.com/polkadot-js/apps.git",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
@ -12,9 +12,9 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.5",
|
||||
"@polkadot/keyring": "^1.7.1",
|
||||
"@polkadot/react-api": "^0.38.0-beta.64",
|
||||
"@polkadot/react-api": "^0.38.0",
|
||||
"@polkadot/react-identicon": "^0.48.0-beta.3",
|
||||
"@polkadot/react-query": "^0.38.0-beta.64",
|
||||
"@polkadot/react-query": "^0.38.0",
|
||||
"@polkadot/ui-keyring": "^0.48.0-beta.3",
|
||||
"@polkadot/ui-settings": "^0.48.0-beta.3",
|
||||
"@types/chart.js": "^2.8.10",
|
||||
|
||||
@ -4,10 +4,9 @@
|
||||
|
||||
import { BareProps } from './types';
|
||||
|
||||
import React from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import ReactMd from 'react-markdown';
|
||||
import styled from 'styled-components';
|
||||
import { useToggle } from '@polkadot/react-hooks';
|
||||
|
||||
import Icon from './Icon';
|
||||
|
||||
@ -16,21 +15,23 @@ interface Props extends BareProps {
|
||||
}
|
||||
|
||||
function HelpOverlay ({ className, md }: Props): React.ReactElement<Props> {
|
||||
const [isVisible, toggleVisible] = useToggle();
|
||||
const [isVisible, setIsVisible] = useState(false);
|
||||
|
||||
const _toggleVisible = (): void => setIsVisible(!isVisible);
|
||||
|
||||
return (
|
||||
<div className={className}>
|
||||
<div className='help-button'>
|
||||
<Icon
|
||||
name='help circle'
|
||||
onClick={toggleVisible}
|
||||
onClick={_toggleVisible}
|
||||
/>
|
||||
</div>
|
||||
<div className={`help-slideout ${isVisible ? 'open' : 'closed'}`}>
|
||||
<div className='help-button'>
|
||||
<Icon
|
||||
name='close'
|
||||
onClick={toggleVisible}
|
||||
onClick={_toggleVisible}
|
||||
/>
|
||||
</div>
|
||||
<ReactMd
|
||||
|
||||
@ -2,10 +2,9 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import React from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import styled from 'styled-components';
|
||||
import { useToggle } from '@polkadot/react-hooks';
|
||||
|
||||
import Icon from './Icon';
|
||||
import { classes } from './util';
|
||||
@ -24,7 +23,7 @@ export interface InsetProps {
|
||||
|
||||
function Inset ({ children, className, header, href, isCollapsible, isError, isSuccess, withBottomMargin, withTopMargin }: InsetProps): React.ReactElement<InsetProps> | null {
|
||||
const history = useHistory();
|
||||
const [isCollapsed, toggleCollapsed] = useToggle();
|
||||
const [isCollapsed, setIsCollapsed] = useState(true);
|
||||
|
||||
if (!children) {
|
||||
return null;
|
||||
@ -33,6 +32,7 @@ function Inset ({ children, className, header, href, isCollapsible, isError, isS
|
||||
const _onClick = (): void => {
|
||||
href && history.push(href);
|
||||
};
|
||||
const _toggleCollapsed = (): void => setIsCollapsed(!isCollapsed);
|
||||
|
||||
return (
|
||||
<div
|
||||
@ -52,7 +52,7 @@ function Inset ({ children, className, header, href, isCollapsible, isError, isS
|
||||
{isCollapsible && (
|
||||
<div
|
||||
className='header'
|
||||
onClick={toggleCollapsed}
|
||||
onClick={_toggleCollapsed}
|
||||
>
|
||||
<h3>{header}</h3>
|
||||
<Icon
|
||||
|
||||
@ -4,9 +4,8 @@
|
||||
|
||||
import { BareProps } from './types';
|
||||
|
||||
import React from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { useToggle } from '@polkadot/react-hooks';
|
||||
|
||||
import Icon from './Icon';
|
||||
import { classes } from './util';
|
||||
@ -17,7 +16,9 @@ interface Props extends BareProps {
|
||||
}
|
||||
|
||||
function LabelHelp ({ className, help, style }: Props): React.ReactElement<Props> {
|
||||
const [isTooltipOpen, toggleTooltip] = useToggle();
|
||||
const [isTooltipOpen, setIsTooltipOpen] = useState(false);
|
||||
|
||||
const _toggleTooltip = (): void => setIsTooltipOpen(!isTooltipOpen);
|
||||
|
||||
return (
|
||||
<div
|
||||
@ -28,8 +29,8 @@ function LabelHelp ({ className, help, style }: Props): React.ReactElement<Props
|
||||
name='help circle'
|
||||
data-tip
|
||||
data-for='controlled-trigger'
|
||||
onMouseOver={toggleTooltip}
|
||||
onMouseOut={toggleTooltip}
|
||||
onMouseOver={_toggleTooltip}
|
||||
onMouseOut={_toggleTooltip}
|
||||
/>
|
||||
{isTooltipOpen && (
|
||||
<Tooltip
|
||||
|
||||
@ -4,8 +4,7 @@
|
||||
|
||||
import { BareProps } from './types';
|
||||
|
||||
import React from 'react';
|
||||
import { useToggle } from '@polkadot/react-hooks';
|
||||
import React, { useState } from 'react';
|
||||
import { MAX_PASS_LEN } from '@polkadot/ui-keyring/defaults';
|
||||
|
||||
import { classes } from './util';
|
||||
@ -30,7 +29,9 @@ interface Props extends BareProps {
|
||||
}
|
||||
|
||||
export default function Password ({ autoFocus, children, className, defaultValue, help, isDisabled, isError, label, name, onChange, onEnter, onEscape, style, tabIndex, value, withLabel }: Props): React.ReactElement<Props> {
|
||||
const [isVisible, toggleVisible] = useToggle();
|
||||
const [isVisible, setIsVisible] = useState(false);
|
||||
|
||||
const _toggleVisible = (): void => setIsVisible(!isVisible);
|
||||
|
||||
return (
|
||||
<Input
|
||||
@ -64,7 +65,7 @@ export default function Password ({ autoFocus, children, className, defaultValue
|
||||
: 'unhide'
|
||||
}
|
||||
isPrimary
|
||||
onClick={toggleVisible}
|
||||
onClick={_toggleVisible}
|
||||
/>
|
||||
{children}
|
||||
</Input>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/react-hooks",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"description": "A collection of React hooks the Polkadot JS Apps UI",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/react-params",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"main": "index.js",
|
||||
"repository": "https://github.com/polkadot-js/apps.git",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
@ -11,6 +11,6 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.5",
|
||||
"@polkadot/react-components": "^0.38.0-beta.64"
|
||||
"@polkadot/react-components": "^0.38.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,17 +4,17 @@
|
||||
|
||||
import { Props } from '../types';
|
||||
|
||||
import React from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import { Compact } from '@polkadot/types';
|
||||
import { Button } from '@polkadot/react-components';
|
||||
import { useToggle } from '@polkadot/react-hooks';
|
||||
|
||||
import BaseBytes from './BaseBytes';
|
||||
import File from './File';
|
||||
|
||||
export default function Bytes ({ className, defaultValue, isDisabled, isError, label, name, onChange, onEnter, onEscape, style, type, withLabel }: Props): React.ReactElement<Props> {
|
||||
const [isFileDrop, toggleFile] = useToggle();
|
||||
const [isFileDrop, setIsFileDrop] = useState(false);
|
||||
|
||||
const _toggleFile = (): void => setIsFileDrop(true);
|
||||
const _onChangeFile = (value: Uint8Array): void => {
|
||||
onChange && onChange({
|
||||
isValid: value.length !== 0,
|
||||
@ -54,7 +54,7 @@ export default function Bytes ({ className, defaultValue, isDisabled, isError, l
|
||||
{!isDisabled && (
|
||||
<Button
|
||||
icon='file'
|
||||
onClick={toggleFile}
|
||||
onClick={_toggleFile}
|
||||
/>
|
||||
)}
|
||||
</BaseBytes>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/react-query",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"description": "A collection of RxJs React components the Polkadot JS API",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/react-signer",
|
||||
"version": "0.38.0-beta.64",
|
||||
"version": "0.38.0",
|
||||
"main": "index.js",
|
||||
"repository": "https://github.com/polkadot-js/apps.git",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
@ -11,7 +11,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.5",
|
||||
"@polkadot/react-components": "^0.38.0-beta.64",
|
||||
"@polkadot/react-components": "^0.38.0",
|
||||
"@polkadot/react-qr": "^0.48.0-beta.3"
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user