import React, { useState } from 'react'; import { InputDialog } from '@ohif/ui-next'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@ohif/ui-next'; type DataSource = { value: string; label: string; placeHolder: string; }; type ReportDialogProps = { dataSources: DataSource[]; hide: () => void; onSave: (data: { reportName: string; dataSource: string | null }) => void; onCancel: () => void; }; function ReportDialog({ dataSources, hide, onSave, onCancel }: ReportDialogProps) { const [selectedDataSource, setSelectedDataSource] = useState( dataSources?.[0]?.value ?? null ); const handleSave = (reportName: string) => { onSave({ reportName, dataSource: selectedDataSource, }); hide(); }; const handleCancel = () => { onCancel(); hide(); }; const showDataSourceSelect = dataSources?.length > 1; return (
{showDataSourceSelect && (
)}
Cancel Save
); } export { ReportDialog }; export default { 'ohif.createReportDialog': ReportDialog, };