fix low level issues
This commit is contained in:
@@ -120,7 +120,17 @@
|
||||
return el;
|
||||
}
|
||||
|
||||
onDestroy(() => map?.remove());
|
||||
onDestroy(() => {
|
||||
resizeObserver?.disconnect();
|
||||
map?.remove();
|
||||
});
|
||||
|
||||
let resizeObserver: ResizeObserver;
|
||||
$: if (mapEl && map) {
|
||||
resizeObserver?.disconnect();
|
||||
resizeObserver = new ResizeObserver(() => map?.resize());
|
||||
resizeObserver.observe(mapEl);
|
||||
}
|
||||
</script>
|
||||
|
||||
<div bind:this={mapEl} class="w-full h-full"></div>
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
import RecordsView from './RecordsView.svelte';
|
||||
import AthleteDrawer from './AthleteDrawer.svelte';
|
||||
|
||||
export let base: string = '/';
|
||||
|
||||
let athlete: AthleteJson | null = null;
|
||||
let activities: ActivitySummary[] = [];
|
||||
let loading = true;
|
||||
@@ -106,7 +108,7 @@
|
||||
|
||||
<!-- Records tab -->
|
||||
{:else if activeTab === 'records'}
|
||||
<RecordsView {athlete} />
|
||||
<RecordsView {athlete} {base} />
|
||||
|
||||
<!-- Profile tab -->
|
||||
{:else if activeTab === 'profile'}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import { formatDate, sportIcon, sportColor } from '../lib/format';
|
||||
|
||||
export let athlete: AthleteJson;
|
||||
export let base: string = '/';
|
||||
|
||||
// ── Distance label formatting ──────────────────────────────────────────────
|
||||
function distLabel(km: number): string {
|
||||
@@ -96,7 +97,7 @@
|
||||
return (athlete as any).records?.[sport]?.[key] ?? null;
|
||||
}
|
||||
|
||||
const activityUrl = (id: string) => `/activity/${id}/`;
|
||||
const activityUrl = (id: string) => `${base}activity/${id}/`;
|
||||
</script>
|
||||
|
||||
<!-- Sport tabs -->
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
let sport: Sport | 'all' = 'all';
|
||||
let page = 0;
|
||||
let loading = true;
|
||||
let error = '';
|
||||
let theme = 'dark';
|
||||
let mounted = false;
|
||||
|
||||
@@ -28,9 +29,14 @@
|
||||
sport = (params.get('sport') as Sport | 'all') ?? 'all';
|
||||
page = parseInt(params.get('page') ?? '0', 10) || 0;
|
||||
mounted = true;
|
||||
const res = await fetch(`${import.meta.env.BASE_URL}data/index.json`);
|
||||
const index: BASIndex = await res.json();
|
||||
all = index.activities.filter(a => a.privacy !== 'private' && a.distance_m);
|
||||
try {
|
||||
const res = await fetch(`${import.meta.env.BASE_URL}data/index.json`);
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||
const index: BASIndex = await res.json();
|
||||
all = index.activities.filter(a => a.privacy !== 'private' && a.distance_m);
|
||||
} catch (e: any) {
|
||||
error = e.message;
|
||||
}
|
||||
loading = false;
|
||||
|
||||
theme = document.documentElement.getAttribute('data-theme') ?? 'dark';
|
||||
@@ -282,6 +288,8 @@
|
||||
|
||||
{#if loading}
|
||||
<div class="h-64 rounded-xl bg-zinc-800 animate-pulse mb-6"></div>
|
||||
{:else if error}
|
||||
<p class="text-red-400 text-sm mt-4">{error}</p>
|
||||
{:else}
|
||||
|
||||
<!-- Pagination controls -->
|
||||
|
||||
Reference in New Issue
Block a user