/** * @file dashboard/components/KanbanCardAvatars.tsx * @description Client component rendering team avatars and creator badge for a kanban card. */ "use client"; import { Crown } from "lucide-react"; import { Task } from "@/types/tasks"; /** * Renders overlapping avatar indicators for task assignees and a dedicated, crowned badge for the task creator. * Filters out duplicate entries where the assignee matches the creator. * * @param {Object} props - The component props. * @param {Task["creator"]} props.creator - The email or identifier of the task creator. * @param {Task["assignees"]} [props.assignees=[]] - An array of emails or identifiers for users assigned to the task. * @returns {JSX.Element | null} The rendered avatars container, or null if neither creator nor assignees exist. */ export default function KanbanCardAvatars({ creator, assignees = [], }: { creator: Task["creator"]; assignees: Task["assignees"]; }) { const filteredAssignees = (assignees || []).filter((a) => a !== creator); if (!creator && filteredAssignees.length === 0) return null; return (
{filteredAssignees.map((assignee, index) => (
{assignee.substring(0, 2).toUpperCase()}
))} {creator && (
{creator.substring(0, 2).toUpperCase()}
)}
); }