import { VegaIcon, VegaIconNames } from '@vegaprotocol/ui-toolkit'; import { useT } from '../../../lib/use-t'; import classNames from 'classnames'; import type { PartyVestingStats } from '@vegaprotocol/types'; import BigNumber from 'bignumber.js'; import { formatNumber } from '@vegaprotocol/utils'; import { safeProgress } from './activity-streaks'; export const useGetUserTier = ( tiers: { minimum_quantum_balance: string; reward_multiplier: string; }[], progress?: number | string ) => { if (!progress) return 0; if (!tiers || tiers.length === 0) return 0; let userTier = 0; let i = 0; let minProgress = '0'; while (i < tiers.length && new BigNumber(minProgress).isLessThan(progress)) { userTier = i; i++; minProgress = tiers[userTier].minimum_quantum_balance; } if ( i === tiers.length && new BigNumber(minProgress).isLessThanOrEqualTo(progress) ) { userTier = i; } if (userTier > tiers.length) { userTier--; } return userTier; }; export const RewardHoarderBonus = ({ tiers, vestingDetails, }: { tiers: { minimum_quantum_balance: string; reward_multiplier: string; }[]; vestingDetails?: PartyVestingStats | null; }) => { const t = useT(); const userTierIndex = useGetUserTier(tiers, vestingDetails?.quantumBalance); if (!tiers || tiers.length === 0) return null; // There is only value to compare to the tiers that covers all the user' rewards across all assets const qUSD = 'qUSD'; const progressBarHeight = 'h-10'; return ( <>