mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage
synced 2026-04-12 02:38:15 +00:00
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:
@@ -14,6 +14,8 @@ interface LeadCardProps {
|
||||
onMessage: (lead: Lead) => void;
|
||||
onMarkSpam: (lead: Lead) => void;
|
||||
onMerge: (lead: Lead) => void;
|
||||
onLogCall?: (lead: Lead) => void;
|
||||
onUpdateStatus?: (lead: Lead) => void;
|
||||
}
|
||||
|
||||
const sourceLabelMap: Record<string, string> = {
|
||||
@@ -29,7 +31,7 @@ const sourceLabelMap: Record<string, string> = {
|
||||
OTHER: 'Other',
|
||||
};
|
||||
|
||||
export const LeadCard = ({ lead, onAssign, onMessage, onMarkSpam, onMerge }: LeadCardProps) => {
|
||||
export const LeadCard = ({ lead, onAssign, onMessage, onMarkSpam, onMerge, onLogCall, onUpdateStatus }: LeadCardProps) => {
|
||||
const firstName = lead.contactName?.firstName ?? '';
|
||||
const lastName = lead.contactName?.lastName ?? '';
|
||||
const name = `${firstName} ${lastName}`.trim() || 'Unknown';
|
||||
@@ -38,6 +40,7 @@ export const LeadCard = ({ lead, onAssign, onMessage, onMarkSpam, onMerge }: Lea
|
||||
const sourceLabel = lead.leadSource ? sourceLabelMap[lead.leadSource] ?? lead.leadSource : '';
|
||||
const isSpam = (lead.spamScore ?? 0) >= 60;
|
||||
const isDuplicate = lead.isDuplicate === true;
|
||||
const isAssigned = lead.assignedAgent !== null && lead.leadStatus !== 'NEW';
|
||||
|
||||
return (
|
||||
<div
|
||||
@@ -99,6 +102,15 @@ export const LeadCard = ({ lead, onAssign, onMessage, onMarkSpam, onMerge }: Lea
|
||||
Merge
|
||||
</Button>
|
||||
</>
|
||||
) : isAssigned ? (
|
||||
<>
|
||||
<Button size="sm" color="primary" onClick={() => onLogCall?.(lead)}>
|
||||
Call
|
||||
</Button>
|
||||
<Button size="sm" color="secondary" onClick={() => onUpdateStatus?.(lead)}>
|
||||
Disposition
|
||||
</Button>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Button size="sm" color="primary" onClick={() => onAssign(lead)}>
|
||||
|
||||
Reference in New Issue
Block a user