import React from 'react';
import { Select, SelectTrigger, SelectContent, SelectItem } from '@/components/ui/select';
import { cn } from '@/lib/utils';
import { OwnerAvatarCircle, ownerDisplayLabel } from '@/lib/ownerAvatar';
const EMPTY_OWNER_KEY = '__owner_none__';
const MEMBER_TAKE_OWNERSHIP_VALUE = '__member_take_ownership__';
/**
* Owner avatar + reassignment dropdown, shared across Leads/Contacts/Companies. Admins can
* assign to anyone or unassign; members can only self-claim an unassigned row (same rules the
* backend enforces on the owner_user_id patch).
*/
export default function OwnerCell({ row, isAdmin, tenantMembers, currentUserId, onChangeOwner }) {
const trigger = (
svg]:hidden'
)}
title={isAdmin ? 'Change owner' : ownerDisplayLabel(row)}
aria-label={`Owner: ${ownerDisplayLabel(row)}. Open menu ${isAdmin ? 'to change' : 'for details'}.`}
>
);
const header = (
);
const currentValue =
row.owner_user_id != null && row.owner_user_id !== '' ? String(row.owner_user_id) : EMPTY_OWNER_KEY;
if (isAdmin) {
return (
);
}
return (
);
}