Remove ununsed modal, cleanup comments (#2561)
* Remove ununsed modal, cleanup comments * Adjust info icon location
This commit is contained in:
parent
57ee21e7e5
commit
172df809c0
@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2020 @polkadot/app-123code authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/app-claims authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2020 @polkadot/app-123code authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/app-claims authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
2
packages/page-claims/src/secp256k1.d.ts
vendored
2
packages/page-claims/src/secp256k1.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2020 @polkadot/app-123code authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/app-claims authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2020 @polkadot/app-123code authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/app-claims authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
|
||||
@ -36,6 +36,7 @@ const PERBILL = new BN(1_000_000_000);
|
||||
|
||||
function sortValidators (list: ValidatorInfo[]): ValidatorInfo[] {
|
||||
return list
|
||||
.filter((a) => a.bondTotal.gtn(0))
|
||||
.sort((a, b): number => b.commissionPer - a.commissionPer)
|
||||
.map((info, index): ValidatorInfo => {
|
||||
info.rankComm = index + 1;
|
||||
|
||||
@ -1,115 +0,0 @@
|
||||
// Copyright 2017-2020 @polkadot/app-treasury 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 { AccountId, BlockNumber } from '@polkadot/types/interfaces';
|
||||
import { ApiProps } from '@polkadot/react-api/types';
|
||||
import { I18nProps } from '@polkadot/react-components/types';
|
||||
|
||||
import React from 'react';
|
||||
import { Button, Dropdown } from '@polkadot/react-components';
|
||||
import { withMulti, withApi, withCalls } from '@polkadot/react-api/hoc';
|
||||
import TxModal, { TxModalProps, TxModalState } from '@polkadot/react-components/TxModal';
|
||||
|
||||
import translate from '../translate';
|
||||
|
||||
interface Props extends I18nProps, ApiProps, TxModalProps {
|
||||
isApproved?: boolean;
|
||||
proposalInfo?: React.ReactNode;
|
||||
proposalId: string;
|
||||
threshold: number;
|
||||
}
|
||||
|
||||
interface State extends TxModalState {
|
||||
isApproving: boolean;
|
||||
}
|
||||
|
||||
class Approve extends TxModal<Props, State> {
|
||||
public state: State = {
|
||||
...this.defaultState,
|
||||
isApproving: false
|
||||
};
|
||||
|
||||
private approveOptions = (): { text: string; value: boolean }[] => [
|
||||
{ text: this.props.t('Aye, I approve'), value: true },
|
||||
{ text: this.props.t('Nay, I do not approve'), value: false }
|
||||
]
|
||||
|
||||
protected headerText = (): string => this.props.t('Approve or reject proposal');
|
||||
|
||||
protected txMethod = (): string => 'council.propose';
|
||||
|
||||
protected txParams = (): [number, any] => {
|
||||
const { api, proposalId, threshold } = this.props;
|
||||
const { isApproving } = this.state;
|
||||
|
||||
const method = isApproving ? 'approveProposal' : 'rejectProposal';
|
||||
const spendProposal = api.tx.treasury[method](proposalId);
|
||||
|
||||
return [threshold, spendProposal];
|
||||
}
|
||||
|
||||
protected renderTrigger = (): React.ReactNode => {
|
||||
const { api, t } = this.props;
|
||||
|
||||
// disable voting for 1.x (we only use elections here)
|
||||
if (!api.query.elections) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='ui--Row-buttons'>
|
||||
<Button.Group>
|
||||
<Button
|
||||
icon='reply'
|
||||
isPrimary
|
||||
label={t('Respond')}
|
||||
onClick={this.showModal}
|
||||
/>
|
||||
</Button.Group>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
protected renderPreContent = (): React.ReactNode => {
|
||||
const { proposalInfo = null } = this.props;
|
||||
|
||||
if (!proposalInfo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return proposalInfo;
|
||||
}
|
||||
|
||||
protected renderContent = (): React.ReactNode => {
|
||||
const { t } = this.props;
|
||||
const { isApproving } = this.state;
|
||||
|
||||
return (
|
||||
<Dropdown
|
||||
help={t('Propose a majority council motion to either approve or reject this spend proposal')}
|
||||
label={t('proposed council action')}
|
||||
onChange={this.onChangeApproving}
|
||||
options={this.approveOptions()}
|
||||
value={isApproving}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
private onChangeApproving = (isApproving: boolean): void => {
|
||||
this.setState({ isApproving });
|
||||
}
|
||||
}
|
||||
|
||||
export default withMulti(
|
||||
Approve,
|
||||
translate,
|
||||
withApi,
|
||||
withCalls(
|
||||
['query.elections.members', {
|
||||
propName: 'threshold',
|
||||
transform: (value: [AccountId, BlockNumber][]): number =>
|
||||
Math.ceil(value.length * 0.5)
|
||||
}]
|
||||
)
|
||||
);
|
||||
@ -266,13 +266,15 @@ function renderBalances (props: Props, allAccounts: string[], t: (key: string) =
|
||||
<Label label={t('locked')} />
|
||||
<FormatBalance
|
||||
className='result'
|
||||
label={
|
||||
<Icon
|
||||
data-for={`${address}-locks-trigger`}
|
||||
data-tip
|
||||
name='info circle'
|
||||
/>
|
||||
}
|
||||
value={isAllLocked ? 'all' : balancesAll.lockedBalance}
|
||||
>
|
||||
<Icon
|
||||
data-for={`${address}-locks-trigger`}
|
||||
data-tip
|
||||
name='info circle'
|
||||
/>
|
||||
<Tooltip
|
||||
text={balancesAll.lockedBreakdown.map(({ amount, id, reasons }, index): React.ReactNode => (
|
||||
<div key={index}>
|
||||
@ -447,8 +449,8 @@ export default withMulti(
|
||||
grid-column: 2;
|
||||
|
||||
.icon {
|
||||
margin-left: .3em;
|
||||
margin-right: 0;
|
||||
margin-left: 0;
|
||||
margin-right: 0.25rem;
|
||||
padding-right: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,12 +48,12 @@ function StakingUnbonding ({ className, stakingInfo }: Props): React.ReactElemen
|
||||
|
||||
return (
|
||||
<div className={className}>
|
||||
<FormatBalance value={total} />
|
||||
<Icon
|
||||
data-for={trigger}
|
||||
data-tip
|
||||
name='clock'
|
||||
/>
|
||||
<FormatBalance value={total} />
|
||||
<Tooltip
|
||||
text={mapped.map(([{ value }, blocks], index): React.ReactNode => (
|
||||
<div
|
||||
@ -77,8 +77,8 @@ export default React.memo(styled(StakingUnbonding)`
|
||||
white-space: nowrap;
|
||||
|
||||
i.icon {
|
||||
margin-left: 0.25rem;
|
||||
margin-right: 0;
|
||||
margin-left: 0;
|
||||
margin-right: 0.25rem;
|
||||
}
|
||||
|
||||
.ui--FormatBalance {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user