Adjust crowdloan close status (#4987)
* Adjust crowdloan close status * Adjust column displays
This commit is contained in:
parent
e0dbdd7f0f
commit
a5392fba04
@ -16,7 +16,7 @@ import { encodeAddress } from '@polkadot/util-crypto';
|
||||
|
||||
import { useTranslation } from '../translate';
|
||||
import Contribute from './Contribute';
|
||||
import Withdraw from './Withdraw';
|
||||
import Refund from './Refund';
|
||||
|
||||
interface Props {
|
||||
bestNumber?: BN;
|
||||
@ -92,14 +92,14 @@ function Fund ({ bestNumber, className, isOngoing, leasePeriod, value: { childKe
|
||||
[cap, raised]
|
||||
);
|
||||
|
||||
const isLeaseOver = !!leasePeriod && (
|
||||
const isLeaseOver = !blocksLeft && !!leasePeriod && (
|
||||
isWinner
|
||||
? leasePeriod.currentPeriod.gt(lastSlot)
|
||||
: leasePeriod.currentPeriod.gt(firstSlot)
|
||||
);
|
||||
const canContribute = isOngoing && blocksLeft && !isCapped && !isWinner && retiring.isFalse;
|
||||
const canContribute = !!blocksLeft && isOngoing && !isCapped && !isWinner && retiring.isFalse;
|
||||
const canDissolve = raised.isZero() || (retiring.isTrue && isLeaseOver);
|
||||
const canWithdraw = canDissolve || (!!(bestNumber && bestNumber.gt(end)) && isLeaseOver);
|
||||
const canWithdraw = !raised.isZero() && isLeaseOver;
|
||||
|
||||
return (
|
||||
<tr className={className}>
|
||||
@ -165,7 +165,7 @@ function Fund ({ bestNumber, className, isOngoing, leasePeriod, value: { childKe
|
||||
</td>
|
||||
<td className='button'>
|
||||
{canWithdraw && uniqueKeys.length !== 0 && (
|
||||
<Withdraw
|
||||
<Refund
|
||||
allAccounts={uniqueKeys}
|
||||
myAccounts={myAccounts}
|
||||
paraId={paraId}
|
||||
@ -178,7 +178,7 @@ function Fund ({ bestNumber, className, isOngoing, leasePeriod, value: { childKe
|
||||
isDisabled={!isDepositor}
|
||||
label={
|
||||
isEnded
|
||||
? t<string>('Dissolve')
|
||||
? t<string>('Close')
|
||||
: t<string>('Cancel')
|
||||
}
|
||||
params={[paraId]}
|
||||
|
||||
@ -47,7 +47,7 @@ function createExtrinsics (api: ApiPromise, addresses: string[], paraId: ParaId,
|
||||
}, []);
|
||||
}
|
||||
|
||||
function Withdraw ({ allAccounts, className, myAccounts, paraId }: Props): React.ReactElement<Props> {
|
||||
function Refund ({ allAccounts, className, myAccounts, paraId }: Props): React.ReactElement<Props> {
|
||||
const { t } = useTranslation();
|
||||
const { api } = useApi();
|
||||
const { hasAccounts } = useAccounts();
|
||||
@ -140,7 +140,7 @@ function Withdraw ({ allAccounts, className, myAccounts, paraId }: Props): React
|
||||
extrinsic={extrinsics}
|
||||
icon='credit-card'
|
||||
isDisabled={!extrinsics || !extrinsics.length || !accountId}
|
||||
label={t<string>('Withdraw')}
|
||||
label={t<string>('Refund')}
|
||||
onStart={toggleOpen}
|
||||
/>
|
||||
</Modal.Actions>
|
||||
@ -150,4 +150,4 @@ function Withdraw ({ allAccounts, className, myAccounts, paraId }: Props): React
|
||||
);
|
||||
}
|
||||
|
||||
export default React.memo(Withdraw);
|
||||
export default React.memo(Refund);
|
||||
@ -189,7 +189,7 @@ function Parachain ({ bestNumber, className = '', id, lastBacked, lastInclusion,
|
||||
}
|
||||
</td>
|
||||
<td className='number media--900 no-pad-left'>{paraBest && <>{formatNumber(paraBest)}</>}</td>
|
||||
<td className='number media--1300'>
|
||||
<td className='number media--1200'>
|
||||
{paraInfo.updateAt && bestNumber && (
|
||||
<>
|
||||
<BlockToTime value={paraInfo.updateAt.sub(bestNumber)} />
|
||||
@ -197,7 +197,7 @@ function Parachain ({ bestNumber, className = '', id, lastBacked, lastInclusion,
|
||||
</>
|
||||
)}
|
||||
</td>
|
||||
<td className='number media--1200'>
|
||||
<td className='number media--1300'>
|
||||
{formatNumber(paraInfo.qUmp)} / {formatNumber(paraInfo.qDmp)} / {formatNumber(paraInfo.qHrmpE)} / {formatNumber(paraInfo.qHrmpI)}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -145,8 +145,8 @@ function Parachains ({ actionsQueue, ids, scheduled }: Props): React.ReactElemen
|
||||
[t('backed'), 'no-pad-left'],
|
||||
[t('timeout'), 'no-pad-left'],
|
||||
[t('chain best'), 'media--900 no-pad-left'],
|
||||
[t('upgrade'), 'media--1300'],
|
||||
[t('ump/dmp/hrmp'), 'media--1200']
|
||||
[t('upgrade'), 'media--1200'],
|
||||
[t('ump/dmp/hrmp'), 'media--1300']
|
||||
]);
|
||||
|
||||
const scheduledIds = useMemo(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user