diff --git a/src/components/ChartArtifact.tsx b/src/components/ChartArtifact.tsx index 857c97f..cbf6076 100644 --- a/src/components/ChartArtifact.tsx +++ b/src/components/ChartArtifact.tsx @@ -13,20 +13,20 @@ import vegaEmbed, { type Result, } from "vega-embed"; -import * as XLSX from "xlsx"; +// import * as XLSX from "xlsx"; -import { saveAs } from "file-saver"; +// import { saveAs } from "file-saver"; -import jsPDF from "jspdf"; +// import jsPDF from "jspdf"; -import html2canvas from "html2canvas"; +// import html2canvas from "html2canvas"; import { AlertTriangle, - Download, - FileSpreadsheet, - FileText, - ImageIcon, + // Download, + // FileSpreadsheet, + // FileText, + // ImageIcon, RefreshCcw, Sparkles, CheckCircle2, @@ -424,8 +424,8 @@ function VegaLiteArtifact({ const [renderError, setRenderError] = useState(""); - const [vegaResult, setVegaResult] = - useState(null); + // const [vegaResult, setVegaResult] = + // useState(null); const [activeTab, setActiveTab] = useState< "answer" | "chart" | "sql" @@ -492,7 +492,7 @@ function VegaLiteArtifact({ ); } - setVegaResult(result); + // setVegaResult(result); } catch (finalError) { console.error( "FINAL VEGA ERROR =>", @@ -520,143 +520,143 @@ function VegaLiteArtifact({ GET VALUES ===================================================== */ - const getValues = () => { - const data = (safeSpec as any)?.data; + // const getValues = () => { + // const data = (safeSpec as any)?.data; - if ( - !data?.values || - !Array.isArray(data.values) - ) { - return []; - } + // if ( + // !data?.values || + // !Array.isArray(data.values) + // ) { + // return []; + // } - return data.values; - }; + // return data.values; + // }; /* ===================================================== EXPORT EXCEL ===================================================== */ - const downloadExcel = () => { - const values = getValues(); + // const downloadExcel = () => { + // const values = getValues(); - if (!values.length) { - alert("No data available"); - return; - } + // if (!values.length) { + // alert("No data available"); + // return; + // } - const worksheet = - XLSX.utils.json_to_sheet(values); + // const worksheet = + // XLSX.utils.json_to_sheet(values); - const workbook = - XLSX.utils.book_new(); + // const workbook = + // XLSX.utils.book_new(); - XLSX.utils.book_append_sheet( - workbook, - worksheet, - "Chart Data", - ); + // XLSX.utils.book_append_sheet( + // workbook, + // worksheet, + // "Chart Data", + // ); - const excelBuffer = XLSX.write( - workbook, - { - bookType: "xlsx", - type: "array", - }, - ); + // const excelBuffer = XLSX.write( + // workbook, + // { + // bookType: "xlsx", + // type: "array", + // }, + // ); - const blob = new Blob( - [excelBuffer], - { - type: - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", - }, - ); + // const blob = new Blob( + // [excelBuffer], + // { + // type: + // "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + // }, + // ); - saveAs(blob, "chart-data.xlsx"); - }; + // saveAs(blob, "chart-data.xlsx"); + // }; /* ===================================================== EXPORT CSV ===================================================== */ - const downloadCSV = () => { - const values = getValues(); + // const downloadCSV = () => { + // const values = getValues(); - if (!values.length) { - alert("No data available"); - return; - } + // if (!values.length) { + // alert("No data available"); + // return; + // } - const headers = Object.keys( - values[0], - ); + // const headers = Object.keys( + // values[0], + // ); - const csvRows = [ - headers.join(","), + // const csvRows = [ + // headers.join(","), - ...values.map((row: any) => - headers - .map((field) => row[field]) - .join(","), - ), - ]; + // ...values.map((row: any) => + // headers + // .map((field) => row[field]) + // .join(","), + // ), + // ]; - const blob = new Blob( - [csvRows.join("\n")], - { - type: "text/csv", - }, - ); + // const blob = new Blob( + // [csvRows.join("\n")], + // { + // type: "text/csv", + // }, + // ); - saveAs(blob, "chart-data.csv"); - }; + // saveAs(blob, "chart-data.csv"); + // }; /* ===================================================== EXPORT PDF ===================================================== */ - const downloadPDF = async () => { - if (!chartRef.current) return; + // const downloadPDF = async () => { + // if (!chartRef.current) return; - const canvas = - await html2canvas( - chartRef.current, - ); + // const canvas = + // await html2canvas( + // chartRef.current, + // ); - const image = - canvas.toDataURL("image/png"); + // const image = + // canvas.toDataURL("image/png"); - const pdf = new jsPDF( - "landscape", - ); + // const pdf = new jsPDF( + // "landscape", + // ); - pdf.addImage( - image, - "PNG", - 10, - 10, - 270, - 150, - ); + // pdf.addImage( + // image, + // "PNG", + // 10, + // 10, + // 270, + // 150, + // ); - pdf.save("chart-report.pdf"); - }; + // pdf.save("chart-report.pdf"); + // }; /* ===================================================== EXPORT PNG ===================================================== */ - const downloadPNG = async () => { - if (!vegaResult) return; + // const downloadPNG = async () => { + // if (!vegaResult) return; - const imageURL = - await vegaResult.view.toImageURL( - "png", - ); + // const imageURL = + // await vegaResult.view.toImageURL( + // "png", + // ); - saveAs(imageURL, "chart.png"); - }; + // saveAs(imageURL, "chart.png"); + // }; /* ===================================================== RETRY diff --git a/src/pages/Login.tsx b/src/pages/Login.tsx index a4132f7..d5b747e 100644 --- a/src/pages/Login.tsx +++ b/src/pages/Login.tsx @@ -154,7 +154,7 @@ export default function Login() { text-transparent " > - GenBI + Yoda