Adjust modal header (a change is as good as a holiday) (#2660)

* Adjust modal header (a change is as good as a holiday)

* Linting (memoizee types)
This commit is contained in:
Jaco Greeff 2020-04-30 11:50:48 +02:00 committed by GitHub
parent fca674981d
commit 30fac8c052
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 1037 additions and 1020 deletions

View File

@ -8,12 +8,12 @@
"packages/*"
],
"resolutions": {
"@polkadot/api": "^1.12.0-beta.13",
"@polkadot/api-contract": "^1.12.0-beta.13",
"@polkadot/keyring": "^2.9.0-beta.3",
"@polkadot/types": "^1.12.0-beta.13",
"@polkadot/util": "^2.9.0-beta.3",
"@polkadot/util-crypto": "^2.9.0-beta.3",
"@polkadot/api": "^1.13.0-beta.2",
"@polkadot/api-contract": "^1.13.0-beta.2",
"@polkadot/keyring": "^2.10.0-beta.1",
"@polkadot/types": "^1.13.0-beta.2",
"@polkadot/util": "^2.10.0-beta.1",
"@polkadot/util-crypto": "^2.10.0-beta.1",
"babel-core": "^7.0.0-bridge.0",
"typescript": "^3.8.3"
},
@ -35,20 +35,20 @@
"start": "yarn clean && cd packages/apps && webpack --config webpack.config.js"
},
"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/core": "^7.9.6",
"@babel/register": "^7.9.0",
"@babel/runtime": "^7.9.2",
"@polkadot/dev": "^0.52.11",
"@polkadot/ts": "^0.3.18",
"@babel/runtime": "^7.9.6",
"@polkadot/dev": "^0.52.12",
"@polkadot/ts": "^0.3.19",
"@types/bn.js": "^4.11.6",
"@types/chart.js": "^2.9.19",
"@types/chart.js": "^2.9.20",
"@types/file-saver": "^2.0.1",
"@types/i18next": "^13.0.0",
"@types/jest": "^25.2.1",
"@types/react-beautiful-dnd": "^12.1.2",
"@types/react-copy-to-clipboard": "^4.3.0",
"@types/react-dom": "^16.9.6",
"@types/react-router-dom": "^5.1.4",
"@types/react-dom": "^16.9.7",
"@types/react-router-dom": "^5.1.5",
"@types/react-tooltip": "^3.11.0",
"@types/store": "^2.0.2",
"@types/styled-components": "^5.1.0",
@ -56,10 +56,10 @@
"i18next-scanner": "^2.11.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"stylelint": "^13.3.2",
"stylelint": "^13.3.3",
"stylelint-config-recommended": "^3.0.0",
"stylelint-config-styled-components": "^0.1.1",
"webpack": "^4.42.1",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",
"webpack-plugin-serve": "^0.12.1"
}

View File

@ -11,7 +11,7 @@
"contributors": [],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.9.6",
"edgeware-node-types": "^2.0.1"
}
}

View File

@ -11,6 +11,6 @@
"contributors": [],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2"
"@babel/runtime": "^7.9.6"
}
}

View File

@ -14,8 +14,8 @@
"license": "Apache-2.0",
"dependencies": {
"@babel/polyfill": "^7.8.7",
"@babel/runtime": "^7.9.2",
"@polkadot/dev": "^0.52.11",
"@babel/runtime": "^7.9.6",
"@polkadot/dev": "^0.52.12",
"@polkadot/react-components": "0.42.0-beta.60",
"@polkadot/react-signer": "0.42.0-beta.60",
"query-string": "^6.12.1"
@ -23,15 +23,15 @@
"devDependencies": {
"babel-loader": "^8.1.0",
"copy-webpack-plugin": "^5.1.1",
"css-loader": "^3.5.2",
"css-loader": "^3.5.3",
"empty": "^0.10.1",
"file-loader": "^6.0.0",
"html-loader": "^1.1.0",
"html-webpack-plugin": "^4.2.0",
"html-webpack-plugin": "^4.2.1",
"markdown-loader": "^5.1.0",
"mini-css-extract-plugin": "^0.9.0",
"source-map-explorer": "^2.4.2",
"style-loader": "^1.1.4",
"style-loader": "^1.2.1",
"thread-loader": "^2.1.3",
"url-loader": "^4.1.0"
}

View File

@ -11,7 +11,7 @@
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.9.6",
"@polkadot/react-components": "0.42.0-beta.60"
}
}

View File

