Navigation: unfertige Bereiche ausblenden

Suche, Benachrichtigungen, Chats und Einstellungen sind noch Platzhalter und
erscheinen vorerst nicht in Seitenleiste, TabBar und Kopfleiste. Die Routen
bleiben bestehen; freigeschaltet wird über unfinished in Nav.tsx.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TiXsPUqw7oeomZ8wZrQW5q
This commit is contained in:
irrlicht
2026-10-10 11:50:21 +02:00
co-authored by Claude Opus 5.5
parent 66ae3ab975
commit 0cddf2b00f
3 changed files with 22 additions and 8 deletions
+10 -3
View File
@@ -6,19 +6,26 @@ import { useAuthChanged, useMe } from "./auth";
type Target = { title: string; icon?: ReactNode; to: string; end?: boolean };
// Bereiche, die es noch nicht gibt: Route und Platzhalter-Seite bestehen,
// in der Navigation sind sie bis dahin ausgeblendet.
const unfinished = new Set(["/search", "/notifications", "/chats", "/settings"]);
export const isReady = (to: string) => !unfinished.has(to);
// useMainTargets liefert die fünf wichtigsten Ziele (TabBar, Kopf der
// Seitenleiste). Das Profil zeigt angemeldet aufs eigene Profil, sonst auf
// /me mit dem Login.
function useMainTargets(): Target[] {
const me = useMe().data;
const profile = me ? `/u/${encodeURIComponent(me.username)}` : "/me";
return [
const targets: Target[] = [
{ title: "Feed", icon: <House className="icon" />, to: "/", end: true },
{ title: "Suche", icon: <Search className="icon" />, to: "/search" },
{ title: "Benachrichtigungen", icon: <Bell className="icon" />, to: "/notifications" },
{ title: "Chats", icon: <MessageSquare className="icon" />, to: "/chats" },
{ title: "Profil", icon: <User className="icon" />, to: profile },
];
return targets.filter((t) => isReady(t.to));
}
const moreTargets: Target[] = [
@@ -39,7 +46,7 @@ export function Sidebar({ open, onNavigate }: { open: boolean; onNavigate: () =>
const main = useMainTargets();
return (
<nav id="sidebar" className={open ? "open" : undefined} aria-label="Navigation">
<TargetList targets={[...main, ...moreTargets]} onNavigate={onNavigate} />
<TargetList targets={[...main, ...moreTargets.filter((t) => isReady(t.to))]} onNavigate={onNavigate} />
<TargetList targets={docs} onNavigate={onNavigate} />
<Logout onDone={onNavigate} />
</nav>
@@ -80,7 +87,7 @@ function Logout({ onDone }: { onDone: () => void }) {
);
}
// TabBar: mobil unten die fünf wichtigsten Ziele, nur Icons.
// TabBar: mobil unten die (bis zu) fünf wichtigsten Ziele, nur Icons.
export function TabBar() {
return (
<nav id="tabbar" aria-label="Hauptnavigation">