Files
crosscode-platform/apps/app/frontend/src/components/TabBar.tsx
T
joshuaandClaude Opus 5.5 bb36e06fa4 app: the Church App's foundation; docs for Hub 2.26.1 and two years of devotionals
apps/app (not released; app@1.0.0 is built in slices, APP-1.0-PLAN §15):
- backend (Express, Prisma, pg-boss, as the Website): the Hub client
  (CCP-, product app, the active-member band in the heartbeat), links
  and church.changed, sign-in through Accounts (everyone a Member; 8 days
  renewed up to 90; every role only with 2FA; the first Owner from
  HUB_ADMIN_EMAIL), Accounts' user.updated/export/deleted, active members
  once a day, modules on and off, GET /api/v1/app. Migration init.
- frontend (Next.js 16): header, tab bar, footer, manifest and icons from
  the church profile, service worker, Add to home screen, Me, the admin's
  first dashboard.
- env.template.json, PM2 template, README, CHANGELOG, WHATS-NEW; 27 tests.

Docs: the Hub runs 2.26.1 with two years of Cross Code's devotionals; an
App gets 2 weeks, today included. HANDOVER lists the App's slices.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 00:20:07 +02:00

43 lines
1.9 KiB
TypeScript

"use client";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { BookOpen, CalendarDays, Flame, Home, UserRound } from "lucide-react";
import type { AppModule } from "@/lib/load";
/** The bottom tab bar (APP-1.0-PLAN §1, P18): Home, Prayer, Events, Devotional, Me; only what's on. */
const TABS = [
{ href: "/", label: "Home", icon: Home, module: null },
{ href: "/prayer", label: "Prayer", icon: Flame, module: "house-of-prayer" },
{ href: "/events", label: "Events", icon: CalendarDays, module: "events" },
{ href: "/devotional", label: "Devotional", icon: BookOpen, module: "devotionals" },
{ href: "/me", label: "Me", icon: UserRound, module: null },
] as const;
export function TabBar({ modules }: { modules: AppModule[] }) {
const path = usePathname();
const tabs = TABS.filter((t) => !t.module || modules.includes(t.module));
return (
<nav aria-label="Main" className="fixed inset-x-0 bottom-0 z-20 border-t border-gray-200 bg-white pb-[env(safe-area-inset-bottom)]">
<ul className="mx-auto flex h-16 max-w-xl">
{tabs.map((t) => {
const current = t.href === "/" ? path === "/" : path === t.href || path.startsWith(`${t.href}/`);
const Icon = t.icon;
return (
<li key={t.href} className="flex-1">
<Link
href={t.href}
aria-current={current ? "page" : undefined}
className={`flex h-full flex-col items-center justify-center gap-0.5 text-xs font-medium focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-brand ${current ? "text-brand-text" : "text-gray-600 hover:text-gray-900"}`}
>
<Icon aria-hidden className="h-5 w-5" strokeWidth={current ? 2.4 : 1.8} />
{t.label}
</Link>
</li>
);
})}
</ul>
</nav>
);
}