diff --git a/client/src/components/Home/HomeGridCurrentGlmLock/RaffleWinnerBadge/RaffleWinnerBadge.module.scss b/client/src/components/Home/HomeGridCurrentGlmLock/RaffleWinnerBadge/RaffleWinnerBadge.module.scss index 089fa62f07..4a8be74725 100644 --- a/client/src/components/Home/HomeGridCurrentGlmLock/RaffleWinnerBadge/RaffleWinnerBadge.module.scss +++ b/client/src/components/Home/HomeGridCurrentGlmLock/RaffleWinnerBadge/RaffleWinnerBadge.module.scss @@ -36,6 +36,12 @@ $padding: 1.1rem; } } +.tooltipChildren { + &:not(.isVisible) { + cursor: default; + } +} + .tooltip { white-space: pre-wrap; width: 29.2rem !important; diff --git a/client/src/components/Home/HomeGridCurrentGlmLock/RaffleWinnerBadge/RaffleWinnerBadge.tsx b/client/src/components/Home/HomeGridCurrentGlmLock/RaffleWinnerBadge/RaffleWinnerBadge.tsx index 3a80d68134..cd36e9b849 100644 --- a/client/src/components/Home/HomeGridCurrentGlmLock/RaffleWinnerBadge/RaffleWinnerBadge.tsx +++ b/client/src/components/Home/HomeGridCurrentGlmLock/RaffleWinnerBadge/RaffleWinnerBadge.tsx @@ -71,6 +71,7 @@ const RaffleWinnerBadge: FC = ({ isVisible }) => { return (
({ - address, - amount: parseUnitsBigInt(amount, 'wei'), - })) + .reduce((acc, { address, amount }) => { + if (amount === '0') {return acc;} + acc.push({ address, amount: parseUnitsBigInt(amount, 'wei') }); + return acc; + }, [] as ProjectDonor[]) .sort((a, b) => { if (a.amount > b.amount) { return -1; diff --git a/client/src/hooks/queries/useSearchedProjects.ts b/client/src/hooks/queries/useSearchedProjects.ts index 0bac36b27b..357ca58d16 100644 --- a/client/src/hooks/queries/useSearchedProjects.ts +++ b/client/src/hooks/queries/useSearchedProjects.ts @@ -1,4 +1,5 @@ import { UseQueryResult, useQuery } from '@tanstack/react-query'; +import uniqWith from 'lodash/uniqWith'; import { apiGetProjectsSearch } from 'api/calls/projects'; import { QUERY_KEYS } from 'api/queryKeys'; @@ -26,10 +27,26 @@ export default function useSearchedProjects( ), // No point in strigifying params, they will just flood the memory. queryKey: QUERY_KEYS.searchResults, - select: data => - data.projectsDetails.map(element => ({ + select: data => { + const dataWithEpochNumber = data.projectsDetails.map(element => ({ ...element, epoch: Number(element.epoch), - })), + })); + + /** + * Because of the bug, BE sometimes returns the same + * name, address & epoch combination multiple times. + * + * Please check e.g. + * GET https://backend.mainnet.octant.app/projects/details?epochs=1,2,3,4,5,6,7&searchPhrases=Open,Source,Observer + * + * Hence the requirement to check uniqueness. + * + * More context: https://chat.wildland.dev/wildland/pl/gghcfgjndjyjieei8axn3opdeh + */ + return uniqWith(dataWithEpochNumber, (elementA, elementB) => { + return elementA.address === elementB.address && elementA.epoch === elementB.epoch; + }); + }, }); } diff --git a/client/src/hooks/queries/useSearchedProjectsDetails.ts b/client/src/hooks/queries/useSearchedProjectsDetails.ts index e775e5be7e..52d0a91a93 100644 --- a/client/src/hooks/queries/useSearchedProjectsDetails.ts +++ b/client/src/hooks/queries/useSearchedProjectsDetails.ts @@ -40,7 +40,7 @@ const getRewards = ({ rewardsEstimated: ResponseRewards | undefined; rewardsPast: ResponseRewards | undefined; }): ResponseRewards['rewards'] | undefined => { - if (epoch === currentEpoch && isDecisionWindowOpen) { + if (epoch === currentEpoch! - 1 && isDecisionWindowOpen) { return rewardsEstimated?.rewards; } if (epoch !== currentEpoch) {