diff --git a/packages/yoroi-extension/app/UI/features/airdrop/common/hooks/useStrings.tsx b/packages/yoroi-extension/app/UI/features/airdrop/common/hooks/useStrings.tsx index 8907c97992..18543e85a1 100644 --- a/packages/yoroi-extension/app/UI/features/airdrop/common/hooks/useStrings.tsx +++ b/packages/yoroi-extension/app/UI/features/airdrop/common/hooks/useStrings.tsx @@ -72,6 +72,10 @@ export const messages = Object.freeze( id: 'airdrop.schedule.redeemed', defaultMessage: '!!!Redeemed', }, + failed: { + id: 'airdrop.schedule.failed', + defaultMessage: '!!!Failed', + }, thawExplanation: { id: 'airdrop.schedule.thawExplanation', defaultMessage: '!!!Each thaw is 25% of your claimed NIGHT allocation', @@ -279,6 +283,7 @@ export const useStrings = () => { thawTitle: (index: number, total: number) => intl.formatMessage(messages.thawTitle, { index, total }), notAvailable: intl.formatMessage(messages.notAvailable), redeemed: intl.formatMessage(messages.redeemed), + failed: intl.formatMessage(messages.failed), thawExplanation: intl.formatMessage(messages.thawExplanation), statusLabel: intl.formatMessage(messages.statusLabel), subTitle: intl.formatMessage(messages.subTitle), diff --git a/packages/yoroi-extension/app/UI/features/airdrop/useCases/AddressDetails.tsx b/packages/yoroi-extension/app/UI/features/airdrop/useCases/AddressDetails.tsx index 61df02536d..fe0fd36605 100644 --- a/packages/yoroi-extension/app/UI/features/airdrop/useCases/AddressDetails.tsx +++ b/packages/yoroi-extension/app/UI/features/airdrop/useCases/AddressDetails.tsx @@ -158,16 +158,17 @@ function formatDate(dateString: string, locale: string): string { } function getCurrentThawIndex(schedule: Schedule): number { - const redeemableIndex = schedule.thaws.findIndex(thaw => thaw.status === 'redeemable'); + const redeemableIndex = schedule.thaws.findIndex(thaw => thaw.status === 'redeemable' || thaw.status === 'failed'); if (redeemableIndex >= 0) return redeemableIndex; - const upcomingIndex = schedule.thaws.findIndex(thaw => thaw.status === 'upcoming'); + const upcomingIndex = schedule.thaws.findIndex(thaw => thaw.status === 'upcoming' || thaw.status === 'failed'); if (upcomingIndex >= 0) return upcomingIndex; return 0; } -type ThawStatus = 'redeemable' | 'confirmed' | 'upcoming'; +type ThawStatus = 'redeemable' | 'confirmed' | 'upcoming' | 'failed'; function getThawStatusType(status: string): ThawStatus { + if (status === 'failed') return 'failed'; if (status === 'redeemable') return 'redeemable'; if (status === 'confirmed') return 'confirmed'; return 'upcoming'; @@ -202,6 +203,8 @@ function getStatusMessage(status: ThawStatus, strings: ReturnType @@ -251,7 +255,13 @@ function ScheduleCard({ schedule }: { schedule: Schedule }) { display: 'flex', alignItems: 'center', justifyContent: 'center', - backgroundColor: isPast ? 'ds.primary_300' : isCurrent ? 'ds.primary_500' : 'ds.gray_200', + backgroundColor: isFailed + ? 'ds.gray_200' + : isPast + ? 'ds.primary_300' + : isCurrent + ? 'ds.primary_500' + : 'ds.gray_200', color: isPast || isCurrent ? 'ds.white_static' : 'ds.text_gray_min', fontSize: '12px', fontWeight: 500, @@ -259,7 +269,16 @@ function ScheduleCard({ schedule }: { schedule: Schedule }) { flexShrink: 0, }} > - {isPast ? ( + {isFailed ? ( + + + + ) : isPast ? ( thaw.status === 'redeemable') + .filter(thaw => thaw.status === 'redeemable' || thaw.status === 'failed') .reduce((accu, thaw) => accu + thaw.amount, 0); } diff --git a/packages/yoroi-extension/app/i18n/locales/en-US.json b/packages/yoroi-extension/app/i18n/locales/en-US.json index 0b8c4557f1..ef87550d1d 100644 --- a/packages/yoroi-extension/app/i18n/locales/en-US.json +++ b/packages/yoroi-extension/app/i18n/locales/en-US.json @@ -52,6 +52,7 @@ "airdrop.redeem.reorgMessage": "Please re-orgnize the wallet for collateral UTxOs", "airdrop.redeem.waitingForReorg": "Waiting for the re-organization transaction to be confirmed", "airdrop.schedule.currentThaw": "Current thaw: {current}/{total}", + "airdrop.schedule.failed": "Failed", "airdrop.schedule.notAvailable": "Not available yet", "airdrop.schedule.redeemable": "Redeemable", "airdrop.schedule.redeemed": "Redeemed",