fix: athlete page shows empty state instead of error when athlete.json missing

This commit is contained in:
Davide Scaini
2026-04-10 15:35:41 +02:00
parent 8d8b009a78
commit f790deb54f
+12 -3
View File
@@ -42,8 +42,7 @@
loadAthlete(import.meta.env.BASE_URL, athleteUrl || undefined),
loadIndex(import.meta.env.BASE_URL, indexUrl || undefined),
]);
if (!athleteData) throw new Error('athlete.json not found — run bincio extract first');
athlete = athleteData;
athlete = athleteData as AthleteJson | null;
activities = index.activities.filter(a => a.mmp && a.privacy !== 'private');
} catch (e: any) {
error = e.message;
@@ -78,7 +77,17 @@
<p class="text-zinc-400 text-sm">Loading…</p>
{:else if error}
<p class="text-red-400 text-sm">{error}</p>
{:else if athlete}
{:else if !athlete}
<div class="text-zinc-400 text-sm space-y-3">
<p>No athlete profile yet.</p>
{#if editEnabled}
<button
on:click={() => drawerOpen = true}
class="px-3 py-1.5 text-xs border border-zinc-700 hover:border-zinc-500 text-zinc-400 hover:text-white rounded-md transition-colors"
>Create profile</button>
{/if}
</div>
{:else}
<!-- Header row: tabs + edit button -->
<div class="flex items-center justify-between mb-6 border-b border-zinc-800 pb-0">