Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add wallet linking #1596

Open
wants to merge 67 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 62 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
3550de2
style: optimize profile page header
dennyscode Oct 29, 2024
2d4eb8a
chore: update leaderboard
dennyscode Oct 31, 2024
ff8e5e1
Merge branch 'develop' into LF-10647-jumper-new-profile-page-design
dennyscode Oct 31, 2024
89e2585
chore: wip leaderboard
dennyscode Oct 31, 2024
9ba2069
chore: wip leaderboard pagination + styles
dennyscode Nov 4, 2024
da48be5
chore: update quest-card component
dennyscode Nov 5, 2024
35ad49a
style: format numbers
dennyscode Nov 5, 2024
98e9afe
style: fix background colors + padding
dennyscode Nov 5, 2024
5ab9f1d
Merge branch 'develop' into LF-10647-jumper-new-profile-page-design
dennyscode Nov 5, 2024
06856af
fix: leaderboard pagination
dennyscode Nov 6, 2024
9b3995d
chore: leaderboard updates + questcard styles
dennyscode Nov 6, 2024
274e596
chore: styles + loading states + numeric logic
dennyscode Nov 6, 2024
076dd67
refactor: cleanup
dennyscode Nov 6, 2024
b1dff0d
fix: remove dummy data
dennyscode Nov 6, 2024
6a29a8b
fix: pagination
dennyscode Nov 6, 2024
0c97124
Merge branch 'develop' into LF-10647-jumper-new-profile-page-design
dennyscode Nov 6, 2024
0aa794e
chore: fallback cases leaderboard params
dennyscode Nov 6, 2024
7ca5bd0
fix: xp icon bg on dark theme, ...
dennyscode Nov 6, 2024
033d83d
style: more space between headline and component
dennyscode Nov 6, 2024
fe29174
refactor: cleanup
dennyscode Nov 6, 2024
a7a9d20
Merge branch 'develop' into LF-10647-jumper-new-profile-page-design
dennyscode Nov 8, 2024
b84c93b
fix: levels info in tierbox
dennyscode Nov 8, 2024
4a088d6
Merge branch 'develop' into LF-10647-jumper-new-profile-page-design
dennyscode Nov 14, 2024
ec925e5
chore: styling, pages, ...
dennyscode Nov 18, 2024
455a349
Merge branch 'develop' into LF-10647-jumper-new-profile-page-design
dennyscode Nov 19, 2024
7f659c7
style: adjustments
dennyscode Nov 19, 2024
e2f06e8
style: adjustments
dennyscode Nov 19, 2024
d1992dd
style: adjustments
dennyscode Nov 20, 2024
f82ebcd
chore: hide numeric quest carousel
dennyscode Nov 20, 2024
8ce06bb
automatic push
tcheee Nov 22, 2024
24971fe
Merge branch 'develop' into LF-10647-jumper-new-profile-page-design
dennyscode Nov 28, 2024
000048c
automatic push
tcheee Nov 28, 2024
3b16bba
automatic push
tcheee Nov 29, 2024
ea69028
automatic push
tcheee Dec 2, 2024
f38ce5f
automatic push
tcheee Dec 2, 2024
77757a2
automatic push
tcheee Dec 2, 2024
0056782
automatic push
tcheee Dec 3, 2024
4b4dedc
automatic push
tcheee Dec 3, 2024
4e77212
chore: merge develop
tcheee Dec 3, 2024
4437700
automatic push
tcheee Dec 3, 2024
7ac022d
automatic push
tcheee Dec 3, 2024
cacce42
automatic push
tcheee Dec 5, 2024
b07889b
fix: solve merge conflicts
tcheee Dec 9, 2024
df9dc26
automatic push
tcheee Dec 9, 2024
a60c860
chore: adapt to dateExt
tcheee Dec 9, 2024
6b97eaa
chore: reuse decimalExt
tcheee Dec 9, 2024
cfd101b
chore: fix digital2
tcheee Dec 9, 2024
9d47de7
automatic push
tcheee Dec 9, 2024
769e335
chore: remove references to effigy
tcheee Dec 12, 2024
f2d90a9
chore: adapt feedbacks
tcheee Dec 12, 2024
863f859
chore: fix build
tcheee Dec 12, 2024
c36e77f
chore: change palette
tcheee Dec 13, 2024
30a1705
Merge branch 'develop' into LF-10647-jumper-new-profile-page-design
dennyscode Dec 16, 2024
c6ae3ca
fix: update yarn.lock
dennyscode Dec 16, 2024
546dd33
fix: update yarn.lock
dennyscode Dec 18, 2024
70a4adb
chore: bump packages
dennyscode Dec 18, 2024
821b0f6
Merge branch 'develop' into LF-11020-jumper-front-implement-the-new-w…
dennyscode Dec 18, 2024
8f691a0
chore: setup wallet linking ui wip
dennyscode Dec 19, 2024
2019c80
Merge branch 'develop' into LF-11020-jumper-front-implement-the-new-w…
dennyscode Dec 19, 2024
a9156b6
chore: wip wallet signatures
dennyscode Dec 23, 2024
0c65858
Merge branch 'develop' into LF-11020-jumper-front-implement-the-new-w…
dennyscode Jan 7, 2025
045e4b7
Merge branch 'develop' into LF-11020-jumper-front-implement-the-new-w…
dennyscode Jan 7, 2025
64028cb
Merge branch 'develop' into LF-11020-jumper-front-implement-the-new-w…
dennyscode Jan 13, 2025
b10dfbf
Merge branch 'develop' into LF-11020-jumper-front-implement-the-new-w…
dennyscode Jan 13, 2025
e8e0aa5
chore: wip wallet-linking
dennyscode Jan 14, 2025
d34db44
Merge branch 'develop' into LF-11020-jumper-front-implement-the-new-w…
dennyscode Jan 14, 2025
2b94c6f
style: apply dark theme colors
dennyscode Jan 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions public/chain-icon-eth.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/chain-icon-sol.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/wallet-icon-metamask.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/wallet-icon-phantom.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/app/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { currencyFormatter, decimalFormatter } from '@/utils/formatNumbers';
import type { Resource, i18n } from 'i18next';
import { createInstance } from 'i18next';
import resourcesToBackend from 'i18next-resources-to-backend';
import { initReactI18next } from 'react-i18next/initReactI18next';
import i18nConfig from '../../i18nconfig';
import { currencyFormatter, decimalFormatter } from '@/utils/formatNumbers';
import { dateFormatter } from 'src/utils/formatDate';
import i18nConfig from '../../i18nconfig';

