All files / src/stock-items/edit-stock-item edit-stock-item-action-menu.component.tsx

60% Statements 3/5
100% Branches 2/2
50% Functions 1/2
60% Lines 3/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29                    1x 150x   150x                              
import React from 'react';
import { Button } from '@carbon/react';
import { useTranslation } from 'react-i18next';
import { type StockItemDTO } from '../../core/api/types/stockItem/StockItem';
import { launchAddOrEditStockItemWorkspace } from '../stock-item.utils';
 
interface EditStockItemActionsMenuProps {
  data: StockItemDTO;
}
 
const EditStockItemActionsMenu: React.FC<EditStockItemActionsMenuProps> = ({ data }) => {
  const { t } = useTranslation();
 
  return (
    <Button
      kind="ghost"
      size="md"
      onClick={() => {
        data.isDrug = !!data.drugUuid;
        launchAddOrEditStockItemWorkspace(data);
      }}
      iconDescription={t('editStockItem', 'Edit stock item')}
    >
      {`${data?.drugName ?? data.conceptName}`}
    </Button>
  );
};
export default EditStockItemActionsMenu;