import React from 'react'; import { useTranslation } from 'react-i18next'; import { DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuPortal, DropdownMenuSubContent, DropdownMenuLabel, DropdownMenuItem, DropdownMenuSeparator, Icons, } from '@ohif/ui-next'; import { SegmentationRepresentations } from '@cornerstonejs/tools/enums'; interface ExportSegmentationSubMenuItemProps { segmentationId: string; segmentationRepresentationType: string; allowExport: boolean; actions: { storeSegmentation: (segmentationId: string) => Promise; onSegmentationDownloadRTSS: (segmentationId: string) => void; onSegmentationDownload: (segmentationId: string) => void; downloadCSVSegmentationReport: (segmentationId: string) => void; }; } export const ExportSegmentationSubMenuItem: React.FC = ({ segmentationId, segmentationRepresentationType, allowExport, actions, }) => { const { t } = useTranslation('SegmentationTable'); return ( <> {segmentationRepresentationType === SegmentationRepresentations.Labelmap && ( {t('Download & Export')} {t('Download')} { e.preventDefault(); actions.downloadCSVSegmentationReport(segmentationId); }} disabled={!allowExport} > {t('CSV Report')} { e.preventDefault(); actions.onSegmentationDownload(segmentationId); }} disabled={!allowExport} > {t('DICOM SEG')} { e.preventDefault(); actions.onSegmentationDownloadRTSS(segmentationId); }} disabled={!allowExport} > {t('DICOM RTSS')} {t('Export')} { e.preventDefault(); actions.storeSegmentation(segmentationId); }} disabled={!allowExport} > {t('DICOM SEG')} )} {segmentationRepresentationType === SegmentationRepresentations.Contour && ( <> { e.preventDefault(); actions.onSegmentationDownloadRTSS(segmentationId); }} disabled={!allowExport} > {t('Download DICOM RTSS')} )} ); };