'use client'; import * as React from 'react'; import { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { Card, CardContent } from '../../ui/card'; import { Avatar, AvatarFallback, AvatarImage } from '../../ui/avatar'; import { Badge } from '../../ui/badge'; import { Button } from '../../ui/button'; import { cn } from '../../shared/utils'; export interface ProfileCardProps extends React.HTMLAttributes { name: string; role: string; department?: string; avatar?: string; initials: string; status?: 'online' | 'offline' | 'away' | 'busy'; stats?: Array<{ label: string; value: string | number }>; primaryAction?: { label: string; onClick?: () => void }; secondaryAction?: { label: string; onClick?: () => void }; } const statusVariant = { online: 'success' as const, offline: 'secondary' as const, away: 'warning' as const, busy: 'destructive' as const, }; export function ProfileCard({ name, role, department, avatar, initials, status, stats, primaryAction, secondaryAction, className, ...props }: ProfileCardProps) { const { t } = useTranslation(); const statusLabelMap = useMemo( () => ({ online: t('profileCard.status.online'), offline: t('profileCard.status.offline'), away: t('profileCard.status.away'), busy: t('profileCard.status.busy'), }), [t] ); const s = status ? { label: statusLabelMap[status], variant: statusVariant[status] } : null; return (
{avatar && } {initials} {s && ( {s.label} )}

{name}

{role}

{department &&

{department}

}
{stats && stats.length > 0 && (
{stats.map(stat => (
{stat.value} {stat.label}
))}
)} {(primaryAction || secondaryAction) && (
{secondaryAction && ( )} {primaryAction && ( )}
)}
); }