Skip to content

feat(sidebar): show signed-in user profile row at the bottom (avatar + name → Settings) #45

Closed

Description

@gkhngyk

What

Add a user profile row at the bottom of the dashboard sidebar,
above the existing collapse toggle. The row shows:

  • A circular avatar on the left with the user's initials only
    (no photo). Dark background, light text.
  • The user's full name (or email if name is not set) to the right of
    the avatar.

Clicking the row navigates to /dashboard/settings.

When the sidebar is collapsed (icon-only mode), only the avatar
remains visible — same isCollapsed pattern the nav items use.

Why

There's currently no quick visual indicator of who's signed in
inside the dashboard chrome — the only way to confirm your account
is to navigate to Settings. A persistent profile row in the sidebar:

  • Gives instant identity confirmation (important on shared / team
    accounts)
  • Adds a one-click shortcut to Settings without hunting in nav
  • Matches the convention used by every dashboard product the user
    has seen (Notion, Linear, Vercel, Supabase, etc.)

Where to add it

web/src/components/layout/sidebar.tsx — insert the new profile
block immediately before the existing {/* Collapse toggle */}
section (around line 170). Keep the collapse toggle exactly where
and how it is — the user row sits on top of it.

The two blocks together (profile row + collapse toggle) form the
sidebar's bottom stack, separated from the nav above by the existing
ScrollArea boundary.

How to read the signed-in user

The auth store at web/src/stores/use-auth-store.ts already exposes
the current Supabase user. Read it via:

import { useAuthStore } from '@/stores/use-auth-store';
const user = useAuthStore((s) => s.user);

The user object's relevant fields:

  • user.user_metadata?.full_name — preferred display name
  • user.email — fallback when no name is set

If user is null (auth still loading), render nothing for the
profile row — don't show a placeholder.

Initials logic

Compute from the name:

function getInitials(user: User): string {
  const name = user.user_metadata?.full_name?.trim();
  if (name) {
    const parts = name.split(/\s+/).filter(Boolean);
    const first = parts[0]?.[0] ?? '';
    const last = parts.length > 1 ? parts[parts.length - 1][0] : '';
    return (first + last).toUpperCase().slice(0, 2);
  }
  // No name → fall back to email's first letter
  return user.email?.[0]?.toUpperCase() ?? '?';
}

So "Ada Lovelace" → AL, "Cher" → C, no name + email
[email protected] → A.

Avatar styling

Use the existing shadcn primitives from
@/components/ui/avatar (the Avatar + AvatarFallback
components are already in the codebase). The AvatarFallback is
where the initials render.

For the dark background + light text requirement:

<Avatar className="h-8 w-8 shrink-0">
  <AvatarFallback className="bg-foreground text-background text-xs font-semibold">
    {initials}
  </AvatarFallback>
</Avatar>

Using bg-foreground / text-background (Tailwind/shadcn tokens)
guarantees correct dark/light contrast in both themes
automatically — in light mode the avatar is near-black with white
text, in dark mode it's near-white with dark text. Don't hardcode
hex colours.

The clickable row

The whole row should be a Link from @/i18n/navigation (already
imported at the top of the file) pointing at /dashboard/settings.
Style it the same way as the nav items above it — hover state, focus
ring, etc. Suggested shape:

{!user ? null : (
  <div className="border-t p-2">
    <Link
      href="/dashboard/settings"
      className={cn(
        'flex items-center gap-3 rounded-md px-2 py-2 transition-colors',
        'hover:bg-accent hover:text-accent-foreground',
        isCollapsed && 'justify-center',
      )}
      title={isCollapsed ? displayName : undefined}
    >
      <Avatar className="h-8 w-8 shrink-0">
        <AvatarFallback className="bg-foreground text-background text-xs font-semibold">
          {initials}
        </AvatarFallback>
      </Avatar>
      {!isCollapsed && (
        <span className="truncate text-sm font-medium">
          {displayName}
        </span>
      )}
    </Link>
  </div>
)}

Where displayName is user.user_metadata?.full_name ?? user.email.

How to verify

  • Sign in → profile row appears at the bottom of the sidebar,
    above the collapse toggle
  • Avatar shows correct initials: "Ada Lovelace" → AL,
    single-word name → first letter only, no-name user → first
    letter of email
  • Click the row → navigates to /dashboard/settings
  • Collapse the sidebar → only the avatar is visible, name is
    hidden, hover tooltip still shows the name
  • Toggle dark mode → avatar background and text invert
    correctly (still high-contrast in both themes)
  • Very long name (e.g. "Maria Anne Theresa Johansson") →
    truncates cleanly with ellipsis, doesn't overflow the sidebar
  • Signed-out state (e.g. brief moment during sign-out) →
    profile row is hidden, collapse toggle still works

Out of scope

  • A full dropdown menu on the profile row (sign out, switch account,
    etc.) — single click → Settings is enough for now
  • Photo / avatar image upload — initials only, by design
  • Showing the user's organisation / role — name only
  • Editing the profile inline — clicking it just navigates

Contribution guide

See CONTRIBUTING.md for branch naming, commit
conventions, and PR workflow.

Activity

  1. added
    enhancement
    good first issue
    help wanted
    on May 18, 2026
  2. sourabh-31 commented on May 18, 2026

    @sourabh-31
    Contributor

    Hi, I would like to work on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgood first issuehelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions