From ccc8e70a6d84136eefa48d0fc5ed5183556da10c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Zi=C3=B3=C5=82ek?= Date: Fri, 10 Jan 2025 10:33:27 +0100 Subject: [PATCH 1/5] fix: GLM winning label clickable not visible --- .../Home/HomeGridCurrentGlmLock/HomeGridCurrentGlmLock.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/src/components/Home/HomeGridCurrentGlmLock/HomeGridCurrentGlmLock.tsx b/client/src/components/Home/HomeGridCurrentGlmLock/HomeGridCurrentGlmLock.tsx index 8367a51ae5..b3e32c75b7 100644 --- a/client/src/components/Home/HomeGridCurrentGlmLock/HomeGridCurrentGlmLock.tsx +++ b/client/src/components/Home/HomeGridCurrentGlmLock/HomeGridCurrentGlmLock.tsx @@ -51,7 +51,8 @@ const HomeGridCurrentGlmLock: FC = ({ className }) classNameTitleWrapper={didUserWinAnyRaffles ? styles.didUserWinAnyRaffles : ''} dataTest="HomeGridCurrentGlmLock" title={t('currentGlmLock')} - titleSuffix={} + // When won or fetching, show badge so it unhides w/ animation. When no, remove it. + titleSuffix={(didUserWinAnyRaffles || isFetchingUserRaffleWinnings) && } >
Date: Fri, 10 Jan 2025 10:43:52 +0100 Subject: [PATCH 2/5] fix: rewrite approach, move to the RaffleWinnerBadge itself --- .../Home/HomeGridCurrentGlmLock/HomeGridCurrentGlmLock.tsx | 3 +-- .../RaffleWinnerBadge/RaffleWinnerBadge.module.scss | 6 ++++++ .../RaffleWinnerBadge/RaffleWinnerBadge.tsx | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/client/src/components/Home/HomeGridCurrentGlmLock/HomeGridCurrentGlmLock.tsx b/client/src/components/Home/HomeGridCurrentGlmLock/HomeGridCurrentGlmLock.tsx index b3e32c75b7..8367a51ae5 100644 --- a/client/src/components/Home/HomeGridCurrentGlmLock/HomeGridCurrentGlmLock.tsx +++ b/client/src/components/Home/HomeGridCurrentGlmLock/HomeGridCurrentGlmLock.tsx @@ -51,8 +51,7 @@ const HomeGridCurrentGlmLock: FC = ({ className }) classNameTitleWrapper={didUserWinAnyRaffles ? styles.didUserWinAnyRaffles : ''} dataTest="HomeGridCurrentGlmLock" title={t('currentGlmLock')} - // When won or fetching, show badge so it unhides w/ animation. When no, remove it. - titleSuffix={(didUserWinAnyRaffles || isFetchingUserRaffleWinnings) && } + titleSuffix={} >
= ({ isVisible }) => { return (
Date: Tue, 14 Jan 2025 15:00:28 +0100 Subject: [PATCH 3/5] [HOTFIX]: donors --- client/src/hooks/queries/donors/utils.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/client/src/hooks/queries/donors/utils.ts b/client/src/hooks/queries/donors/utils.ts index 76c5f06009..fb74546258 100644 --- a/client/src/hooks/queries/donors/utils.ts +++ b/client/src/hooks/queries/donors/utils.ts @@ -5,10 +5,11 @@ import { ProjectDonor } from './types'; export function mapDataToProjectDonors(data: Response): ProjectDonor[] { return data - .map(({ address, amount }) => ({ - 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; From 0a5a0bb26dacfe9ab031cf999d2fba8b575abf81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Zi=C3=B3=C5=82ek?= Date: Tue, 14 Jan 2025 22:11:11 +0100 Subject: [PATCH 4/5] fix: projects search result -- no total value donated for projects in current open aw --- client/src/hooks/queries/useSearchedProjectsDetails.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) { From 3de0e6b40fa4ebc149e4e7769f02e02c7f667dc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Zi=C3=B3=C5=82ek?= Date: Tue, 14 Jan 2025 23:42:57 +0100 Subject: [PATCH 5/5] fix: add uniqWith to useSearchedProjects --- .../src/hooks/queries/useSearchedProjects.ts | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) 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; + }); + }, }); }