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:
@@ -229,6 +229,11 @@ async def register(request: Request) -> JSONResponse:
|
|||||||
(dd / handle / "activities").mkdir(parents=True, exist_ok=True)
|
(dd / handle / "activities").mkdir(parents=True, exist_ok=True)
|
||||||
(dd / handle / "edits").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)
|
token = create_session(_get_db(), handle)
|
||||||
resp = JSONResponse({"ok": True, "handle": handle})
|
resp = JSONResponse({"ok": True, "handle": handle})
|
||||||
_set_session_cookie(resp, token)
|
_set_session_cookie(resp, token)
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ const athleteUrl = `${mergedBase}athlete.json`;
|
|||||||
---
|
---
|
||||||
<Base title={`@${handle} Athlete — BincioActivity`}>
|
<Base title={`@${handle} Athlete — BincioActivity`}>
|
||||||
<div class="max-w-5xl mx-auto px-4 pt-6 pb-2">
|
<div class="max-w-5xl mx-auto px-4 pt-6 pb-2">
|
||||||
|
<div class="flex items-start justify-between">
|
||||||
|
<div>
|
||||||
<h1 class="text-2xl font-bold text-white mb-0.5">@{handle}</h1>
|
<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">
|
<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}/`} class="text-sm text-zinc-400 hover:text-white transition-colors">Feed</a>
|
||||||
@@ -28,11 +30,20 @@ const athleteUrl = `${mergedBase}athlete.json`;
|
|||||||
<a href={`${base}u/${handle}/athlete/`} class="text-sm text-[--accent]">Athlete</a>
|
<a href={`${base}u/${handle}/athlete/`} class="text-sm text-[--accent]">Athlete</a>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</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" />
|
<AthleteView {base} {indexUrl} {athleteUrl} client:only="svelte" />
|
||||||
</Base>
|
</Base>
|
||||||
<script define:vars={{ handle }}>
|
<script define:vars={{ handle }}>
|
||||||
function applyMeCheck(me) {
|
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) {
|
if (window.__bincioMe !== undefined) {
|
||||||
applyMeCheck(window.__bincioMe);
|
applyMeCheck(window.__bincioMe);
|
||||||
|
|||||||
Reference in New Issue
Block a user