Files
tower/apps/web/app/my/member-nav.tsx
T
maaz519 205418fc4e feat: isolate all four portals with route groups + polished design system
Fix blank /org/login (and /admin/login): the guarded portal layout was
wrapping its own login route, rendering null when unauthenticated. Move
each portal's authed pages into a (authed)/(chapter) route group so login
pages live outside the guard.

Structure:
- app/(chapter)/* — chapter admin pages + guarded layout (was root-level)
- app/org/(authed)/* — org pages + guarded layout; /org/login now free
- app/admin/(authed)/* — admin pages + guarded layout; /admin/login free
- Root layout slimmed to providers only (no shared sidebar)
- Convert moved files' relative imports to @/app alias

Design system:
- PortalShell: shared sidebar shell (brand mark, themed active nav with
  accent bar, avatar dropdown user menu, loading skeletons)
- portal-theme.ts: per-portal theme tokens (violet/slate/blue/emerald)
- PortalLoginShell redesigned: two-column with gradient branding panel,
  dotted pattern, value-prop highlights, built-in back link
- New shadcn components: Avatar, DropdownMenu, Skeleton
- Move shared DraftCard to _components/draft-card.tsx (used by 2 portals)
- Portal selector: remove Super Admin card, icon tiles, hover lift
- All 4 login pages use react-hook-form + Zod + themed shell
- Member nav restored to full 11-section list with icons

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-20 18:20:06 +05:30

77 lines
3.0 KiB
TypeScript

'use client';
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import { cn } from '../_lib/utils';
import { Button } from '../_components/ui/button';
import { PORTAL_THEMES } from '../_components/portal-theme';
import {
LayoutDashboard, Newspaper, Calendar, HeartHandshake, Users2,
BookOpen, Sparkles, Images, Contact, Settings, LogOut,
} from 'lucide-react';
const NAV = [
{ href: '/my', label: 'Dashboard', icon: <LayoutDashboard /> },
{ href: '/my/digest', label: 'Digest', icon: <Newspaper /> },
{ href: '/my/ask', label: 'Ask AI', icon: <Sparkles /> },
{ href: '/my/events', label: 'Events', icon: <Calendar /> },
{ href: '/my/seva', label: 'Seva & Points', icon: <HeartHandshake /> },
{ href: '/my/circles', label: 'Circles', icon: <Users2 /> },
{ href: '/my/directory', label: 'Directory', icon: <Contact /> },
{ href: '/my/knowledge', label: 'Knowledge', icon: <BookOpen /> },
{ href: '/my/memories', label: 'Memories', icon: <Images /> },
{ href: '/my/groups', label: 'My Groups', icon: <Users2 /> },
{ href: '/my/settings', label: 'Settings', icon: <Settings /> },
];
export function MemberNav() {
const pathname = usePathname();
const t = PORTAL_THEMES.emerald;
async function logout() {
await fetch('/api/my/logout', { method: 'POST' });
window.location.href = '/member-login';
}
return (
<aside className="w-60 shrink-0 flex flex-col border-r bg-sidebar">
<div className="h-16 flex items-center gap-3 px-5 border-b">
<div className={cn('size-8 rounded-lg flex items-center justify-center text-white font-bold text-sm shadow-sm', t.gradient)}>
T
</div>
<div className="flex flex-col leading-none">
<span className="font-semibold text-sm tracking-tight">TOWER</span>
<span className="text-[11px] text-muted-foreground mt-0.5">Member</span>
</div>
</div>
<nav className="flex-1 overflow-y-auto p-3 space-y-1">
{NAV.map((item) => {
const isActive = item.href === '/my' ? pathname === '/my' : pathname.startsWith(item.href);
return (
<Link
key={item.href}
href={item.href}
className={cn(
'group relative flex items-center gap-3 rounded-lg px-3 py-2 text-sm transition-colors',
isActive ? cn(t.activeBg, t.activeText, 'font-medium') : 'text-muted-foreground hover:bg-accent hover:text-foreground',
)}
>
{isActive && <span className={cn('absolute left-0 top-1/2 -translate-y-1/2 h-5 w-1 rounded-r-full', t.bar)} />}
<span className="size-4 shrink-0 [&_svg]:size-4">{item.icon}</span>
{item.label}
</Link>
);
})}
</nav>
<div className="p-3 border-t">
<Button variant="ghost" size="sm" className="w-full justify-start text-muted-foreground" onClick={() => void logout()}>
<LogOut className="size-4" />
Sign out
</Button>
</div>
</aside>
);
}