Skip to content

Commit

Permalink
Merge branch 'develop' into kacper/feat/oct-2263-community-onboarding…
Browse files Browse the repository at this point in the history
…-through-sablier
  • Loading branch information
aziolek committed Jan 15, 2025
2 parents 4ec7119 + 45028f6 commit fab258a
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@ $padding: 1.1rem;
}
}

.tooltipWrapper {
&:hover {
path {
stroke: $color-white !important;
}
}
}

.tooltipChildren {
&:not(.isVisible) {
cursor: default;
}
}

.tooltip {
white-space: pre-wrap;
width: 29.2rem !important;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const RaffleWinnerBadge: FC<RaffleWinnerBadgeProps> = ({ isVisible }) => {
)}
>
<Tooltip
childrenClassName={cx(styles.tooltipChildren, isVisible && styles.isVisible)}
className={styles.tooltipWrapper}
position="bottom-right"
text={tooltipText}
Expand Down
11 changes: 7 additions & 4 deletions client/src/hooks/queries/donors/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ 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;
Expand Down
23 changes: 20 additions & 3 deletions client/src/hooks/queries/useSearchedProjects.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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;
});
},
});
}
2 changes: 1 addition & 1 deletion client/src/hooks/queries/useSearchedProjectsDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit fab258a

Please sign in to comment.