export const csvDownload = (data: Array<Array<string>> | { [key: string]: string }, name: string) => {
const rows = Array.isArray(data) ? [...data] : [Object.keys(data), Object.values(data)];
const csvContent = "data:text/csv;charset=utf-8," + rows.map((e) => e.join(",")).join("\n");
const encodedUri = encodeURI(csvContent);
const link = document.createElement("a");
link.href = encodedUri;
link.download = `${name}.csv`;
document.body.appendChild(link);
link.click();
document.body.removeChild(link); // Cleanup after the download link is clicked
};