-
Notifications
You must be signed in to change notification settings - Fork 143
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
Update profileCard.tsx #942
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ import Typography from "../typography/typography"; | |
import { calculateTotalBalance } from "../../../services/argentPortfolioService"; | ||
import Avatar from "../avatar"; | ||
import { useHidePortfolio } from "@hooks/useHidePortfolio"; | ||
import Loading from "@components/skeletons/loading"; | ||
|
||
const MAX_RETRIES = 1000; | ||
const RETRY_DELAY = 2000; | ||
|
@@ -36,6 +37,7 @@ type ProfileCardProps = { | |
identity: Identity; | ||
leaderboardData: LeaderboardToppersData; | ||
isOwner: boolean; | ||
isLoading:boolean; | ||
}; | ||
|
||
const ProfileCard: FunctionComponent<ProfileCardProps> = ({ | ||
|
@@ -122,6 +124,21 @@ const ProfileCard: FunctionComponent<ProfileCardProps> = ({ | |
</div> | ||
|
||
<div className="flex flex-col h-full justify-center"> | ||
{totalBalance === null ? ( // Check if balance is still loading | ||
<> | ||
//Updated the Specific Profile Card Component with skeleton Loading component | ||
<Skeleton variant="text" width="80%" height={20} /> | ||
<Skeleton variant="text" width="60%" height={30} className="mt-2" /> | ||
<div className={styles.address_div}> | ||
<div className="flex items-center gap-2"> | ||
<Skeleton variant="rectangular" width={100} height={30} /> | ||
<EyeIcon /> | ||
</div> | ||
</div> | ||
</> | ||
) : ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Improve loading state implementation Several issues to address in the loading state implementation:
Apply these improvements: - {totalBalance === null ? ( // Check if balance is still loading
+ {isLoading ? (
<>
- //Updated the Specific Profile Card Component with skeleton Loading component
+ {/* Profile information loading state */}
<Skeleton
+ aria-label="Loading profile name"
variant="text"
width="80%"
height={20}
/>
<Skeleton
+ aria-label="Loading balance"
variant="text"
width="60%"
height={30}
className="mt-2"
/>
<div className={styles.address_div}>
<div className="flex items-center gap-2">
<Skeleton
+ aria-label="Loading address"
variant="rectangular"
width={100}
height={30}
/>
<EyeIcon />
</div>
</div>
</>
🧰 Tools🪛 Biome[error] 129-129: Wrap comments inside children within braces. Unsafe fix: Wrap the comments with braces (lint/suspicious/noCommentText) |
||
<> | ||
|
||
<Typography | ||
type={TEXT_TYPE.BODY_SMALL} | ||
color="secondary" | ||
|
@@ -151,7 +168,8 @@ const ProfileCard: FunctionComponent<ProfileCardProps> = ({ | |
{hidePortfolio ? <EyeIconSlashed /> : <EyeIcon />} | ||
</div> | ||
</div> | ||
</div> | ||
</> | ||
)} | ||
<div className="flex sm:hidden justify-center py-4"> | ||
<SocialMediaActions identity={identity} /> | ||
{tweetShareLink && ( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add missing isLoading prop to component parameters
The
isLoading
prop is defined inProfileCardProps
but not included in the component's parameter destructuring. This makes the prop inaccessible within the component.Apply this fix:
const ProfileCard: FunctionComponent<ProfileCardProps> = ({ rankingData, identity, leaderboardData, isOwner, + isLoading, }) => {
Also applies to: 44-48
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You add is Loading to the component props but you don't add it where the component is used + you unforce it.
Please test the stuff you send before a PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fricoben, thank you for pointing this out. You're absolutely correct; the
isLoading
prop was added to theProfileCard
component but wasn't included where the component is used. To fix this, please ensure thatisLoading
is passed as a prop in all instances whereProfileCard
is instantiated.For example:
Additionally, it's important to thoroughly test your changes before submitting a PR to avoid such oversights.