feat(trading): show inactive rewards (#6031)
This commit is contained in:
parent
3e78d55c0e
commit
74f0f7bb3d
@ -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>
|
||||
|
@ -138,7 +138,7 @@ describe('isActiveReward', () => {
|
||||
makeDispatchStrategy(EntityScope.ENTITY_SCOPE_TEAMS),
|
||||
'RecurringTransfer'
|
||||
),
|
||||
false,
|
||||
true,
|
||||
],
|
||||
[
|
||||
makeReward(
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user