fix: drive bottom nav from module registry so all modules appear on mobile
Release / build-and-push (push) Has been cancelled
Release / build-and-push (push) Has been cancelled
The bottom nav was hardcoded; the sidebar already read from the module registry. Converted BottomNav to a server component that calls getRegistry() using the same pattern as Sidebar, so any module with a nav field automatically populates both nav surfaces. Bumps version to 0.4.2.
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "famapp",
|
"name": "famapp",
|
||||||
"version": "0.4.0",
|
"version": "0.4.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"packageManager": "pnpm@10.33.3",
|
"packageManager": "pnpm@10.33.3",
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
"use client";
|
import { getRegistry } from "@/modules/_core/registry";
|
||||||
|
|
||||||
import { NavLink } from "@/components/nav-link";
|
import { NavLink } from "@/components/nav-link";
|
||||||
|
|
||||||
const ITEMS: Array<{ href: string; label: string; icon: string }> = [
|
export async function BottomNav() {
|
||||||
|
const { modules } = getRegistry();
|
||||||
|
const moduleNav = modules.flatMap((m) => (m.nav ? [m.nav] : []));
|
||||||
|
|
||||||
|
const items = [
|
||||||
{ href: "/", label: "Dashboard", icon: "home" },
|
{ href: "/", label: "Dashboard", icon: "home" },
|
||||||
{ href: "/calendar", label: "Calendar", icon: "calendar" },
|
...moduleNav.map((n) => ({ href: n.href, label: n.label, icon: n.icon ?? "circle" })),
|
||||||
{ href: "/lists", label: "Lists", icon: "list" },
|
|
||||||
{ href: "/notes", label: "Notes", icon: "note" },
|
|
||||||
{ href: "/settings", label: "Settings", icon: "settings" },
|
{ href: "/settings", label: "Settings", icon: "settings" },
|
||||||
];
|
];
|
||||||
|
|
||||||
export function BottomNav() {
|
|
||||||
return (
|
return (
|
||||||
<nav className="bottom-nav" aria-label="Primary navigation">
|
<nav className="bottom-nav" aria-label="Primary navigation">
|
||||||
{ITEMS.map((it) => (
|
{items.map((it) => (
|
||||||
<NavLink key={it.href} href={it.href} icon={it.icon} label={it.label} variant="bottom" />
|
<NavLink key={it.href} href={it.href} icon={it.icon} label={it.label} variant="bottom" />
|
||||||
))}
|
))}
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
Reference in New Issue
Block a user