@ -11,7 +11,7 @@
"contributors": [],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.9.6",
"@polkadot/react-components": "0.42.0-beta.60",
"@polkadot/react-qr": "^0.53.0-beta.1",
"@polkadot/vanitygen": "^0.11.1",

View File

@ -12,7 +12,7 @@
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.9.6",
"@polkadot/react-components": "0.42.0-beta.60",
"secp256k1": "^3.8.0"
}

View File

@ -11,7 +11,7 @@
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@polkadot/api-contract": "^1.12.0-beta.13"
"@babel/runtime": "^7.9.6",
"@polkadot/api-contract": "^1.13.0-beta.2"
}
}

View File

@ -11,7 +11,7 @@
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.9.6",
"@polkadot/react-components": "0.42.0-beta.60",
"@polkadot/react-query": "0.42.0-beta.60"
}

View File

@ -11,7 +11,7 @@
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.9.6",
"@polkadot/apps-routing": "0.42.0-beta.60",
"@polkadot/react-components": "0.42.0-beta.60"
}

View File

@ -11,7 +11,7 @@
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.9.6",
"@polkadot/react-components": "0.42.0-beta.60",
"@polkadot/react-query": "0.42.0-beta.60"
}

View File

@ -11,7 +11,7 @@
"contributors": [],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.9.6",
"@polkadot/react-components": "0.42.0-beta.60"
}
}

View File

@ -11,7 +11,7 @@
"contributors": [],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.9.6",
"@polkadot/react-components": "0.42.0-beta.60",
"@polkadot/react-params": "0.42.0-beta.60",
"@polkadot/react-signer": "0.42.0-beta.60"

View File

@ -11,7 +11,7 @@
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.9.6",
"@polkadot/react-components": "0.42.0-beta.60"
}
}

View File

@ -11,7 +11,7 @@
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.9.6",
"@polkadot/react-components": "0.42.0-beta.60"
}
}

View File

@ -11,7 +11,7 @@
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.9.6",
"@polkadot/react-components": "0.42.0-beta.60"
}
}

View File

@ -11,7 +11,7 @@
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.9.6",
"@polkadot/react-components": "0.42.0-beta.60",
"@polkadot/react-query": "0.42.0-beta.60"
}

View File

@ -11,7 +11,7 @@
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.9.6",
"@polkadot/apps-config": "0.42.0-beta.60",
"@polkadot/react-components": "0.42.0-beta.60",
"@polkadot/react-query": "0.42.0-beta.60",

View File

@ -8,7 +8,7 @@
"author": "Jaco Greeff <jacogr@gmail.com>",
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.9.6",
"@polkadot/react-components": "0.42.0-beta.60"
}
}

View File

@ -11,7 +11,7 @@
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.9.6",
"@polkadot/app-explorer": "0.42.0-beta.60",
"@polkadot/react-components": "0.42.0-beta.60",
"@polkadot/react-query": "0.42.0-beta.60"

View File

