Optimize navigation links

This commit is contained in:
dtonon 2026-05-20 23:29:02 +01:00
parent 346a5a0005
commit fb8a8b2224
4 changed files with 50 additions and 14 deletions

View file

@ -53,12 +53,22 @@
let mobileView = $state<"forum" | "chat">("forum");
// Room pages highlight via their slug; thread pages highlight the room the
// thread belongs to (tracked in activeGroup).
// thread belongs to (tracked in activeGroup). Scoped to those routes so a
// resource slug (same [slug] param name) never highlights a room.
const activeRoom = $derived(
page.params.slug ??
(page.url.pathname.startsWith("/thread/") ? activeGroup.id : ""),
page.url.pathname.startsWith("/room/")
? (page.params.slug ?? "")
: page.url.pathname.startsWith("/thread/")
? activeGroup.id
: "",
);
// Resource pages highlight the open article in the Resources menu.
const activeResource = $derived(
page.url.pathname.startsWith("/resource/") ? (page.params.slug ?? "") : "",
);
const contactsActive = $derived(page.url.pathname === "/contacts");
// Article pages (both modes) and the full-mode landing have no single room to
// chat in, so they render the latest-discussions panel instead of room chat.
// The simple-mode home keeps its room chat, like every full-mode room.
@ -93,7 +103,7 @@
? 'flex flex-1 overflow-hidden'
: ''}"
>
<LeftSidebar {mode} {activeRoom} />
<LeftSidebar {mode} {activeRoom} {activeResource} {contactsActive} />
<main
class="min-h-[calc(100dvh_-_4rem)] bg-white px-6 pt-8 pb-20 shadow-lg md:min-h-0 md:overflow-y-auto md:rounded-t-xl md:px-10 md:pt-6 {showDiscussions
? 'md:flex-[3]'
@ -181,6 +191,8 @@
onClose={() => (menuOpen = false)}
{mode}
{activeRoom}
{activeResource}
{contactsActive}
/>
<LoginModal />