Files
co-lite/solvway-customer-portal/app/components/BottomNav.tsx
T
ngqileandClaude Opus 5.5 5ee51d1913 chore: copy kept Tastefully modules and portals into Co-Lite
Backend modules from tastefully 8bd93d15: core-libs, core-session,
api-gateway, mobile-api, services-auth, services-system,
services-counter, services-member, services-log, services-email.
solvway-admin-portal from babyboo f64d096ea, solvway-customer-portal
from tastefully 8bd93d15. Copied as tracked files only.

Literal secrets replaced with environment placeholders:
- services-email: SMTP_PASSWORD, MAILGUN_API_KEY, SENDGRID_API_KEY,
  MAILJET_API_KEY, MAILJET_SECRET_KEY (optional, empty default)
- services-system: JUMIO_TOKEN, JUMIO_SECRET (optional)
- services-auth: USER_AUTH_API_SECRET (required); commented JWT secret removed
- core-libs: JWT_TOKEN default removed (required), XXL_JOB_TOKEN default
  removed, ipgeolocation key read from IPGEOLOCATION_API_KEY
- services-system EkycAppConfig: commented Jumio credentials removed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
2026-11-26 15:55:45 +08:00

153 lines
5.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"use client";
import { motion, AnimatePresence } from "framer-motion";
import Link from "next/link";
import { usePathname, useRouter } from "next/navigation";
import { House, CalendarDays, ScanLine, Coins, UserCircle } from "lucide-react";
import { useTheme } from "@/app/lib/ThemeContext";
const MotionLink = motion(Link);
const LEFT_ITEMS = [
{ href: "/", icon: House, label: "Home" },
{ href: "/events", icon: CalendarDays, label: "Events" },
];
const RIGHT_ITEMS = [
{ href: "/store", icon: Coins, label: "Points" },
{ href: "/settings", icon: UserCircle, label: "Profile" },
];
const AUTH_PATHS = new Set(["/login", "/register", "/forgot-password", "/register/verify", "/reset-password"]);
export default function BottomNav() {
const pathname = usePathname();
const router = useRouter();
const { isDark } = useTheme();
if (AUTH_PATHS.has(pathname)) return null;
const isActive = (href: string) =>
href === "/" ? pathname === "/" : pathname === href || pathname.startsWith(href + "/");
const inactiveColor = isDark ? "rgba(255,255,255,0.65)" : "#6B6B6B";
const NavBtn = ({
href,
icon: Icon,
label,
}: {
href: string;
icon: typeof House;
label: string;
}) => {
const active = isActive(href);
return (
<MotionLink
href={href}
whileTap={{ scale: 0.86 }}
transition={{ type: "spring", stiffness: 500, damping: 30 }}
className="relative flex flex-col items-center gap-0.5 flex-1 min-w-0 py-[8px]"
>
<AnimatePresence>
{active && (
<motion.div
layoutId="nav-pill"
className="absolute inset-x-2 inset-y-0.5 rounded-xl"
style={{ background: "rgba(255,107,0,0.10)" }}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ type: "spring", stiffness: 400, damping: 28 }}
/>
)}
</AnimatePresence>
<Icon
strokeWidth={active ? 2.2 : 1.6}
style={{
width: 20,
height: 20,
stroke: active ? "#FF6B00" : inactiveColor,
fill: active ? "rgba(255,107,0,0.15)" : "none",
filter: active ? "drop-shadow(0 0 6px rgba(255,107,0,0.45))" : "none",
transition: "all 0.2s ease",
}}
/>
{/* Scales with the device font up to 20px, then holds: four labels must still fit beside
the check-in button on a 390px screen at 150–200% text. Line-height is unitless so
it does not re-balloon with the root font size. */}
<span
className="font-semibold relative whitespace-nowrap text-[length:min(0.875rem,20px)] leading-[1.2]"
style={{
color: active ? "var(--orange-text)" : inactiveColor,
transition: "color 0.2s ease",
}}
>
{label}
</span>
</MotionLink>
);
};
return (
<nav
className="absolute bottom-0 left-0 right-0 z-50 pb-[env(safe-area-inset-bottom)]"
style={{
background: isDark ? "rgba(10,10,10,0.95)" : "rgba(255,255,255,0.94)",
backdropFilter: "blur(24px)",
WebkitBackdropFilter: "blur(24px)",
borderTop: `1px solid ${isDark ? "rgba(255,255,255,0.06)" : "rgba(0,0,0,0.07)"}`,
}}
>
{/* min-h (px) not h-16 (rem): the bar follows its content and no longer grows to ~130px at 200% text. */}
<div className="flex items-center min-h-[64px] px-2">
{/* Left items */}
<div className="flex flex-1">
{LEFT_ITEMS.map((item) => (
<NavBtn key={item.href} {...item} />
))}
</div>
{/* Center QR scanner FAB — elevated above the bar */}
<div className="relative w-[64px] flex justify-center flex-shrink-0">
<div className="absolute -top-16">
<motion.button
onClick={() => router.push("/checkin")}
aria-label="Scan QR to check in"
whileTap={{ scale: 0.9 }}
whileHover={{ scale: 1.06 }}
transition={{ type: "spring", stiffness: 420, damping: 24 }}
className="relative w-[64px] h-[64px] md:w-[80px] md:h-[80px] rounded-full flex items-center justify-center"
style={{
background:
"linear-gradient(135deg, #FF6B00 0%, #f1c28cff 100%)",
boxShadow:
"0 -4px 20px rgba(255,107,0,0.45), 0 0 32px rgba(41,10,129,0.3), 0 4px 16px rgba(0,0,0,0.25)",
}}
>
{/* Pulse ring */}
<motion.div
animate={{ scale: [1, 1.35, 1], opacity: [0.5, 0, 0.5] }}
transition={{ repeat: Infinity, duration: 2.4, ease: "easeInOut" }}
className="absolute inset-0 rounded-full"
style={{ border: "2px solid rgba(255,107,0,0.5)" }}
/>
<ScanLine
strokeWidth={2}
className="w-[32px] h-[32px] stroke-white relative z-10"
/>
</motion.button>
</div>
</div>
{/* Right items */}
<div className="flex flex-1">
{RIGHT_ITEMS.map((item) => (
<NavBtn key={item.href} {...item} />
))}
</div>
</div>
</nav>
);
}