Skip to content

Commit 7748637

Browse files
committed
update: added Twitter and copy-link share buttons to the profile page
1 parent e1ddf49 commit 7748637

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

frontend/src/components/profile-card.tsx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export function ProfileCard({
3333
githubHandle,
3434
}: ProfileCardProps) {
3535
const [copied, setCopied] = useState(false);
36+
const [linkCopied, setLinkCopied] = useState(false);
3637
const isValid = isValidStellarAddress(walletAddress);
3738
const hasSocialLinks = email || websiteUrl || twitterHandle || githubHandle;
3839

@@ -42,6 +43,19 @@ export function ProfileCard({
4243
setTimeout(() => setCopied(false), 2000);
4344
};
4445

46+
const profileUrl = typeof window !== 'undefined'
47+
? `${window.location.origin}/profile/${username}`
48+
: `https://novasupport.xyz/profile/${username}`;
49+
50+
const handleCopyLink = async () => {
51+
await navigator.clipboard.writeText(profileUrl);
52+
setLinkCopied(true);
53+
setTimeout(() => setLinkCopied(false), 2000);
54+
};
55+
56+
const tweetText = encodeURIComponent(`Support me on NovaSupport: ${profileUrl}`);
57+
const tweetUrl = `https://twitter.com/intent/tweet?text=${tweetText}`;
58+
4559
const expertUrl = `https://stellar.expert/explorer/testnet/account/${walletAddress}`;
4660

4761
return (
@@ -60,6 +74,24 @@ export function ProfileCard({
6074
<h1 className="mt-3 text-2xl sm:text-3xl font-semibold text-white">{displayName}</h1>
6175
<p className="mt-4 max-w-2xl text-sm sm:text-base leading-relaxed sm:leading-7 text-sky/80">{bio}</p>
6276

77+
{/* Share Buttons */}
78+
<div className="mt-4 flex flex-wrap gap-2">
79+
<button
80+
onClick={handleCopyLink}
81+
className="rounded-full border border-white/10 bg-white/5 px-4 py-2 text-xs font-medium text-white hover:bg-white/10 transition-colors"
82+
>
83+
{linkCopied ? '✓ Link copied!' : '🔗 Copy link'}
84+
</button>
85+
<a
86+
href={tweetUrl}
87+
target="_blank"
88+
rel="noopener noreferrer"
89+
className="rounded-full border border-white/10 bg-white/5 px-4 py-2 text-xs font-medium text-white hover:bg-white/10 transition-colors inline-block"
90+
>
91+
𝕏 Share on X
92+
</a>
93+
</div>
94+
6395
{hasSocialLinks && (
6496
<div className="mt-4 flex flex-wrap gap-3">
6597
{websiteUrl && (

0 commit comments

Comments
 (0)