Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix claiming for timelocked activity (#5849)
* fix: fix claiming for timelocked activity * refactor: remove code duplication * fix: fix icon on async footer * fix: fix when timelock content is displayed * enhancement: dont show icon if date is succeeded * enhancement: dont show claim on timelock activities without SDRUC * fix: fix activities with timelock and expiration date * chore: improve readability for conditions --------- Co-authored-by: Nicole O'Brien <nicole.obrien@iota.org>
- Loading branch information
1 parent
b7d9dcf
commit cbd8515
Showing
8 changed files
with
93 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
packages/shared/lib/core/wallet/utils/generateActivity/helper/getAsyncStatus.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ActivityAsyncStatus } from '@core/wallet/enums' | ||
|
||
export function getAsyncStatus( | ||
isClaimed: boolean, | ||
expirationDate: Date, | ||
timelockDate: Date, | ||
hasStorageDeposit: boolean, | ||
currentTimeStamp: number | ||
): ActivityAsyncStatus { | ||
if (isClaimed) { | ||
return ActivityAsyncStatus.Claimed | ||
} else if (timelockDate && timelockDate.getTime() > currentTimeStamp) { | ||
return ActivityAsyncStatus.Timelocked | ||
} else if (expirationDate && expirationDate.getTime() < currentTimeStamp) { | ||
return ActivityAsyncStatus.Expired | ||
} else if (hasStorageDeposit || expirationDate) { | ||
return ActivityAsyncStatus.Unclaimed | ||
} else if (timelockDate) { | ||
return ActivityAsyncStatus.Claimed | ||
} else { | ||
return ActivityAsyncStatus.Unclaimed | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
packages/shared/lib/core/wallet/utils/generateActivity/helper/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters