import React from "react"; import DataTable from "./DataTable"; export default function DataPreview({ dataset, onStartQuerying }) { if (!dataset) return null; // Extract columns (schema) and rows (preview data) const columnsSchema = dataset.columns || []; const previewData = dataset.preview || { columns: [], rows: [] }; const displayDescription = dataset.description || `Database containing ${dataset.display_name} tables.`; const getTypeBadgeClass = (type) => { const t = type ? type.toUpperCase() : "TEXT"; if (t === "INTEGER" || t === "REAL") return "badge-type integer"; if (t === "DATE" || t === "TIMESTAMP" || t === "DATETIME") return "badge-type date"; return "badge-type text"; }; return (
{displayDescription}
| Column Name | Data Type | Sample Values |
|---|---|---|
| {col.name} | {col.type} | {col.sample_values && col.sample_values.length > 0 ? col.sample_values.map(val => (val === null ? "null" : String(val))).join(", ") : "No examples available"} |