@ -10,11 +10,12 @@ import { useTranslation } from '../../translate';
interface Props {
controllerId: string;
onClose: () => void;
stashId: string;
}
const EMPTY_PROOF = new Uint8Array();
function SetSessionKey ({ controllerId, onClose }: Props): React.ReactElement<Props> | null {
function SetSessionKey ({ controllerId, onClose, stashId }: Props): React.ReactElement<Props> | null {
const { t } = useTranslation();
const [keys, setKeys] = useState<string | null>(null);
@ -22,23 +23,41 @@ function SetSessionKey ({ controllerId, onClose }: Props): React.ReactElement<Pr
<Modal
className='staking--SetSessionAccount'
header={t('Set Session Key')}
size='small'
size='large'
>
<Modal.Content className='ui--signer-Signer-Content'>
<InputAddress
className='medium'
defaultValue={controllerId}
isDisabled
label={t('controller account')}
/>
<Input
autoFocus
className='medium'
help={t('Changing the key only takes effect at the start of the next session. The input here is generates from the author_rotateKeys command')}
isError={!keys}
label={t('Keys from rotateKeys')}
onChange={setKeys}
/>
<Modal.Columns>
<Modal.Column>
<InputAddress
defaultValue={stashId}
isDisabled
label={t('stash account')}
/>
<InputAddress
className='medium'
defaultValue={controllerId}
isDisabled
label={t('controller account')}
/>
</Modal.Column>
<Modal.Column>
<p>{t('The stash and controller pair. This transaction, setting the session keys, will be sent from the controller.')}</p>
</Modal.Column>
</Modal.Columns>
<Modal.Columns>
<Modal.Column>
<Input
autoFocus
help={t('Changing the key only takes effect at the start of the next session. The input here is generates from the author_rotateKeys command')}
isError={!keys}
label={t('Keys from rotateKeys')}
onChange={setKeys}
/>
</Modal.Column>
<Modal.Column>
<p>{t('The hex output from author_rotateKeys, as executed on the validator node. The keys will show as pending until applied at the start of a new session.')}</p>
</Modal.Column>
</Modal.Columns>
</Modal.Content>
<Modal.Actions onCancel={onClose}>
<TxButton

View File

@ -31,29 +31,40 @@ function Validate ({ controllerId, onClose, stashId }: Props): React.ReactElemen
<Modal
className='staking--Staking'
header={t('Set validator preferences')}
size='small'
size='large'
>
<Modal.Content className='ui--signer-Signer-Content'>
<InputAddress
className='medium'
defaultValue={stashId}
isDisabled
label={t('stash account')}
/>
<InputAddress
className='medium'
defaultValue={controllerId}
isDisabled
label={t('controller account')}
/>
<InputNumber
className='medium'
help={t('The percentage reward (0-100) that should be applied for the validator')}
isZeroable
label={t('reward commission percentage')}
maxValue={MAX_COMM}
onChange={_setCommission}
/>
<Modal.Columns>
<Modal.Column>
<InputAddress
defaultValue={stashId}
isDisabled
label={t('stash account')}
/>
<InputAddress
defaultValue={controllerId}
isDisabled
label={t('controller account')}
/>
</Modal.Column>
<Modal.Column>
<p>{t('The stash and controller pair. This transaction, managing preferences, will be sent from the controller.')}</p>
</Modal.Column>
</Modal.Columns>
<Modal.Columns>
<Modal.Column>
<InputNumber
help={t('The percentage reward (0-100) that should be applied for the validator')}
isZeroable
label={t('reward commission percentage')}
maxValue={MAX_COMM}
onChange={_setCommission}
/>
</Modal.Column>
<Modal.Column>
<p>{t('The commission is deducted from all rewards before the remainder is split with nominators.')}</p>
</Modal.Column>
</Modal.Columns>
</Modal.Content>
<Modal.Actions onCancel={onClose}>
<TxButton

View File

@ -92,6 +92,7 @@ function Account ({ className, info: { controllerId, destination, destinationId,
<SetSessionKey
controllerId={controllerId}
onClose={toggleSetSession}
stashId={stashId}
/>
)}
{isUnbondOpen && (

View File

@ -59,36 +59,53 @@ function PayButton ({ isAll, isDisabled, payout }: Props): React.ReactElement<Pr
return (
<>
{payout && isVisible && (
<Modal header={t('Payout all stakers')}>
<Modal
header={t('Payout all stakers')}
size='large'
>
<Modal.Content>
{Array.isArray(payout)
? (
<Static
label={t('payout stakers for (multiple)')}
value={
payout.map(({ validatorId }) => (
<AddressMini
key={validatorId}
value={validatorId}
/>
))
}
/>
)
: (
<Modal.Columns>
<Modal.Column>
<InputAddress
defaultValue={payout.validatorId}
isDisabled
label={t('payout stakers for (single)')}
label={t('request payout from')}
onChange={setAccount}
type='account'
value={accountId}
/>
)
}
<InputAddress
label={t('request payout from')}
onChange={setAccount}
type='account'
value={accountId}
/>
</Modal.Column>
<Modal.Column>
<p>{t('Any account can request payout for stakers, this is not limited to accounts that will be rewarded.')}</p>
</Modal.Column>
</Modal.Columns>
<Modal.Columns>
<Modal.Column>
{Array.isArray(payout)
? (
<Static
label={t('payout stakers for (multiple)')}
value={
payout.map(({ validatorId }) => (
<AddressMini
key={validatorId}
value={validatorId}
/>
))
}
/>
)
: (
<InputAddress
defaultValue={payout.validatorId}
isDisabled
label={t('payout stakers for (single)')}
/>
)
}
</Modal.Column>
<Modal.Column>
<p>{t('All the listed validators and all their nominators will receive their rewards.')}</p>
</Modal.Column>
</Modal.Columns>
</Modal.Content>
<Modal.Actions onCancel={togglePayout}>
<TxButton
@ -103,7 +120,7 @@ function PayButton ({ isAll, isDisabled, payout }: Props): React.ReactElement<Pr
</Modal>
)}
<Button
icon='percent'
icon='credit card outline'
isDisabled={isDisabled || isPayoutEmpty}
label={(isAll || Array.isArray(payout)) ? t('Payout all') : t('Payout')}
onClick={togglePayout}

View File

@ -11,7 +11,7 @@
"contributors": [],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.9.6",
"@polkadot/react-components": "0.42.0-beta.60",
"@polkadot/react-params": "0.42.0-beta.60"
}

View File

@ -12,7 +12,7 @@
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.9.6",
"@polkadot/react-components": "0.42.0-beta.60"
}
}

View File

@ -11,7 +11,7 @@
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.9.6",
"@polkadot/react-components": "0.42.0-beta.60",
"@polkadot/react-query": "0.42.0-beta.60"
}

View File

@ -11,7 +11,7 @@
"contributors": [],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.9.6",
"@polkadot/react-components": "0.42.0-beta.60"
}
}

