Skip to content

The open alternative to Salesforce, designed for AI.

1.5 KB
Raw Blame
import { type BlocklistItem } from '@/accounts/types/BlocklistItem';
import { TableCell } from '@/ui/layout/table/components/TableCell';
import { TableRow } from '@/ui/layout/table/components/TableRow';
import { IconButton } from 'twenty-ui/components/input';
import { OverflowingTextWithTooltip } from 'twenty-ui/primitives/typography';
import { IconX } from 'twenty-ui/icon';
import { themeCssVariables } from 'twenty-ui/theme';
import { formatToHumanReadableDate } from '~/utils/date-utils';
import { useLingui } from '@lingui/react/macro';

type SettingsAccountsBlocklistTableRowProps = {
  blocklistItem: BlocklistItem;
  onRemove: (id: string) => void;
};

export const SettingsAccountsBlocklistTableRow = ({
  blocklistItem,
  onRemove,
}: SettingsAccountsBlocklistTableRowProps) => {
  const { t } = useLingui();
  return (
    <TableRow
      key={blocklistItem.id}
      gridAutoColumns="200px 1fr 20px"
      mobileGridAutoColumns="120px 1fr 20px"
    >
      <TableCell color={themeCssVariables.font.color.primary}>
        <OverflowingTextWithTooltip text={blocklistItem.handle} />
      </TableCell>
      <TableCell>
        {blocklistItem.createdAt
          ? formatToHumanReadableDate(blocklistItem.createdAt)
          : ''}
      </TableCell>
      <TableCell align="right">
        <IconButton
          aria-label={t`Remove from blocklist`}
          onClick={() => {
            onRemove(blocklistItem.id);
          }}
          variant="ghost"
          size="sm"
        >
          <IconX />
        </IconButton>
      </TableCell>
    </TableRow>
  );
};