import { useState } from 'react' import { useFlag } from 'common' import { cn, DialogSectionSeparator, Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, } from 'ui' import { DestinationForm } from './DestinationForm' import { DestinationType } from './DestinationPanel.types' import { DestinationTypeSelection } from './DestinationTypeSelection' import { ReadReplicaForm } from './ReadReplicaForm' interface DestinationPanelProps { visible: boolean type?: DestinationType existingDestination?: { sourceId?: number destinationId: number pipelineId?: number enabled: boolean statusName?: string } onClose: () => void } export const DestinationPanel = ({ visible, type, existingDestination, onClose, }: DestinationPanelProps) => { const unifiedReplication = useFlag('unifiedReplication') const [selectedType, setSelectedType] = useState( type || (unifiedReplication ? 'Read Replica' : 'BigQuery') ) const editMode = !!existingDestination return ( <>
{editMode ? 'Edit destination' : 'Create a new destination'} {editMode ? 'Update the configuration for this destination' : 'A destination is an external platform that automatically receives your database changes in real time.'} {selectedType === 'Read Replica' ? ( ) : ( )}
) }