Skip to content

Commit dfcc0ca

Browse files
committed
update: implemented the initials fallback for profiles without avatars
1 parent 0039510 commit dfcc0ca

2 files changed

Lines changed: 52 additions & 40 deletions

File tree

frontend/src/app/profile/[username]/page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ export default async function ProfilePage({ params }: PageProps) {
107107
bio={profile.bio}
108108
walletAddress={profile.walletAddress}
109109
acceptedAssets={profile.acceptedAssets}
110+
avatarUrl={profile.avatarUrl || undefined}
110111
/>
111112

112113
<div className="px-2">

frontend/src/components/profile-card.tsx

Lines changed: 51 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ type ProfileCardProps = {
1313
bio: string;
1414
walletAddress: string;
1515
acceptedAssets: Asset[];
16+
avatarUrl?: string;
1617
email?: string;
1718
websiteUrl?: string;
1819
twitterHandle?: string;
@@ -25,6 +26,7 @@ export function ProfileCard({
2526
bio,
2627
walletAddress,
2728
acceptedAssets,
29+
avatarUrl,
2830
email,
2931
websiteUrl,
3032
twitterHandle,
@@ -45,48 +47,57 @@ export function ProfileCard({
4547
return (
4648
<article className="rounded-[2rem] border border-white/10 bg-white/[0.04] p-5 sm:p-7 shadow-xl shadow-black/15">
4749
<div className="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
48-
<div>
49-
<p className="text-xs uppercase tracking-[0.3em] text-mint">@{username}</p>
50-
<h1 className="mt-3 text-2xl sm:text-3xl font-semibold text-white">{displayName}</h1>
51-
<p className="mt-4 max-w-2xl text-sm sm:text-base leading-relaxed sm:leading-7 text-sky/80">{bio}</p>
52-
53-
{hasSocialLinks && (
54-
<div className="mt-4 flex flex-wrap gap-3">
55-
{websiteUrl && (
56-
<a
57-
href={websiteUrl}
58-
target="_blank"
59-
rel="noreferrer"
60-
className="text-xs text-sky/70 hover:text-mint transition"
61-
>
62-
🌐 Website
63-
</a>
64-
)}
65-
{twitterHandle && (
66-
<a
67-
href={`https://twitter.com/${twitterHandle}`}
68-
target="_blank"
69-
rel="noreferrer"
70-
className="text-xs text-sky/70 hover:text-mint transition"
71-
>
72-
𝕏 @{twitterHandle}
73-
</a>
74-
)}
75-
{githubHandle && (
76-
<a
77-
href={`https://github.com/${githubHandle}`}
78-
target="_blank"
79-
rel="noreferrer"
80-
className="text-xs text-sky/70 hover:text-mint transition"
81-
>
82-
GitHub
83-
</a>
84-
)}
85-
{email && (
86-
<span className="text-xs text-sky/50">{email}</span>
87-
)}
50+
<div className="flex gap-4">
51+
{avatarUrl ? (
52+
<img src={avatarUrl} alt={displayName} className="w-16 h-16 rounded-full object-cover" />
53+
) : (
54+
<div className="w-16 h-16 rounded-full bg-indigo-600 flex items-center justify-center text-white text-xl font-bold">
55+
{displayName.slice(0, 2).toUpperCase()}
8856
</div>
8957
)}
58+
<div>
59+
<p className="text-xs uppercase tracking-[0.3em] text-mint">@{username}</p>
60+
<h1 className="mt-3 text-2xl sm:text-3xl font-semibold text-white">{displayName}</h1>
61+
<p className="mt-4 max-w-2xl text-sm sm:text-base leading-relaxed sm:leading-7 text-sky/80">{bio}</p>
62+
63+
{hasSocialLinks && (
64+
<div className="mt-4 flex flex-wrap gap-3">
65+
{websiteUrl && (
66+
<a
67+
href={websiteUrl}
68+
target="_blank"
69+
rel="noreferrer"
70+
className="text-xs text-sky/70 hover:text-mint transition"
71+
>
72+
🌐 Website
73+
</a>
74+
)}
75+
{twitterHandle && (
76+
<a
77+
href={`https://twitter.com/${twitterHandle}`}
78+
target="_blank"
79+
rel="noreferrer"
80+
className="text-xs text-sky/70 hover:text-mint transition"
81+
>
82+
𝕏 @{twitterHandle}
83+
</a>
84+
)}
85+
{githubHandle && (
86+
<a
87+
href={`https://github.com/${githubHandle}`}
88+
target="_blank"
89+
rel="noreferrer"
90+
className="text-xs text-sky/70 hover:text-mint transition"
91+
>
92+
GitHub
93+
</a>
94+
)}
95+
{email && (
96+
<span className="text-xs text-sky/50">{email}</span>
97+
)}
98+
</div>
99+
)}
100+
</div>
90101
</div>
91102
<div className="w-full sm:w-auto mt-4 sm:mt-0 rounded-3xl border border-mint/20 bg-ink/50 px-4 py-3 text-sm text-sky/80">
92103
<p className="font-semibold text-white">Stellar Wallet</p>

0 commit comments

Comments
 (0)