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>
This commit is contained in:
2026-06-20 18:20:06 +05:30
parent d7b5988858
commit 205418fc4e
50 changed files with 619 additions and 360 deletions
+4 -2
View File
@@ -7,9 +7,11 @@ export default async function MemberLayout({ children }: { children: React.React
if (!token) redirect('/member-login');
return (
<div className="flex h-screen overflow-hidden -m-6">
<div className="flex h-screen overflow-hidden">
<MemberNav />
<main className="flex-1 overflow-auto bg-muted/30 p-6">{children}</main>
<main className="flex-1 overflow-auto bg-muted/30">
<div className="p-6 lg:p-8 max-w-6xl mx-auto w-full">{children}</div>
</main>
</div>
);
}
+35 -18
View File
@@ -3,18 +3,30 @@
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import { cn } from '../_lib/utils';
import { Separator } from '../_components/ui/separator';
import { Button } from '../_components/ui/button';
import { LayoutDashboard, Settings, Users, LogOut } from 'lucide-react';
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/groups', label: 'My Groups', icon: <Users /> },
{ 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' });
@@ -22,38 +34,43 @@ export function MemberNav() {
}
return (
<nav className="w-56 shrink-0 flex flex-col h-full border-r bg-sidebar">
<div className="px-4 py-5 flex items-center gap-2">
<span className="font-bold text-base text-emerald-600">TOWER</span>
<Separator orientation="vertical" className="h-4" />
<span className="text-xs text-muted-foreground font-medium">Member</span>
<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>
<Separator />
<div className="flex-1 overflow-y-auto py-3 px-2 space-y-0.5">
<nav className="flex-1 overflow-y-auto p-3 space-y-1">
{NAV.map((item) => {
const active = item.href === '/my' ? pathname === '/my' : pathname.startsWith(item.href);
const isActive = item.href === '/my' ? pathname === '/my' : pathname.startsWith(item.href);
return (
<Link
key={item.href}
href={item.href}
className={cn(
'flex items-center gap-3 rounded-md px-3 py-2 text-sm transition-colors',
active ? 'bg-accent text-accent-foreground font-medium' : 'text-muted-foreground hover:bg-accent hover:text-accent-foreground',
'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',
)}
>
<span className="size-4 shrink-0">{item.icon}</span>
{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>
);
})}
</div>
<Separator />
<div className="p-3">
</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>
</nav>
</aside>
);
}