Skip to content

Commit

Permalink
fix: check for dydxAddress in affiliates leaderboard (#1349)
Browse files Browse the repository at this point in the history
  • Loading branch information
tinaszheng authored Dec 2, 2024
1 parent 5f8b802 commit 0167e76
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/pages/affiliates/AffiliatesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const AffiliatesPage = () => {
)}
</$Section>

<AffiliatesLeaderboard accountStats={accountStats} />
<AffiliatesLeaderboard />
</$Page>
);
};
Expand Down
22 changes: 9 additions & 13 deletions src/views/Affiliates/AffiliatesLeaderboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { IAffiliateLeaderboardStats, IAffiliateStats } from '@/constants/affilia
import { STRING_KEYS } from '@/constants/localization';
import { EMPTY_ARR } from '@/constants/objects';

import { useAccounts } from '@/hooks/useAccounts';
import { useAffiliatesLeaderboard } from '@/hooks/useAffiliatesLeaderboard';
import { useBreakpoints } from '@/hooks/useBreakpoints';
import { useStringGetter } from '@/hooks/useStringGetter';
Expand Down Expand Up @@ -73,13 +74,10 @@ const AffiliatesFilter = ({
);
};

interface IAffiliatesLeaderboardProps {
accountStats?: IAffiliateStats;
}

export const AffiliatesLeaderboard = ({ accountStats }: IAffiliatesLeaderboardProps) => {
export const AffiliatesLeaderboard = () => {
const { isTablet } = useBreakpoints();
const stringGetter = useStringGetter();
const { dydxAddress } = useAccounts();
const affiliatesFilters = Object.values(AffiliateEpochsFilter);
const [epochFilter, setEpochFilter] = useState<AffiliateEpochsFilter>(AffiliateEpochsFilter.ALL);
const { data: affiliates } = useAffiliatesLeaderboard();
Expand All @@ -94,10 +92,9 @@ export const AffiliatesLeaderboard = ({ accountStats }: IAffiliatesLeaderboardPr
<TableCell>
{rank}

{accountStats?.affiliateAddress &&
affiliateAddress === accountStats.affiliateAddress && (
<Tag tw="bg-color-accent">{stringGetter({ key: STRING_KEYS.YOU })}</Tag>
)}
{affiliateAddress && affiliateAddress === dydxAddress && (
<Tag tw="bg-color-accent">{stringGetter({ key: STRING_KEYS.YOU })}</Tag>
)}
</TableCell>
);
},
Expand Down Expand Up @@ -146,10 +143,9 @@ export const AffiliatesLeaderboard = ({ accountStats }: IAffiliatesLeaderboardPr
renderCell: ({ rank, affiliateAddress }) => (
<TableCell tw="text-color-text-1 font-base-medium">
{rank}
{accountStats?.affiliateAddress &&
affiliateAddress === accountStats.affiliateAddress && (
<Tag tw="bg-color-accent">{stringGetter({ key: STRING_KEYS.YOU })}</Tag>
)}
{affiliateAddress && affiliateAddress === dydxAddress && (
<Tag tw="bg-color-accent">{stringGetter({ key: STRING_KEYS.YOU })}</Tag>
)}
</TableCell>
),
},
Expand Down

0 comments on commit 0167e76

Please sign in to comment.