Skip to content

Commit

Permalink
resovled profileCard.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
caxtonacollins committed Nov 12, 2024
1 parent 99bb4e1 commit 85d221f
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions components/UI/profileCard/profileCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -55,7 +55,7 @@ const ProfileCard: FunctionComponent<ProfileCardProps> = ({

const formattedAddress = useMemo(
() =>
(identity.owner.startsWith("0x")
(identity.owner.startsWith('0x')
? identity.owner
: `0x${address}`) as Address,
[identity.owner]
Expand All @@ -64,8 +64,8 @@ const ProfileCard: FunctionComponent<ProfileCardProps> = ({
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;
}, []);

Expand All @@ -74,7 +74,7 @@ const ProfileCard: FunctionComponent<ProfileCardProps> = ({
let attempts = 0;
while (true) {
try {
const balance = await calculateTotalBalance(formattedAddress, "USD", {
const balance = await calculateTotalBalance(formattedAddress, 'USD', {
signal,
});
setTotalBalance(balance);
Expand All @@ -88,7 +88,7 @@ const ProfileCard: FunctionComponent<ProfileCardProps> = ({

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));
Expand Down Expand Up @@ -125,7 +125,7 @@ const ProfileCard: FunctionComponent<ProfileCardProps> = ({

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`
)}`;
Expand Down Expand Up @@ -154,13 +154,13 @@ const ProfileCard: FunctionComponent<ProfileCardProps> = ({
color='secondary'
className={styles.accountCreationDate}
>
{sinceDate ? `${sinceDate}` : ""}
{sinceDate ? `${sinceDate}` : ''}
</Typography>
<Typography
type={TEXT_TYPE.H2}
className={`${styles.profile_name} mt-2`}
>
{identity.domain?.domain || "Unknown Domain"}
{identity.domain?.domain || 'Unknown Domain'}
</Typography>
<div className={styles.address_div}>
<div className='flex items-center gap-2'>
Expand All @@ -170,7 +170,7 @@ const ProfileCard: FunctionComponent<ProfileCardProps> = ({
>
{totalBalance !== null ? (
hidePortfolio ? (
"******"
'******'
) : (
`$${totalBalance.toFixed(2)}`
)
Expand Down Expand Up @@ -254,7 +254,7 @@ const ProfileCard: FunctionComponent<ProfileCardProps> = ({
>
{leaderboardData.position
? rankFormatter(leaderboardData.position)
: "NA"}
: 'NA'}
</Typography>
</div>
)}
Expand All @@ -271,7 +271,7 @@ const ProfileCard: FunctionComponent<ProfileCardProps> = ({
type={TEXT_TYPE.BODY_SMALL}
className={styles.statsText}
>
{userXp ?? "0"}
{userXp ?? '0'}
</Typography>
</div>
)}
Expand Down

0 comments on commit 85d221f

Please sign in to comment.