Skip to content

Commit

Permalink
oct-2263: final sablier ui update
Browse files Browse the repository at this point in the history
  • Loading branch information
jmikolajczyk committed Jan 16, 2025
1 parent 54597ee commit beb5f26
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ const HomeGridCurrentGlmLock: FC<HomeGridCurrentGlmLockProps> = ({ className })
useUserSablierStreams();

const isPreLaunch = getIsPreLaunch(currentEpoch);
const didUserWinAnyRaffles = !!userSablierStreams && userSablierStreams.sum > 0;
const didUserWinAnyRaffles =
!!userSablierStreams &&
(userSablierStreams.sum > 0 ||
(userSablierStreams.sablierStreams.some(({ isCancelled }) => isCancelled) &&
userSablierStreams.sumAvailable > 0));

const buttonText = useMemo(() => {
if (userSablierStreams && userSablierStreams.sumAvailable > 0n) {
Expand Down Expand Up @@ -75,7 +79,12 @@ const HomeGridCurrentGlmLock: FC<HomeGridCurrentGlmLockProps> = ({ className })
_first(transactionsPending)?.type !== 'withdrawal')
}
showCryptoSuffix
valueCrypto={(depositsValue || 0n) + (userSablierStreams?.sumAvailable || 0n)}
valueCrypto={
(depositsValue || 0n) +
((!userSablierStreams?.sablierStreams.some(({ isCancelled }) => isCancelled) &&
userSablierStreams?.sumAvailable) ||
0n)
}
variant={isMobile ? 'large' : 'extra-large'}
/>
<div className={styles.divider} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ const LockGlmBudgetBox: FC<LockGlmBudgetBoxProps> = ({
);

const shouldRaffleWinningsBeDisplayed =
currentMode === 'unlock' && userSablierStreams && userSablierStreams.sumAvailable > 0;
currentMode === 'unlock' &&
userSablierStreams &&
userSablierStreams.sumAvailable > 0 &&
!userSablierStreams.sablierStreams.some(({ isCancelled }) => isCancelled);
const areFundsFetching = isFetchingAvailableFundsGlm || isFetchinguserSablierStreams;

const secondRowValue = getFormattedGlmValue({
Expand All @@ -54,7 +57,9 @@ const LockGlmBudgetBox: FC<LockGlmBudgetBoxProps> = ({
if (shouldRaffleWinningsBeDisplayed) {
return (
<div className={styles.timeLockedInSablier}>
{t('timeLockedInSablier')}
{userSablierStreams.sum === userSablierStreams.sumAvailable
? t('timeLockedInSablier')
: t('lockedInSablier')}
<Button
className={styles.unlockInSablierButton}
href={SABLIER_APP_LINK}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const RaffleWinnerBadge: FC<RaffleWinnerBadgeProps> = ({ isVisible }) => {
? getValuesToDisplay({
cryptoCurrency: 'golem',
showFiatPrefix: false,
valueCrypto: userSablierStreams.sum,
valueCrypto: userSablierStreams.sumAvailable,
})
: undefined;

Expand All @@ -49,7 +49,7 @@ const RaffleWinnerBadge: FC<RaffleWinnerBadgeProps> = ({ isVisible }) => {
const amountFormatted = getValuesToDisplay({
cryptoCurrency: 'golem',
showCryptoSuffix: true,
valueCrypto: parseUnitsBigInt(curr.amount, 'wei'),
valueCrypto: parseUnitsBigInt(curr.remainingAmount, 'wei'),
});
const newRow = t('tooltipWinningRow', {
date: format(parseInt(curr.dateAvailableForWithdrawal, 10) * 1000, 'd LLL y'),
Expand Down
3 changes: 0 additions & 3 deletions client/src/hooks/queries/useUserSablierStreams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ export default function useUserSablierStreams(): UseQueryResult<ReturnType, unkn
return acc + parseUnitsBigInt(curr.amount, 'wei');
}, BigInt(0)),
sumAvailable: response.sablierStreams.reduce((acc, curr) => {
if (curr.isCancelled) {
return acc;
}
return acc + parseUnitsBigInt(curr.remainingAmount, 'wei');
}, BigInt(0)),
}),
Expand Down
1 change: 1 addition & 0 deletions client/src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
"currentlyLocked": "Currently Locked",
"walletBalance": "Wallet balance",
"timeLockedInSablier": "Time locked in Sablier",
"lockedInSablier": "Locked in Sablier",
"unlockInSablier": "Unlock in Sablier"
}
},
Expand Down

0 comments on commit beb5f26

Please sign in to comment.