Fix 1 — new user pages 404 (server.py:228):

After registration creates the user's directories, it now calls _write_root_manifest(dd). This rewrites index.json to include the new handle's shard immediately. Since Astro dev re-evaluates getStaticPaths() on every request (reading that file), /u/pres/, /u/pres/stats/, and /u/pres/athlete/ will resolve correctly as soon as the new user navigates there.

  Fix 2 — invites link (athlete/index.astro:33):
  Added an Invites button (top-right, same style as "Edit profile") that starts hidden. When bincio:me fires and me === handle (you're on your own page), the subnav tabs are removed as before AND the invites button is revealed. Other visitors see neither.
This commit is contained in:
Davide Scaini
2026-04-09 21:44:38 +02:00
parent 084c652fdd
commit cbac82a2ba
2 changed files with 23 additions and 7 deletions
+5
View File
@@ -229,6 +229,11 @@ async def register(request: Request) -> JSONResponse:
(dd / handle / "activities").mkdir(parents=True, exist_ok=True)
(dd / handle / "edits").mkdir(parents=True, exist_ok=True)
# Update root manifest so the new user's shard is discoverable immediately
# (Astro dev re-evaluates getStaticPaths() on each request from this file)
from bincio.render.cli import _write_root_manifest
_write_root_manifest(dd)
token = create_session(_get_db(), handle)
resp = JSONResponse({"ok": True, "handle": handle})
_set_session_cookie(resp, token)
+18 -7
View File
@@ -21,18 +21,29 @@ const athleteUrl = `${mergedBase}athlete.json`;
---
<Base title={`@${handle} Athlete — BincioActivity`}>
<div class="max-w-5xl mx-auto px-4 pt-6 pb-2">
<h1 class="text-2xl font-bold text-white mb-0.5">@{handle}</h1>
<nav id="profile-subnav" class="flex gap-4 mt-1 mb-6">
<a href={`${base}u/${handle}/`} class="text-sm text-zinc-400 hover:text-white transition-colors">Feed</a>
<a href={`${base}u/${handle}/stats/`} class="text-sm text-zinc-400 hover:text-white transition-colors">Stats</a>
<a href={`${base}u/${handle}/athlete/`} class="text-sm text-[--accent]">Athlete</a>
</nav>
<div class="flex items-start justify-between">
<div>
<h1 class="text-2xl font-bold text-white mb-0.5">@{handle}</h1>
<nav id="profile-subnav" class="flex gap-4 mt-1 mb-6">
<a href={`${base}u/${handle}/`} class="text-sm text-zinc-400 hover:text-white transition-colors">Feed</a>
<a href={`${base}u/${handle}/stats/`} class="text-sm text-zinc-400 hover:text-white transition-colors">Stats</a>
<a href={`${base}u/${handle}/athlete/`} class="text-sm text-[--accent]">Athlete</a>
</nav>
</div>
<a id="invites-btn" href={`${base}invites/`}
class="hidden mt-1 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">
Invites
</a>
</div>
</div>
<AthleteView {base} {indexUrl} {athleteUrl} client:only="svelte" />
</Base>
<script define:vars={{ handle }}>
function applyMeCheck(me) {
if (me === handle) document.getElementById('profile-subnav')?.remove();
if (me === handle) {
document.getElementById('profile-subnav')?.remove();
document.getElementById('invites-btn')?.classList.remove('hidden');
}
}
if (window.__bincioMe !== undefined) {
applyMeCheck(window.__bincioMe);