From 85d221f19ec83fac322c003eadc2ae079b7c45b5 Mon Sep 17 00:00:00 2001 From: caxtonacollins Date: Tue, 12 Nov 2024 12:28:31 +0100 Subject: [PATCH] resovled profileCard.tsx --- components/UI/profileCard/profileCard.tsx | 62 +++++++++++------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/components/UI/profileCard/profileCard.tsx b/components/UI/profileCard/profileCard.tsx index 2b470c0d..5ff6be15 100644 --- a/components/UI/profileCard/profileCard.tsx +++ b/components/UI/profileCard/profileCard.tsx @@ -4,30 +4,30 @@ import React, { useEffect, useMemo, useState, -} from "react"; -import styles from "@styles/dashboard.module.css"; -import { CDNImage } from "@components/cdn/image"; +} from 'react'; +import styles from '@styles/dashboard.module.css'; +import { CDNImage } from '@components/cdn/image'; import { useAccount, useStarkProfile, type Address, -} from "@starknet-react/core"; -import Skeleton from "@mui/material/Skeleton"; -import trophyIcon from "public/icons/trophy.svg"; -import xpIcon from "public/icons/xpBadge.svg"; -import useCreationDate from "@hooks/useCreationDate"; -import shareSrc from "public/icons/share.svg"; -import theme from "@styles/theme"; -import { EyeIcon, EyeIconSlashed } from "../iconsComponents/icons/eyeIcon"; -import ProfilIcon from "../iconsComponents/icons/profilIcon"; -import Link from "next/link"; -import SocialMediaActions from "../actions/socialmediaActions"; -import { getTweetLink } from "@utils/browserService"; -import { hexToDecimal } from "@utils/feltService"; -import { TEXT_TYPE } from "@constants/typography"; -import Typography from "../typography/typography"; -import { calculateTotalBalance } from "../../../services/argentPortfolioService"; -import { useHidePortfolio } from "@hooks/useHidePortfolio"; +} from '@starknet-react/core'; +import Skeleton from '@mui/material/Skeleton'; +import trophyIcon from 'public/icons/trophy.svg'; +import xpIcon from 'public/icons/xpBadge.svg'; +import useCreationDate from '@hooks/useCreationDate'; +import shareSrc from 'public/icons/share.svg'; +import theme from '@styles/theme'; +import { EyeIcon, EyeIconSlashed } from '../iconsComponents/icons/eyeIcon'; +import ProfilIcon from '../iconsComponents/icons/profilIcon'; +import Link from 'next/link'; +import SocialMediaActions from '../actions/socialmediaActions'; +import { getTweetLink } from '@utils/browserService'; +import { hexToDecimal } from '@utils/feltService'; +import { TEXT_TYPE } from '@constants/typography'; +import Typography from '../typography/typography'; +import { calculateTotalBalance } from '../../../services/argentPortfolioService'; +import { useHidePortfolio } from '@hooks/useHidePortfolio'; const MAX_RETRIES = 1000; const RETRY_DELAY = 2000; @@ -55,7 +55,7 @@ const ProfileCard: FunctionComponent = ({ const formattedAddress = useMemo( () => - (identity.owner.startsWith("0x") + (identity.owner.startsWith('0x') ? identity.owner : `0x${address}`) as Address, [identity.owner] @@ -64,8 +64,8 @@ const ProfileCard: FunctionComponent = ({ const { data: profileData } = useStarkProfile({ address: formattedAddress }); const rankFormatter = useCallback((rank: number) => { - if (rank > 10000) return "+10k"; - if (rank > 5000) return "+5k"; + if (rank > 10000) return '+10k'; + if (rank > 5000) return '+5k'; return rank; }, []); @@ -74,7 +74,7 @@ const ProfileCard: FunctionComponent = ({ let attempts = 0; while (true) { try { - const balance = await calculateTotalBalance(formattedAddress, "USD", { + const balance = await calculateTotalBalance(formattedAddress, 'USD', { signal, }); setTotalBalance(balance); @@ -88,7 +88,7 @@ const ProfileCard: FunctionComponent = ({ if (attempts >= MAX_RETRIES) { console.error( - "Failed to fetch total balance after multiple attempts." + 'Failed to fetch total balance after multiple attempts.' ); } else { await new Promise((resolve) => setTimeout(resolve, RETRY_DELAY)); @@ -125,7 +125,7 @@ const ProfileCard: FunctionComponent = ({ const tweetShareLink: string = useMemo(() => { return `${getTweetLink( - `Check out${isOwner ? " my " : " "}Starknet Quest Profile at ${ + `Check out${isOwner ? ' my ' : ' '}Starknet Quest Profile at ${ window.location.href } #Starknet #StarknetID` )}`; @@ -154,13 +154,13 @@ const ProfileCard: FunctionComponent = ({ color='secondary' className={styles.accountCreationDate} > - {sinceDate ? `${sinceDate}` : ""} + {sinceDate ? `${sinceDate}` : ''} - {identity.domain?.domain || "Unknown Domain"} + {identity.domain?.domain || 'Unknown Domain'}
@@ -170,7 +170,7 @@ const ProfileCard: FunctionComponent = ({ > {totalBalance !== null ? ( hidePortfolio ? ( - "******" + '******' ) : ( `$${totalBalance.toFixed(2)}` ) @@ -254,7 +254,7 @@ const ProfileCard: FunctionComponent = ({ > {leaderboardData.position ? rankFormatter(leaderboardData.position) - : "NA"} + : 'NA'}
)} @@ -271,7 +271,7 @@ const ProfileCard: FunctionComponent = ({ type={TEXT_TYPE.BODY_SMALL} className={styles.statsText} > - {userXp ?? "0"} + {userXp ?? '0'}
)}