Skip to content

Open-source agentic AI Search Execution Platform. Track AI visibility, find opportunities, and let agents turn signals into prioritized actions and drafted fixes across ChatGPT, Claude, Gemini, Google AI Overviews, Google AI Mode, Perplexity, Grok, and Microsoft Copilot.

feat(sidebar): added user profile as (avatar + name) → settings (#52)

Sourabh Haldarb9d0f3fc08f1
diff --git a/web/src/components/layout/mobile-nav.tsx b/web/src/components/layout/mobile-nav.tsx
index d4d59029f..5ef6bf414 100644
--- a/web/src/components/layout/mobile-nav.tsx
+++ b/web/src/components/layout/mobile-nav.tsx
@@ -1,6 +1,6 @@
'use client';
-import { useState } from 'react';
+import { useEffect, useState } from 'react';
import { useTranslations } from 'next-intl';
import { usePathname, Link } from '@/i18n/navigation';
import { dashboardNav } from '@/config/dashboard';
@@ -10,8 +10,11 @@ import { cn } from '@/lib/utils';
import { Button } from '@/components/ui/button';
import { Badge } from '@/components/ui/badge';
import { Sheet, SheetContent, SheetTrigger } from '@/components/ui/sheet';
+import { UserProfileNavItem } from '@/components/layout/user-profile-nav-item';
import { useBrandStore } from '@/stores/use-brand-store';
import { Crown, Menu, MessageSquareText } from 'lucide-react';
+import Image from 'next/image';
+import { useTheme } from 'next-themes';
export function MobileNav() {
const [open, setOpen] = useState(false);
@@ -20,6 +23,12 @@ export function MobileNav() {
const tBrands = useTranslations('brands');
const { canUse, requiredPlanFor, isCloud } = useFeatureGate();
const { activeBrandId } = useBrandStore();
+ const { resolvedTheme } = useTheme();
+ const [mounted, setMounted] = useState(false);
+ useEffect(() => setMounted(true), []);
+
+ const logoSrc =
+ mounted && resolvedTheme === 'dark' ? '/logo_dark.svg' : '/logo_light.svg';
const getLabel = (title: string): string => {
const map: Record<string, string> = {
@@ -45,83 +54,96 @@ export function MobileNav() {
<Menu className="h-5 w-5" />
<span className="sr-only">Toggle menu</span>
</SheetTrigger>
- <SheetContent side="left" className="w-64 p-0">
- <div className="flex h-16 items-center border-b px-4">
+ <SheetContent side="left" className="flex w-64 flex-col p-0">
+ <div className="flex gap-2 h-16 items-center border-b px-4">
+ <Image
+ src={logoSrc}
+ alt={siteConfig.name}
+ width={24}
+ height={24}
+ className="h-6 w-6 shrink-0"
+ priority
+ />
<span className="font-semibold">{siteConfig.name}</span>
</div>
- <nav className="space-y-0.5 p-3">
- {activeBrandId && (
- <Link
- href={`/dashboard/brands/${activeBrandId}/prompts`}
- onClick={() => setOpen(false)}
- >
- <span
- className={cn(
- 'flex items-center gap-3 rounded-md px-3 py-2 text-sm font-medium transition-colors',
- pathname.includes(`/brands/${activeBrandId}/prompts`)
- ? 'bg-primary/10 text-primary'
- : 'text-muted-foreground hover:bg-accent hover:text-accent-foreground',
- )}
+ <div className="min-h-0 flex-1 overflow-y-auto">
+ <nav className="space-y-0.5 p-3">
+ {activeBrandId && (
+ <Link
+ href={`/dashboard/brands/${activeBrandId}/prompts`}
+ onClick={() => setOpen(false)}
>
- <MessageSquareText className="h-4 w-4 shrink-0" />
- Prompts
- </span>
- </Link>
- )}
- {dashboardNav.flatMap((group) =>
- group.items.map((item) => {
- const isActive =
- item.href === '/dashboard'
- ? pathname === '/dashboard'
- : pathname.startsWith(item.href);
- const label = getLabel(item.title);
+ <span
+ className={cn(
+ 'flex items-center gap-3 rounded-md px-3 py-2 text-sm font-medium transition-colors',
+ pathname.includes(`/brands/${activeBrandId}/prompts`)
+ ? 'bg-primary/10 text-primary'
+ : 'text-muted-foreground hover:bg-accent hover:text-accent-foreground',
+ )}
+ >
+ <MessageSquareText className="h-4 w-4 shrink-0" />
+ Prompts
+ </span>
+ </Link>
+ )}
+ {dashboardNav.flatMap((group) =>
+ group.items.map((item) => {
+ const isActive =
+ item.href === '/dashboard'
+ ? pathname === '/dashboard'
+ : pathname.startsWith(item.href);
+ const label = getLabel(item.title);
- const isLocked =
- isCloud &&
- item.requiredFeature != null &&
- !canUse(item.requiredFeature);
+ const isLocked =
+ isCloud &&
+ item.requiredFeature != null &&
+ !canUse(item.requiredFeature);
+
+ if (isLocked) {
+ return (
+ <span
+ key={item.href}
+ className="flex items-center gap-3 rounded-md px-3 py-2 text-sm font-medium text-muted-foreground/50 cursor-not-allowed"
+ >
+ <item.icon className="h-4 w-4 shrink-0" />
+ <span className="flex-1">{label}</span>
+ <Badge
+ variant="outline"
+ className="h-5 gap-0.5 px-1.5 text-[10px] font-normal"
+ >
+ <Crown className="h-2.5 w-2.5" />
+ {requiredPlanFor(item.requiredFeature!)}
+ </Badge>
+ </span>
+ );
+ }
- if (isLocked) {
return (
- <span
+ <Link
key={item.href}
- className="flex items-center gap-3 rounded-md px-3 py-2 text-sm font-medium text-muted-foreground/50 cursor-not-allowed"
+ href={item.href}
+ onClick={() => setOpen(false)}
>
- <item.icon className="h-4 w-4 shrink-0" />
- <span className="flex-1">{label}</span>
- <Badge
- variant="outline"
- className="h-5 gap-0.5 px-1.5 text-[10px] font-normal"
+ <span
+ className={cn(
+ 'flex items-center gap-3 rounded-md px-3 py-2 text-sm font-medium transition-colors',
+ isActive
+ ? 'bg-primary/10 text-primary'
+ : 'text-muted-foreground hover:bg-accent hover:text-accent-foreground',
+ )}
>
- <Crown className="h-2.5 w-2.5" />
- {requiredPlanFor(item.requiredFeature!)}
- </Badge>
- </span>
+ <item.icon className="h-4 w-4 shrink-0" />
+ {label}
+ </span>
+ </Link>
);
- }
-
- return (
- <Link
- key={item.href}
- href={item.href}
- onClick={() => setOpen(false)}
- >
- <span
- className={cn(
- 'flex items-center gap-3 rounded-md px-3 py-2 text-sm font-medium transition-colors',
- isActive
- ? 'bg-primary/10 text-primary'
- : 'text-muted-foreground hover:bg-accent hover:text-accent-foreground',
- )}
- >
- <item.icon className="h-4 w-4 shrink-0" />
- {label}
- </span>
- </Link>
- );
- }),
- )}
- </nav>
+ }),
+ )}
+ </nav>
+ </div>
+ <div className="border-t p-2">
+ <UserProfileNavItem onClick={() => setOpen(false)} />
+ </div>
</SheetContent>
</Sheet>
);
diff --git a/web/src/components/layout/sidebar.tsx b/web/src/components/layout/sidebar.tsx
index 8eea840d5..d3153218e 100644
--- a/web/src/components/layout/sidebar.tsx
+++ b/web/src/components/layout/sidebar.tsx
@@ -15,12 +15,8 @@ import { Badge } from '@/components/ui/badge';
import { ScrollArea } from '@/components/ui/scroll-area';
import { Separator } from '@/components/ui/separator';
import { BrandSwitcher } from '@/components/layout/brand-switcher';
-import {
- Crown,
- Lock,
- PanelLeftClose,
- PanelLeftOpen,
-} from 'lucide-react';
+import { UserProfileNavItem } from '@/components/layout/user-profile-nav-item';
+import { Crown, Lock, PanelLeftClose, PanelLeftOpen } from 'lucide-react';
export function Sidebar() {
const pathname = usePathname();
@@ -31,6 +27,7 @@ export function Sidebar() {
const { resolvedTheme } = useTheme();
const [mounted, setMounted] = useState(false);
useEffect(() => setMounted(true), []);
+
const logoSrc =
mounted && resolvedTheme === 'dark' ? '/logo_dark.svg' : '/logo_light.svg';
@@ -55,11 +52,18 @@ export function Sidebar() {
isCollapsed ? 'w-16' : 'w-60',
)}
>
- {/* Logo */}
- <div className="flex h-16 items-center border-b px-3">
+ <div
+ className={cn(
+ 'flex h-16 items-center border-b px-3',
+ isCollapsed && 'justify-center px-0',
+ )}
+ >
<Link
href="/dashboard"
- className="flex items-center gap-2 overflow-hidden"
+ className={cn(
+ 'flex items-center gap-2 overflow-hidden',
+ !isCollapsed && 'w-full',
+ )}
>
<Image
src={logoSrc}
@@ -75,14 +79,10 @@ export function Sidebar() {
</Link>
</div>
- {/* Brand Switcher */}
- <div
- className={cn('border-b px-2 py-2', isCollapsed && 'px-1')}
- >
+ <div className={cn('border-b px-2 py-2', isCollapsed && 'px-1')}>
<BrandSwitcher collapsed={isCollapsed} />
</div>
- {/* Nav */}
<ScrollArea className="flex-1 px-2 py-3">
{dashboardNav.map((group, i) => (
<div key={i} className="mb-4">
@@ -113,7 +113,7 @@ export function Sidebar() {
<span
key={item.href}
className={cn(
- 'flex items-center gap-3 rounded-md px-2 py-2 text-sm font-medium text-muted-foreground/50 cursor-not-allowed',
+ 'flex cursor-not-allowed items-center gap-3 rounded-md px-2 py-2 text-sm font-medium text-muted-foreground/50',
isCollapsed && 'justify-center',
)}
title={
@@ -128,7 +128,7 @@ export function Sidebar() {
<span className="flex-1 truncate">{label}</span>
<Badge
variant="outline"
- className="ml-auto h-5 gap-0.5 px-1.5 text-[10px] font-normal shrink-0"
+ className="ml-auto h-5 shrink-0 gap-0.5 px-1.5 text-[10px] font-normal"
>
<Crown className="h-2.5 w-2.5" />
{requiredPlanFor(item.requiredFeature!)}
@@ -167,12 +167,15 @@ export function Sidebar() {
))}
</ScrollArea>
- {/* Collapse toggle */}
+ <div className="border-t p-2">
+ <UserProfileNavItem collapsed={isCollapsed} />
+ </div>
+
<div className="border-t p-2">
<Button
variant="ghost"
size="icon"
- className="w-full"
+ className="mt-1 w-full"
onClick={toggleCollapse}
>
{isCollapsed ? (
diff --git a/web/src/components/layout/user-profile-nav-item.tsx b/web/src/components/layout/user-profile-nav-item.tsx
new file mode 100644
index 000000000..235926e17
--- /dev/null
+++ b/web/src/components/layout/user-profile-nav-item.tsx
@@ -0,0 +1,55 @@
+'use client';
+
+import { Link } from '@/i18n/navigation';
+import { cn } from '@/lib/utils';
+import { useAuthStore } from '@/stores/use-auth-store';
+import { Avatar, AvatarFallback } from '@/components/ui/avatar';
+
+interface UserProfileNavItemProps {
+ collapsed?: boolean;
+ onClick?: () => void;
+ className?: string;
+}
+
+export function UserProfileNavItem({
+ collapsed = false,
+ onClick,
+ className,
+}: UserProfileNavItemProps) {
+ const user = useAuthStore((state) => state.user);
+ const fullName = user?.user_metadata?.full_name;
+ const displayName = typeof fullName === 'string' ? fullName : '';
+ const email = user?.email ?? '';
+
+ const label = displayName || email || 'User Name';
+ const initials = displayName
+ ? displayName
+ .trim()
+ .split(/\s+/)
+ .slice(0, 2)
+ .map((part) => part[0]?.toUpperCase() || '')
+ .join('')
+ : (email[0]?.toUpperCase() ?? 'U');
+
+ return (
+ <Link
+ href="/dashboard/settings"
+ onClick={onClick}
+ className={cn(
+ 'flex items-center gap-2 rounded-md px-2 py-2 text-sm transition-colors hover:bg-accent',
+ collapsed && 'justify-center px-0',
+ className,
+ )}
+ title={collapsed ? label : undefined}
+ >
+ <Avatar className="h-8 w-8 shrink-0">
+ <AvatarFallback className="bg-primary/10 text-xs font-semibold text-primary">
+ {initials}
+ </AvatarFallback>
+ </Avatar>
+ {!collapsed && (
+ <span className="truncate text-sm font-medium capitalize">{label}</span>
+ )}
+ </Link>
+ );
+}