// TODO: use https://nextjs.org/docs/app/building-your-application/routing/internationalization#localization
export default async function initTranslations(
Expand Down
74 changes: 74 additions & 0 deletions src/components/AvatarBadge/AvatarBadge.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import { Avatar, Badge, Avatar as MuiAvatar } from '@mui/material';
import { styled } from '@mui/material/styles';
import type { BadgeOffsetProps } from './AvatarBadge';
import { getAvatarMask } from './getAvatarMask';

interface StyledAvatarProps {
avatarSize: number;
badgeSize: number;
badgeOffset?: BadgeOffsetProps;
badgeGap?: number;
}

// Styled Avatar component for the badge
export const StyledAvatar = styled(Avatar, {
shouldForwardProp: (prop) =>
prop !== 'avatarSize' &&
prop !== 'badgeSize' &&
prop !== 'badgeOffset' &&
prop !== 'badgeGap',
})<StyledAvatarProps>(({ avatarSize, badgeSize, badgeOffset, badgeGap }) => ({
height: avatarSize,
width: avatarSize,
mask: getAvatarMask({ avatarSize, badgeSize, badgeOffset, badgeGap }), // Apply dynamic mask based on avatar and badge size
'> img': {
height: '100%',
width: '100%',
objectFit: 'contain',
},
}));

interface StyledBadgeProps {
badgeOffset?: BadgeOffsetProps;
avatarSize: number;
}

// Styled Badge component for the badge
export const StyledBadge = styled(Badge, {
shouldForwardProp: (prop) => prop !== 'badgeOffset' && prop !== 'avatarSize',
})<StyledBadgeProps>(({ badgeOffset, avatarSize }) => ({
borderRadius: '50%',
display: 'block',
height: avatarSize,
width: avatarSize,

'.MuiBadge-badge': {
position: 'static',
transform: 'none',
top: 'unset',
right: 'unset',
zIndex: 'unset',
minWidth: 'unset',
padding: 'unset',
height: 'unset',
lineHeight: 'unset',
...((badgeOffset?.x || badgeOffset?.y) && {
transform: `translate(${badgeOffset?.x ? badgeOffset.x : 0}px, ${badgeOffset?.y ? badgeOffset.y : 0}px)`,
}),
},
}));

// Styled avatar
export const StyledBadgeAvatar = styled(MuiAvatar, {
shouldForwardProp: (prop) => prop !== 'badgeSize',
})<{
badgeSize: number;
}>(({ badgeSize }) => ({
width: badgeSize,
height: badgeSize,
position: 'absolute',
bottom: 0,
right: 0,
top: 'unset',
left: 'unset',
}));
61 changes: 61 additions & 0 deletions src/components/AvatarBadge/AvatarBadge.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { Skeleton } from '@mui/material';
import React from 'react';
import {
StyledAvatar,
StyledBadge,
StyledBadgeAvatar,
} from './AvatarBadge.style';

export interface BadgeOffsetProps {
x?: number;
y?: number;
}

type AvatarBadgeProps = {
avatarAlt: string;
avatarSize: number;
avatarSrc?: string;
badgeAlt: string;
badgeSize: number;
badgeSrc?: string;
badgeOffset?: BadgeOffsetProps;
badgeGap?: number;
};

const AvatarBadge: React.FC<AvatarBadgeProps> = ({
avatarAlt,
avatarSize,
avatarSrc,
badgeAlt,
badgeSize,
badgeSrc,
badgeOffset,
badgeGap,
}) => {
return (
<StyledBadge
overlap="circular"
badgeOffset={badgeOffset}
avatarSize={avatarSize}
// anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}
badgeContent={
<StyledBadgeAvatar src={badgeSrc} alt={badgeAlt} badgeSize={badgeSize}>
<Skeleton variant="circular" width={badgeSize} height={badgeSize} />
</StyledBadgeAvatar>
}
>
<StyledAvatar
src={avatarSrc}
alt={avatarAlt}
avatarSize={avatarSize}
badgeSize={badgeSize}
badgeOffset={{ x: badgeOffset?.x, y: badgeOffset?.y }}
badgeGap={badgeGap}
>
<Skeleton variant="circular" width={avatarSize} height={avatarSize} />
</StyledAvatar>
</StyledBadge>
);
};

export default AvatarBadge;
52 changes: 52 additions & 0 deletions src/components/AvatarBadge/getAvatarMask.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* Generates a dynamic avatar mask that positions a badge based on the avatar size and optional badge gap/offset.
*
* The mask uses a radial gradient to blend the badge into the avatar, simulating the appearance of the badge
* partially overlapping the avatar's edge. The function also allows specifying a gap between the avatar and badge,
* along with custom x/y offsets for fine-tuning positioning.
*
* @param {number} avatarSize - The size of the avatar in pixels (e.g. 44, 32).
* @param {number} badgeSize - The size of the badge in pixels (e.g. 12).
* @param {BadgeOffsetProps} [badgeOffset] - Optional x and y offset values to adjust the badge's position.
* @param {number} [badgeGap] - Optional gap between the avatar and badge, defaults to a quarter of the badge size.
* @returns {string} The radial gradient mask for the avatar.
*
* The `badgeGap` introduces space between the avatar and badge by modifying the badge's radius.
* If `badgeGap` is not provided, a default value of 25% of the badge size is used.
*
* Example usage:
* ```
* getAvatarMask({
* avatarSize: 44,
* badgeSize: 12,
* badgeOffset: { x: 4, y: 4 },
* badgeGap: 2,
* });
* ```
*/

import type { BadgeOffsetProps } from './AvatarBadge';

interface GetAvatarMask {
avatarSize: number;
badgeSize: number;
badgeOffset?: BadgeOffsetProps;
badgeGap?: number;
}

export const getAvatarMask = ({
avatarSize,
badgeSize,
badgeOffset,
badgeGap,
}: GetAvatarMask) => {
const badgeRadius =
badgeGap !== undefined
? (badgeSize + badgeGap) / 2
: (badgeSize + badgeSize / 4) / 2; // Badge radius with default gap if not provided
const badgeOffsetX =
avatarSize - badgeSize / 2 + (!!badgeOffset?.x ? badgeOffset?.x : 0);
const badgeOffsetY =
avatarSize - badgeSize / 2 + (!!badgeOffset?.y ? badgeOffset?.y : 0);
return `radial-gradient(circle ${badgeRadius}px at calc(${badgeOffsetX}px) calc(${badgeOffsetY}px), #fff0 96%, #fff) 100% 100% / 100% 100% no-repeat`;
};
4 changes: 2 additions & 2 deletions src/components/Blog/BlogCarousel/CarouselContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import { Box, useTheme, type CSSObject } from '@mui/material';

import type { ReactNode } from 'react';
import { useCallback, useRef } from 'react';
import IconHeader from 'src/components/ProfilePage/Common/IconHeader';
import { SectionTitle } from 'src/components/ProfilePage/ProfilePage.style';
import useClient from 'src/hooks/useClient';
import {
CarouselCenteredBox,
CarouselContainerBox,
CarouselHeader,
CarouselNavigationButton,
CarouselNavigationContainer,
} from '.';
import IconHeader from 'src/components/ProfilePage/Common/IconHeader';
import useClient from 'src/hooks/useClient';

interface CarouselContainerProps {
title?: string;
Expand Down
6 changes: 3 additions & 3 deletions src/components/Leaderboard/Leaderboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';

import { useAccount } from '@lifi/wallet-management';
import { Box } from '@mui/material';
import useClient from 'src/hooks/useClient';
import type { LeaderboardEntryData } from '../../hooks/useLeaderboard';
import {
useLeaderboardList,
useLeaderboardUser,
} from '../../hooks/useLeaderboard';
import IconHeader from '../ProfilePage/Common/IconHeader';
import { Pagination } from '../ProfilePage/Common/Pagination';
import { PageContainer } from '../ProfilePage/ProfilePage.style';
import {
Expand All @@ -22,9 +25,6 @@ import {
import { LeaderboardEntry } from './LeaderboardEntry';
import { LeaderboardEntrySkeleton } from './LeaderboardEntrySkeleton';
import { LeaderboardUserEntry } from './LeaderboardUserEntry';
import IconHeader from '../ProfilePage/Common/IconHeader';
import useClient from 'src/hooks/useClient';
import { Box } from '@mui/material';

export const LEADERBOARD_LENGTH = 25;

Expand Down
3 changes: 1 addition & 2 deletions src/components/Leaderboard/LeaderboardEntry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ import {
RankWalletImageSkeleton,
} from './LeaderboardEntry.style';

import { useWalletAddressImg } from 'src/hooks/useAddressImg';
import { obfuscatedAddressFormatter } from 'src/utils/obfuscatedAddressFormatter';
import useBlockieImg from 'src/hooks/useBlockieImg';
import { obfuscatedAddressFormatter } from 'src/utils/obfuscatedAddressFormatter';

interface LeaderboardEntryProps {
isUserPosition?: boolean;
Expand Down
10 changes: 4 additions & 6 deletions src/components/ProfilePage/AddressBox/AddressBox.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
import { NoSelectTypography } from '@/components/ProfilePage/ProfilePage.style';
import { getSiteUrl } from '@/const/urls';
import { useWalletAddressImg } from '@/hooks/useAddressImg';
import { useMenuStore } from '@/stores/menu';
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
import OpenInNewIcon from '@mui/icons-material/OpenInNew';
import LinkIcon from '@mui/icons-material/Link';
import OpenInNewIcon from '@mui/icons-material/OpenInNew';
import { useTheme } from '@mui/material';
import Image from 'next/image';
import { useTranslation } from 'react-i18next';
import { useMercleNft } from 'src/hooks/useMercleNft';
import { getAddressLabel } from 'src/utils/getAddressLabel';
import type { Address } from 'viem';
import { useEnsName } from 'wagmi';
import { mainnet } from 'wagmi/chains';
import { NoSelectTypography } from '@/components/ProfilePage/ProfilePage.style';
import { getSiteUrl } from '@/const/urls';
import useBlockieImg from '@/hooks/useBlockieImg';
import { useWalletAddressImg } from '@/hooks/useAddressImg';
import {
AddressBoxContainer,
PassImageBox,
Expand Down
5 changes: 2 additions & 3 deletions src/components/ProfilePage/AddressCard/AddressCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,24 @@ import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
import { Typography } from '@mui/material';
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useWalletAddressImg } from 'src/hooks/useAddressImg';
import { useMercleNft } from 'src/hooks/useMercleNft';
import { getAddressLabel } from 'src/utils/getAddressLabel';
import type { Address } from 'viem';
import { useEnsName } from 'wagmi';
import { mainnet } from 'wagmi/chains';
import { AddressMenu } from '../AddressMenu/AddressMenu';
import {
AddressBlockiesImage,
AddressBox,
AddressBoxContainer,
AddressButton,
AddressButtonLabel,
AddressConnectButton,
AddressBlockiesImage,
AddressBlockiesImageSkeleton,
ImageBackground,
PassImageBox,
ProfileIconButton,
} from './AddressCard.style';
import { useWalletAddressImg } from 'src/hooks/useAddressImg';

interface AddressBoxProps {
address?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { RankIcon } from 'src/components/illustrations/IconRANK';
import { LEADERBOARD_LENGTH } from 'src/components/Leaderboard/Leaderboard';
import type { LeaderboardEntryData } from '../../../hooks/useLeaderboard';
import { useLeaderboardUser } from '../../../hooks/useLeaderboard';
import IconHeader from '../Common/IconHeader';
import {
CardButton,
CardButtonContainer,
Expand All @@ -13,7 +14,6 @@ import {
RankContainer,
RankContentContainer,
} from './LeaderboardCard.style';
import IconHeader from '../Common/IconHeader';

export const LeaderboardCard = ({ address }: { address?: string }) => {
const { data: leaderboardUserData }: { data: LeaderboardEntryData } =
Expand Down
2 changes: 1 addition & 1 deletion src/components/ProfilePage/LevelBox/LevelBox.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Box } from '@mui/material';
import { useTranslation } from 'react-i18next';
import { LvlIcon } from 'src/components/illustrations/IconLVL';
import { PointsDisplay } from './PointsDisplay';
import IconHeader from '../Common/IconHeader';
import { PointsDisplay } from './PointsDisplay';

interface LevelBoxProps {
level?: number;
Expand Down
4 changes: 2 additions & 2 deletions src/components/ProfilePage/LevelBox/PointsBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import { Box } from '@mui/material';
import { useTranslation } from 'react-i18next';
import { XPIcon } from 'src/components/illustrations/XPIcon';
import { PointsDisplay } from './PointsDisplay';
import IconHeader from '../Common/IconHeader';
import useClient from 'src/hooks/useClient';
import IconHeader from '../Common/IconHeader';
import { PointsDisplay } from './PointsDisplay';

interface PointsBoxProps {
points?: number;
Expand Down
1 change: 0 additions & 1 deletion src/components/ProfilePage/ProfilePage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use client';
import { useLoyaltyPass } from '@/hooks/useLoyaltyPass';
import { useAccount } from '@lifi/wallet-management';
import { useContext } from 'react';
import { useMerklRewardsOnCampaigns } from 'src/hooks/useMerklRewardsOnCampaigns';
import { useTraits } from 'src/hooks/useTraits';
Expand Down
2 changes: 1 addition & 1 deletion src/components/ProfilePage/Rewards/RewardsCarousel.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Box, useTheme } from '@mui/material';
import { useTranslation } from 'react-i18next';
import { FlexCenterRowBox } from 'src/components/Superfest/SuperfestPage/SuperfestMissionPage.style';
import type { AvailableRewards } from 'src/hooks/useMerklRewardsOnCampaigns';
import { ClaimingBox } from './ClaimingBox/ClaimingBox';
import {
EarnedTypography,
RewardsCarouselContainer,
} from './RewardsCarousel.style';
import { useTranslation } from 'react-i18next';

interface RewardsCarouselProps {
isMerklSuccess: boolean;
Expand Down
18 changes: 18 additions & 0 deletions src/components/ProfilePage/WalletCardBox/WalletCardBox.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Box, styled } from '@mui/material';

export const WalletCardsContainer = styled(Box)(({ theme }) => ({
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
padding: theme.spacing(3),
backgroundColor: theme.palette.white.main,
gap: theme.spacing(2),
minWidth: 208,
width: '100%',
borderRadius: 16,
flexGrow: 1,
[theme.breakpoints.up('md')]: {
minWidth: 'auto',
width: 208,
},
}));
Loading
Loading