import React from 'react'; import { useUIStore, type SidebarTab } from '../store/ui'; import { useSessionStore } from '../store/session'; import { SchemaView } from './SchemaView'; import { ManipulationPanel } from './ManipulationPanel'; import { VisualizationPanel } from './VisualizationPanel'; import { useExport, useExportNotebook } from '../api/hooks'; const TABS: { key: SidebarTab; label: string; icon: React.ReactNode }[] = [ { key: 'data', label: 'Data', icon: ( ), }, { key: 'transform', label: 'Transform', icon: ( ), }, { key: 'visualize', label: 'Visualize', icon: ( ), }, { key: 'export', label: 'Export', icon: ( ), }, ]; function ExportTab() { const { download: downloadCSV, loading: csvLoading } = useExport(); const { download: downloadNotebook, loading: nbLoading } = useExportNotebook(); const { columns, rowCount, tableName } = useSessionStore(); return (
{/* Jupyter Notebook Export - PROMINENT */}

Export

Jupyter Notebook Recommended

Export as .ipynb with clean Python code — only pandas and the relevant operations, ready to run.

{/* CSV Export */}
CSV File

Raw data export ({rowCount.toLocaleString()} rows, {columns.length} columns)

{/* Data Summary */}

Summary

Table {tableName || '—'}
Rows {rowCount.toLocaleString()}
Columns {columns.length}
Numeric {columns.filter(c => c.column_type === 'numeric').length}
Categorical {columns.filter(c => c.column_type === 'categorical').length}
Datetime {columns.filter(c => c.column_type === 'datetime').length}
); } export function Sidebar() { const { activeSidebarTab, setActiveSidebarTab } = useUIStore(); const { isLoaded } = useSessionStore(); if (!isLoaded) return null; return (
{/* Tab bar */}
{TABS.map((tab) => ( ))}
{/* Tab content */}
{activeSidebarTab === 'data' && } {activeSidebarTab === 'transform' && } {activeSidebarTab === 'visualize' && } {activeSidebarTab === 'export' && }
); } function DataTab() { const { columns, rowCount } = useSessionStore(); const numericCount = columns.filter(c => c.column_type === 'numeric').length; const categoricalCount = columns.filter(c => c.column_type === 'categorical').length; const datetimeCount = columns.filter(c => c.column_type === 'datetime').length; return (

Schema

{rowCount.toLocaleString()} rows
{/* Column type summary */}
{numericCount > 0 && ( # {numericCount} numeric )} {categoricalCount > 0 && ( Aa {categoricalCount} categorical )} {datetimeCount > 0 && ( DT {datetimeCount} datetime )}
); }