Crowdloan sorting

This commit is contained in:
Jaco Greeff 2021-03-25 07:29:20 +01:00
parent 6bce866bcd
commit f5d40a029a
No known key found for this signature in database
GPG Key ID: 270FB2D05A05357C
2 changed files with 14 additions and 1 deletions

View File

@ -57,7 +57,7 @@ function FundContribute ({ cap, className, paraId, raised }: Props): React.React
value={accountId}
/>
</Modal.Columns>
<Modal.Columns hint={t<string>('The amount to contribute. Should be less than the remaining value and more than the minimum contribution amount.')}>
<Modal.Columns hint={t<string>('The amount to contribute from this account.')}>
<InputBalance
autoFocus
defaultValue={api.consts.crowdloan.minContribution as BalanceOf}
@ -73,6 +73,18 @@ function FundContribute ({ cap, className, paraId, raised }: Props): React.React
<MarkWarning content={t<string>('The amount is more than the remaining contribution needed {{value}}', { replace: { value: formatBalance(remaining) } })} />
)}
</Modal.Columns>
<Modal.Columns hint={t<string>('The above contribution should more than minimum contribution amount and less than the remaining value.')}>
<InputBalance
defaultValue={api.consts.crowdloan.minContribution as BalanceOf}
isDisabled
label={t<string>('minimum allowed')}
/>
<InputBalance
defaultValue={remaining}
isDisabled
label={t<string>('remaining till cap')}
/>
</Modal.Columns>
</Modal.Content>
<Modal.Actions onCancel={toggleOpen}>
<TxButton

View File

@ -33,6 +33,7 @@ function extractCampaigns (optFunds: Option<FundInfo>[], paraIds: ParaId[]): Cam
? paraIds
.map((paraId, i) => ({ info: optFunds[i].unwrapOr(null), key: paraId.toString(), paraId }))
.filter((fund): fund is Campaign => !!fund.info)
.sort((a, b) => a.info.firstSlot.cmp(b.info.firstSlot) || a.info.lastSlot.cmp(b.info.lastSlot) || a.paraId.cmp(b.paraId))
: null;
}