Fixed dshboard render crash
This commit is contained in:
@@ -63,6 +63,7 @@ import {
|
||||
EvidenceType,
|
||||
Notification,
|
||||
NotificationStatus,
|
||||
NotificationPlatform,
|
||||
} from '../../types';
|
||||
import { formatZAR, formatCompactZAR, getUserEmail } from '../../lib/formatters';
|
||||
import { MessageViewer } from '../notifications/MessageViewer';
|
||||
@@ -462,7 +463,7 @@ export function DashboardPage() {
|
||||
};
|
||||
|
||||
const getMessageRecipientEmail = (notification: Notification | null): string => {
|
||||
if (!notification) return user?.profile?.email || (user as any)?.email || 'Partner User';
|
||||
if (!notification) return (user?.email || (user as any)?.profile?.email || '') || (user as any)?.email || 'Partner User';
|
||||
const dest = notification.destination || '';
|
||||
let rawTo = '';
|
||||
if (dest.includes('To:')) {
|
||||
@@ -486,13 +487,13 @@ export function DashboardPage() {
|
||||
}
|
||||
}
|
||||
|
||||
return user?.profile?.email || (user as any)?.email || 'Partner User';
|
||||
return (user?.email || (user as any)?.profile?.email || '') || (user as any)?.email || 'Partner User';
|
||||
};
|
||||
|
||||
const handleReplyToMessage = (notification: Notification) => {
|
||||
const senderEmail = getMessageSenderEmail(notification).trim().toLowerCase();
|
||||
const currentUserEmail = (
|
||||
user?.profile?.email ||
|
||||
(user?.email || (user as any)?.profile?.email || '') ||
|
||||
(user as any)?.email ||
|
||||
''
|
||||
).trim().toLowerCase();
|
||||
@@ -746,7 +747,7 @@ export function DashboardPage() {
|
||||
className="p-3 hover:bg-white/[0.03] transition-colors cursor-pointer text-left"
|
||||
>
|
||||
<p className="text-xs font-semibold text-slate-100 truncate">{item.subject}</p>
|
||||
<p className="text-[11px] text-slate-400 line-clamp-2 mt-0.5">{stripMarkdown(item.message)}</p>
|
||||
<p className="text-[11px] text-slate-400 line-clamp-2 mt-0.5">{stripMarkdown(item.message || '')}</p>
|
||||
</div>
|
||||
))
|
||||
)}
|
||||
@@ -778,10 +779,10 @@ export function DashboardPage() {
|
||||
className="flex items-center gap-2 p-1.5 pl-2 rounded-xl bg-slate-900/80 border border-white/[0.06] hover:border-white/[0.12] transition-colors cursor-pointer"
|
||||
>
|
||||
<div className="w-6 h-6 rounded-lg bg-gradient-to-tr from-emerald-600 via-teal-600 to-cyan-600 flex items-center justify-center text-white text-[11px] font-bold">
|
||||
{getInitials(user?.profile?.name || user?.profile?.email || 'Partner')}
|
||||
{getInitials((user?.name || (user as any)?.profile?.name || '') || (user?.email || (user as any)?.profile?.email || '') || 'Partner')}
|
||||
</div>
|
||||
<span className="text-xs font-medium text-slate-100 hidden md:inline max-w-[120px] truncate">
|
||||
{user?.profile?.name || 'Partner Account'}
|
||||
{(user?.name || (user as any)?.profile?.name || '') || 'Partner Account'}
|
||||
</span>
|
||||
<ChevronDown className="w-3.5 h-3.5 text-slate-400" />
|
||||
</button>
|
||||
@@ -789,8 +790,8 @@ export function DashboardPage() {
|
||||
{showUserDropdown && (
|
||||
<div className="absolute right-0 mt-2 w-56 rounded-2xl bg-slate-900/95 border border-white/10 shadow-2xl backdrop-blur-xl p-2 z-50 text-xs">
|
||||
<div className="px-3 py-2 border-b border-white/[0.06]">
|
||||
<p className="font-semibold text-slate-100 truncate">{user?.profile?.name || 'Partner User'}</p>
|
||||
<p className="text-[11px] text-slate-400 truncate">{user?.profile?.email || ''}</p>
|
||||
<p className="font-semibold text-slate-100 truncate">{(user?.name || (user as any)?.profile?.name || '') || 'Partner User'}</p>
|
||||
<p className="text-[11px] text-slate-400 truncate">{(user?.email || (user as any)?.profile?.email || '') || ''}</p>
|
||||
{partnerSummary.primaryInvitedOrg && (
|
||||
<p className="text-[10px] text-emerald-400 mt-1 truncate">
|
||||
{partnerSummary.primaryInvitedOrg.name}
|
||||
|
||||
Reference in New Issue
Block a user