import { CancelButton } from './CancelButton.tsx'; import { SubstraitViz } from '@substrait-viz/react'; import React from 'react'; import { DroppedFile, useFileDrop } from './useFileDrop.ts'; import { THEME } from './theme.ts'; import { ShareButton } from './ShareButton.tsx'; import { ThemeToggleButton } from './ThemeToggleButton.tsx'; import { CopyAsJSONButton } from './CopyAsJSONButton.tsx'; import { useThemeMode } from './ThemeModeContext.tsx'; import { DownloadBinButton } from './DownloadBinButton.tsx'; export interface PlanVizProps { plan: DroppedFile; setPlan: React.Dispatch>; descriptors: DroppedFile[] | undefined; } export function PlanViz({ plan, setPlan, descriptors }: PlanVizProps) { const { isDarkMode } = useThemeMode(); const theme = THEME[isDarkMode ? 'dark' : 'light']; const protoDescriptorSets = React.useMemo( () => descriptors?.map(_ => _.value), [descriptors], ); const { handleDragOver, handleDragLeave, handleDrop, fileInputRef, handleFileSelect, } = useFileDrop(setPlan, true); return ( <>
{plan.name} setPlan(undefined)} />
{descriptors?.map((_, i) => {_.name})}
); }