import { Button } from "@/src/components/ui/button"; import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogBody, DialogFooter, } from "@/src/components/ui/dialog"; import { ChevronLeft } from "lucide-react"; import type { BatchActionQuery } from "@langfuse/shared"; // Step components import { DatasetChoiceStep } from "./DatasetChoiceStep"; import { DatasetSelectStep } from "./DatasetSelectStep"; import { DatasetCreateStep } from "./DatasetCreateStep"; import { MappingStep } from "./MappingStep"; import { FinalPreviewStep } from "./FinalPreviewStep"; import { StatusStep } from "./StatusStep"; // Hook import { useAddToDatasetWizard } from "./useAddToDatasetWizard"; type AddObservationsToDatasetDialogProps = { projectId: string; selectedObservationIds: string[]; query: BatchActionQuery; selectAll: boolean; totalCount: number; onClose: () => void; exampleObservation: { id: string; traceId: string; startTime?: Date; }; }; export function AddObservationsToDatasetDialog( props: AddObservationsToDatasetDialogProps, ) { const { projectId, onClose } = props; const { state, formRef, observationData, isLoadingObservation, displayCount, selectMode, goBack, goToStep, handleNextClick, handleDatasetSelect, handleDatasetCreated, handleInputConfigChange, handleOutputConfigChange, handleMetadataConfigChange, handleCreateValidationChange, handleInputValidationChange, handleOutputValidationChange, isNextDisabled, nextButtonLabel, dialogDescription, showBackButton, canClose, isLoading, } = useAddToDatasetWizard(props); const { step } = state; return ( !open && canClose && onClose()}> Add {displayCount} Observation(s) to dataset {!["select", "create", "choice"].includes(step) ? " " + state.dataset.name : ""} {dialogDescription} {step === "choice" && } {step === "select" && ( )} {step === "create" && ( )} {step === "input-mapping" && ( )} {step === "output-mapping" && ( )} {step === "metadata-mapping" && ( )} {step === "preview" && state.dataset.id && state.dataset.name && ( )} {step === "status" && state.submission.batchActionId && state.dataset.id && state.dataset.name && ( )} {/* Footer with navigation buttons */} {step !== "status" && step !== "choice" && (
{showBackButton && ( )}
)}
); }