Flatten single lease period (#4994)

* Display formatted leases

* Flatten single lease period
This commit is contained in:
Jaco Greeff 2021-04-01 00:25:13 +03:00 committed by GitHub
parent 044087b9b0
commit f8eb3a23d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 6 deletions

View File

@ -28,7 +28,7 @@ function Auction ({ auctionInfo, campaigns, className, winningData }: Props): Re
[t('bids'), 'start', 3],
[t('bidder'), 'address'],
[t('crowdloan')],
[t('periods')],
[t('leases')],
[t('value')]
]);

View File

@ -39,7 +39,11 @@ function WinRanges ({ auctionInfo, blockNumber, className = '', isFirst, isLates
<td className='address'><AddressMini value={accountId} /></td>
<td className='all number'>{isCrowdloan ? t<string>('Yes') : t<string>('No')}</td>
<td className='all number'>
<Digits value={`${formatNumber(firstSlot)} - ${formatNumber(lastSlot)}`} />
<Digits value={
firstSlot.eq(lastSlot)
? formatNumber(firstSlot)
: `${formatNumber(firstSlot)} - ${formatNumber(lastSlot)}`
} />
</td>
<td className='number'><FormatBalance value={value} /></td>
</tr>

View File

@ -142,7 +142,13 @@ function Fund ({ bestNumber, className, isOngoing, leasePeriod, value: { childKe
)}
#{formatNumber(end)}
</td>
<td className='number'><Digits value={`${formatNumber(firstSlot)} - ${formatNumber(lastSlot)}`} /></td>
<td className='number'>
<Digits value={
firstSlot.eq(lastSlot)
? formatNumber(firstSlot)
: `${formatNumber(firstSlot)} - ${formatNumber(lastSlot)}`
} />
</td>
<td className='number together'>
<FormatBalance
value={raised}

View File

@ -37,7 +37,7 @@ function Funds ({ bestNumber, className, leasePeriod, value }: Props): React.Rea
[undefined, 'media--1400'],
[],
[t('ending')],
[t('periods')],
[t('leases')],
[t('raised')],
[t('unique'), 'media--1100'],
[undefined, 'badge'],
@ -50,7 +50,7 @@ function Funds ({ bestNumber, className, leasePeriod, value }: Props): React.Rea
[],
[t('retired')],
[t('ending'), 'media--1200'],
[t('periods')],
[t('leases')],
[t('raised')],
[t('unique'), 'media--1100'],
[undefined, 'badge'],

View File

@ -32,7 +32,11 @@ function Periods ({ className, fromFirst, leasePeriod, periods }: Props): React.
return all;
}, [])
.map(([a, b]) => `${formatNumber(a)} - ${formatNumber(b)}`)
.map(([a, b]) =>
a.eq(b)
? formatNumber(a)
: `${formatNumber(a)} - ${formatNumber(b)}`
)
.join(', '),
[leasePeriod?.currentPeriod, periods]
);