Skip to content

Commit a11a531

Browse files
committed
Update: social preview image & discord link check
1 parent 4380e11 commit a11a531

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta charset="UTF-8" />
66
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
77
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
8-
<title>TradingGoose AI - Multi-Agent Trading System</title>
8+
<title>TradingGoose - Multi-Agent Trading System</title>
99
<meta name="description"
1010
content="AI-powered trading system with 11 specialized agents for comprehensive market analysis" />
1111
<meta name="author" content="TradingGoose" />
@@ -14,11 +14,11 @@
1414
<meta property="og:description"
1515
content="AI-powered trading system with 11 specialized agents for comprehensive market analysis" />
1616
<meta property="og:type" content="website" />
17-
<meta property="og:image" content="/favicon.ico" />
17+
<meta property="og:image" content="/Social-Preview.png" />
1818

1919
<meta name="twitter:card" content="summary_large_image" />
2020
<meta name="twitter:site" content="@tradinggoose" />
21-
<meta name="twitter:image" content="/favicon.ico" />
21+
<meta name="twitter:image" content="/Social-Preview.png" />
2222

2323
<!-- GitHub Pages SPA redirect handling -->
2424
<script type="text/javascript">

src/pages/Profile.tsx

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export default function ProfilePage() {
7070
const [isLinking, setIsLinking] = useState(false);
7171
const [isSyncing, setIsSyncing] = useState(false);
7272
const [discordIdentity, setDiscordIdentity] = useState<any>(null);
73+
const [hasDiscordConnection, setHasDiscordConnection] = useState(false);
7374

7475
const handleSendResetEmail = async () => {
7576
if (!user?.email) return;
@@ -212,13 +213,17 @@ export default function ProfilePage() {
212213
if (!user) return;
213214

214215
try {
215-
// Get user's linked identities
216+
// Check both auth identities and profile discord_id
216217
const { data: identities, error } = await supabase.auth.getUserIdentities();
217218

218219
if (!error && identities) {
219220
const discord = identities.identities?.find((id: any) => id.provider === 'discord');
220221
setDiscordIdentity(discord);
221222

223+
// Update connection status based on both checks
224+
const isConnected = !!(discord || profile?.discord_id);
225+
setHasDiscordConnection(isConnected);
226+
222227
// If user has Discord linked, ensure the Discord ID is saved
223228
if (discord && discord.provider_id) {
224229
// First try to call the sync function to ensure Discord ID is saved
@@ -267,14 +272,18 @@ export default function ProfilePage() {
267272
}
268273
}
269274
}
275+
} else {
276+
// Even if no Discord in auth identities, check if profile has discord_id
277+
const isConnected = !!profile?.discord_id;
278+
setHasDiscordConnection(isConnected);
270279
}
271280
} catch (error) {
272281
console.error('Error fetching Discord identity:', error);
273282
}
274283
};
275284

276285
fetchDiscordIdentity();
277-
}, [user]);
286+
}, [user, profile?.discord_id]);
278287

279288
// Check for #link_discord hash and initiate linking
280289
useEffect(() => {
@@ -483,8 +492,8 @@ export default function ProfilePage() {
483492
try {
484493
console.log('Starting Discord role sync for user:', user.id);
485494

486-
// Check if user has Discord linked
487-
if (!profile?.discord_id) {
495+
// Check if user has Discord linked (either auth identity or profile discord_id)
496+
if (!hasDiscordConnection) {
488497
toast({
489498
title: "Discord Not Connected",
490499
description: "Please connect your Discord account first",
@@ -934,7 +943,7 @@ export default function ProfilePage() {
934943
<p className="text-xs text-muted-foreground">Connect for community features</p>
935944
</div>
936945
</div>
937-
{discordIdentity ? (
946+
{hasDiscordConnection ? (
938947
<Badge className="border border-green-500/30 bg-green-500/10 text-green-600 dark:text-green-400 font-semibold hover:bg-green-500/20 hover:border-green-500/40 transition-colors cursor-default">
939948
<span className="flex items-center gap-1">
940949
<CheckCircle className="h-3 w-3" />
@@ -951,7 +960,7 @@ export default function ProfilePage() {
951960
)}
952961
</div>
953962

954-
{!discordIdentity ? (
963+
{!hasDiscordConnection ? (
955964
<div className="space-y-3">
956965
<p className="text-sm text-muted-foreground">
957966
Link your Discord account to sync roles and access exclusive channels in our community server.

0 commit comments

Comments
 (0)