diff --git a/src/routes/stock-screener/+page.svelte b/src/routes/stock-screener/+page.svelte index 42874100..a078bf73 100644 --- a/src/routes/stock-screener/+page.svelte +++ b/src/routes/stock-screener/+page.svelte @@ -19,6 +19,7 @@ import { Button } from "$lib/components/shadcn/button/index.js"; import * as HoverCard from "$lib/components/shadcn/hover-card/index.js"; import TableHeader from "$lib/components/Table/TableHeader.svelte"; + import DownloadData from "$lib/components/DownloadData.svelte"; import Input from "$lib/components/Input.svelte"; @@ -2054,37 +2055,6 @@ const handleKeyDown = (event) => { } } } - - const exportData = (format = "csv") => { - if (data?.user?.tier === "Pro") { - // Add headers row dynamically based on columns - const csvRows = []; - const headers = columns.map((col) => col.label).join(","); - csvRows.push(headers); - - // Add data rows dynamically based on columns - filteredData?.forEach((item) => { - const csvRow = columns - .map((col) => item[col.key]) // Dynamically map item values based on column keys - .join(","); - csvRows.push(csvRow); - }); - - // Create CSV blob and trigger download - const csv = csvRows.join("\n"); - const blob = new Blob([csv], { type: "text/csv" }); - const url = window.URL.createObjectURL(blob); - const a = document.createElement("a"); - a.setAttribute("hidden", ""); - a.setAttribute("href", url); - a.setAttribute("download", `stock_screener_data.csv`); - document.body.appendChild(a); - a.click(); - document.body.removeChild(a); - } else { - goto("/pricing"); - } - }; @@ -2787,7 +2757,7 @@ const handleKeyDown = (event) => { {filteredData?.length} Stocks