fix: wire role-based views — sidebar auth, user display, table tabs, card actions

- Sidebar: use useAuth() for isAdmin and pass auth user to NavAccountCard
- NavAccountCard: fix bug where items prop was ignored (used placeholderAccounts)
- TopBar: replace hardcoded "SM" initials with user.initials from auth
- All Leads: add "My Leads" tab filtering by assignedAgent matching user
- Lead Card: add role-aware action buttons (Call/Disposition for assigned leads)
- Lead Workspace: pass onLogCall/onUpdateStatus handlers to LeadCard

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-16 16:15:08 +05:30
parent 8b796bf916
commit d98da9a1ea
6 changed files with 56 additions and 7 deletions

View File

@@ -110,7 +110,17 @@ export const Sidebar = ({ activeUrl = "/" }: SidebarProps) => {
{/* Account card */}
<div className="mt-auto flex flex-col gap-5 px-2 py-4 lg:gap-6 lg:px-4 lg:py-4">
<NavAccountCard onSignOut={handleSignOut} />
<NavAccountCard
items={[{
id: 'current',
name: user.name,
email: user.email,
avatar: '',
status: 'online' as const,
}]}
selectedAccountId="current"
onSignOut={handleSignOut}
/>
</div>
</aside>
);

View File

@@ -1,6 +1,7 @@
import { SearchLg } from "@untitledui/icons";
import { Avatar } from "@/components/base/avatar/avatar";
import { Input } from "@/components/base/input/input";
import { useAuth } from "@/providers/auth-provider";
interface TopBarProps {
title: string;
@@ -8,6 +9,8 @@ interface TopBarProps {
}
export const TopBar = ({ title, subtitle }: TopBarProps) => {
const { user } = useAuth();
return (
<header className="flex h-16 items-center justify-between border-b border-secondary bg-primary px-6">
<div className="flex flex-col justify-center">
@@ -23,7 +26,7 @@ export const TopBar = ({ title, subtitle }: TopBarProps) => {
aria-label="Search"
/>
</div>
<Avatar initials="SM" size="sm" />
<Avatar initials={user.initials} size="sm" />
</div>
</header>
);