feat(trading): show inactive rewards (#6031)

This commit is contained in:
m.ray 2024-03-19 13:29:48 +02:00 committed by GitHub
parent 3e78d55c0e
commit 74f0f7bb3d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 6 deletions

View File

@ -188,7 +188,7 @@ const RewardCard = ({
<span className="text-muted text-xs">{t('Starts in')} </span>
<span data-testid="starts-in" data-startsin={startsIn}>
{t('numberEpochs', '{{count}} epochs', {
count: endsIn,
count: startsIn,
})}
</span>
</span>

View File

@ -138,7 +138,7 @@ describe('isActiveReward', () => {
makeDispatchStrategy(EntityScope.ENTITY_SCOPE_TEAMS),
'RecurringTransfer'
),
false,
true,
],
[
makeReward(

View File

@ -56,17 +56,16 @@ export const isReward = (node: TransferNode): node is RewardTransfer => {
};
/**
* Checks if given reward (transfer) is active.
* Checks if given reward (transfer) is has not ended. If it is active or due to start in the future.
*/
export const isActiveReward = (node: RewardTransfer, currentEpoch: number) => {
const { transfer } = node;
const pending = transfer.status === TransferStatus.STATUS_PENDING;
const withinEpochs =
transfer.kind.startEpoch <= currentEpoch &&
(transfer.kind.endEpoch != null
transfer.kind.endEpoch != null
? transfer.kind.endEpoch >= currentEpoch
: true);
: true;
if (pending && withinEpochs) return true;
return false;