import { BarChart2, Settings2, Table } from 'lucide-react' import { Checkbox, Label_Shadcn_, Popover_Shadcn_, PopoverContent_Shadcn_, PopoverTrigger_Shadcn_, Select_Shadcn_, SelectContent_Shadcn_, SelectGroup_Shadcn_, SelectItem_Shadcn_, SelectTrigger_Shadcn_, ToggleGroup, ToggleGroupItem, } from 'ui' import { ButtonTooltip } from '../ButtonTooltip' import { ChartConfig } from '@/components/interfaces/SQLEditor/UtilityPanel/ChartConfig' interface BlockViewConfigurationProps { columns: string[] view: 'chart' | 'table' isChart: boolean lockColumns?: boolean chartConfig?: ChartConfig changeView: (value: 'chart' | 'table') => void updateChartConfig: (config: ChartConfig) => void } export const BlockViewConfiguration = ({ columns, view, isChart, lockColumns = false, chartConfig, changeView, updateChartConfig, }: BlockViewConfigurationProps) => { return ( } tooltip={{ content: { side: 'bottom', text: 'View data' } }} />
{ if (view) changeView(view) }} >

As table

As chart

{isChart && chartConfig && ( <> updateChartConfig({ ...chartConfig, xKey: value })} > X Axis {chartConfig?.xKey && `- ${chartConfig.xKey}`} {columns.map((key) => ( {key} ))} updateChartConfig({ ...chartConfig, yKey: value })} > Y Axis {chartConfig?.yKey && `- ${chartConfig.yKey}`} {columns.map((key) => ( {key} ))}
updateChartConfig({ ...chartConfig, cumulative: !chartConfig?.cumulative, }) } /> Cumulative updateChartConfig({ ...chartConfig, logScale: !chartConfig?.logScale, }) } /> Log scale
)} ) }