View File

@ -12,7 +12,7 @@
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.9.6",
"@polkadot/react-components": "0.42.0-beta.60",
"@polkadot/react-query": "0.42.0-beta.60"
}

View File

@ -30,8 +30,8 @@
},
"homepage": "https://github.com/polkadot-js/ui/tree/master/packages/ui-reactive#readme",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@polkadot/api": "^1.12.0-beta.13",
"@babel/runtime": "^7.9.6",
"@polkadot/api": "^1.13.0-beta.2",
"@polkadot/extension-dapp": "^0.25.0-beta.3",
"rxjs-compat": "^6.5.5"
}

View File

@ -10,8 +10,8 @@
"contributors": [],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@polkadot/keyring": "^2.9.0-beta.3",
"@babel/runtime": "^7.9.6",
"@polkadot/keyring": "^2.10.0-beta.1",
"@polkadot/react-api": "0.42.0-beta.60",
"@polkadot/react-identicon": "^0.53.0-beta.1",
"@polkadot/react-query": "0.42.0-beta.60",
@ -19,7 +19,7 @@
"@polkadot/ui-settings": "^0.53.0-beta.1",
"chart.js": "^2.9.3",
"codeflask": "^1.4.1",
"i18next": "^19.4.2",
"i18next": "^19.4.4",
"i18next-browser-languagedetector": "^4.1.1",
"i18next-xhr-backend": "^3.2.2",
"react": "^16.13.1",
@ -28,7 +28,7 @@
"react-copy-to-clipboard": "^5.0.2",
"react-dom": "^16.13.1",
"react-dropzone": "^10.2.2",
"react-i18next": "^11.3.5",
"react-i18next": "^11.4.0",
"react-is": "^16.13.1",
"react-markdown": "^4.3.1",
"react-router": "^5.1.2",

View File

@ -109,13 +109,17 @@ export default css`
padding: 1rem !important;
}
/* approx h1, color, size, font */
> .header:not(.ui) {
background: #f9f9f9;
border-bottom: none;
font-size: 1.25rem !important;
font-weight: normal;
color: rgba(0, 0, 0, .6);
font-family: sans-serif;
font-size: 1.75rem;
font-weight: 100;
line-height: 1.25rem;
padding: 1.5rem 1.75rem 0;
text-transform: lowercase;
> label {
margin-top: 0.5rem;

View File

@ -30,10 +30,10 @@
},
"homepage": "https://github.com/polkadot-js/ui/tree/master/packages/ui-reactive#readme",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.9.6",
"memoizee": "^0.4.14"
},
"devDependencies": {
"@types/memoizee": "^0.4.3"
"@types/memoizee": "^0.4.4"
}
}

View File

@ -8,6 +8,6 @@ import createMemo from 'memoizee';
// eslint-disable-next-line @typescript-eslint/unbound-method
const normalizer = JSON.stringify;
export default function memo <T extends Function> (inner: T): T {
export default function memo <T extends (...args: any[]) => any> (inner: T): T {
return createMemo(inner, { normalizer });
}

View File

@ -10,7 +10,7 @@
"contributors": [],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.9.6",
"@polkadot/react-components": "0.42.0-beta.60"
}
}

View File

@ -30,6 +30,6 @@
},
"homepage": "https://github.com/polkadot-js/ui/tree/master/packages/ui-reactive#readme",
"dependencies": {
"@babel/runtime": "^7.9.2"
"@babel/runtime": "^7.9.6"
}
}

View File

@ -10,7 +10,7 @@
"contributors": [],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.9.6",
"@polkadot/react-components": "0.42.0-beta.60",
"@polkadot/react-qr": "^0.53.0-beta.1"
}

1759
yarn.lock

File diff suppressed because it is too large Load Diff