feat(13.1): add UserMenu component with avatar, Settings link, and Sign Out

- Install @radix-ui/react-dropdown-menu and add shadcn/ui dropdown-menu component
- Create src/components/user-menu.tsx: avatar button showing user initial,
  DropdownMenu with name/email label, Settings link (/app/settings), Sign Out
  (calls signOut with redirect to /login)
- Replace placeholder div in src/app/app/layout.tsx with <UserMenu />
- Remove now-redundant standalone Settings link from nav bar (Settings is in dropdown)
- Mark task 13.1 done in openspec/changes/user-accounts/tasks.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marko Djordjevic 2026-02-20 13:41:21 +01:00
parent fba0b29d64
commit 9884f47d5a
6 changed files with 393 additions and 20 deletions

View file

@ -2,7 +2,7 @@
import { SessionProvider } from 'next-auth/react';
import Link from 'next/link';
import { Settings } from 'lucide-react';
import { UserMenu } from '@/components/user-menu';
/**
* Protected app layout.
@ -12,10 +12,7 @@ import { Settings } from 'lucide-react';
*
* Contains a minimal top nav bar with:
* - App title / home link
* - Settings link ( /app/settings)
* - Placeholder slot for the user menu (task 13.1)
*
* The full user-menu dropdown (avatar, sign-out, etc.) is wired up in task 13.1.
* - UserMenu component (avatar, settings link, sign-out)
*/
export default function AppLayout({
children,
@ -24,7 +21,6 @@ export default function AppLayout({
}>) {
return (
<SessionProvider>
{/* Minimal nav bar — user menu dropdown added in task 13.1 */}
<header className="fixed top-0 inset-x-0 z-50 h-10 flex items-center justify-between px-4 bg-background border-b border-border">
<Link
href="/app"
@ -34,19 +30,7 @@ export default function AppLayout({
</Link>
<nav className="flex items-center gap-2">
{/* Settings link */}
<Link
href="/app/settings"
className="flex items-center gap-1.5 px-2 py-1 text-xs text-muted-foreground hover:text-foreground rounded hover:bg-secondary/50 transition-colors"
>
<Settings className="w-3.5 h-3.5" />
Settings
</Link>
{/* User menu placeholder — implemented in task 13.1 */}
<div className="w-7 h-7 rounded-full bg-secondary/50 flex items-center justify-center text-xs text-muted-foreground" aria-label="User menu (coming soon)">
?
</div>
<UserMenu />
</nav>
</header>