feat: app shell, UI kit, data loading, recurring sync
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
23f3192cd0
commit
08f23f909f
14 files changed
+493
-7
No files matched your search
@@ -0,0 +1,56 @@
|
||||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { logoutAction } from "@/server/actions/auth";
|
||||
import { isActive } from "./nav";
|
||||
|
||||
const tab = "flex flex-1 flex-col items-center gap-0.5 py-2 text-[11px] font-medium";
|
||||
|
||||
export function MobileNav() {
|
||||
const pathname = usePathname();
|
||||
const [more, setMore] = useState(false);
|
||||
const color = (href: string) => (isActive(pathname, href) ? "text-accent" : "text-muted");
|
||||
|
||||
return (
|
||||
<>
|
||||
{more && (
|
||||
<div className="fixed inset-0 z-30 bg-black/20 md:hidden" onClick={() => setMore(false)}>
|
||||
<div className="absolute bottom-[72px] right-3 w-56 rounded-card border border-line bg-white p-2 shadow-lg">
|
||||
{[
|
||||
["/budgets", "◔ Budgets"],
|
||||
["/credits", "⌂ Crédits & charges"],
|
||||
["/reglages", "⚙ Réglages"],
|
||||
].map(([href, label]) => (
|
||||
<Link key={href} href={href} className="block rounded-lg px-3 py-2.5 font-medium hover:bg-page">
|
||||
{label}
|
||||
</Link>
|
||||
))}
|
||||
<span className="block px-3 py-2.5 text-gray-400">∿ Simulateur (bientôt)</span>
|
||||
<form action={logoutAction}>
|
||||
<button className="w-full rounded-lg px-3 py-2.5 text-left font-medium text-neg hover:bg-neg-soft">Déconnexion</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<nav className="fixed inset-x-0 bottom-0 z-40 flex items-end border-t border-line bg-white pb-[env(safe-area-inset-bottom)] md:hidden">
|
||||
<Link href="/" className={`${tab} ${color("/")}`}>
|
||||
<span className="text-lg">◧</span>Accueil
|
||||
</Link>
|
||||
<Link href="/operations" className={`${tab} ${color("/operations")}`}>
|
||||
<span className="text-lg">≡</span>Opérations
|
||||
</Link>
|
||||
<Link href="/nouvelle" className="flex flex-1 justify-center py-1.5" aria-label="Nouvelle opération">
|
||||
<span className="grid h-12 w-12 place-items-center rounded-full bg-accent text-2xl text-white shadow-md">+</span>
|
||||
</Link>
|
||||
<Link href="/recurrents" className={`${tab} ${color("/recurrents")}`}>
|
||||
<span className="text-lg">↻</span>Récurrents
|
||||
</Link>
|
||||
<button type="button" onClick={() => setMore((v) => !v)} className={`${tab} text-muted`}>
|
||||
<span className="text-lg">⋯</span>Plus
|
||||
</button>
|
||||
</nav>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user