local activity storage and convert page fixes
- Replace rdp dependency with inline pure-Python RDP implementation
so the bincio wheel runs in Pyodide (no pure-Python wheel existed for rdp)
- Fix convert page script: remove define:vars so Vite bundles it and
TypeScript imports (localstore, format) work correctly
- Rename wheel to proper PEP 427 filename (bincio-0.1.0-py3-none-any.whl)
- Use en-GB date format on convert result, consistent with the feed
- Add /activity/local/ page + LocalActivityDetail for IDB-only activities;
feed links local activities there instead of the SSG route
- Fix getStaticPaths: try public/data symlink as fallback, never crash on
missing index.json
- Fix ActivityDetail.onMount: load detail even when detail_url is absent
so locally converted activities show map and charts
- Derive track_url and detail_url from id in toSummary() since they are
not present in the detail JSON
- Reload on bfcache restore (pageshow) so client:only components re-mount
after back navigation
This commit is contained in:
@@ -65,6 +65,12 @@ export async function listLocalActivities(): Promise<ActivitySummary[]> {
|
||||
return (await idbGet<ActivitySummary[]>('/data/local-index')) ?? [];
|
||||
}
|
||||
|
||||
/** Return the summary for a single locally-stored activity, or null. */
|
||||
export async function getLocalActivity(id: string): Promise<ActivitySummary | null> {
|
||||
const list = await listLocalActivities();
|
||||
return list.find(a => a.id === id) ?? null;
|
||||
}
|
||||
|
||||
/** Return true if at least one activity is stored locally. */
|
||||
export async function hasLocalActivities(): Promise<boolean> {
|
||||
const list = await listLocalActivities();
|
||||
@@ -83,7 +89,12 @@ const SUMMARY_KEYS = [
|
||||
] as const;
|
||||
|
||||
function toSummary(detail: Record<string, unknown>): ActivitySummary {
|
||||
return Object.fromEntries(
|
||||
const id = detail.id as string;
|
||||
const summary = Object.fromEntries(
|
||||
SUMMARY_KEYS.filter(k => k in detail).map(k => [k, detail[k]])
|
||||
);
|
||||
// These live in the index summary, not the detail JSON — derive from id
|
||||
if (!summary.detail_url) summary.detail_url = `activities/${id}.json`;
|
||||
if (!summary.track_url && detail.bbox) summary.track_url = `activities/${id}.geojson`;
|
||||
return summary;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user