fix: Export-Encoding und Excel-Support

- CSV: UTF-8 BOM + \r\n Zeilenenden → Umlaute in Excel korrekt
- CSV: deutsche Spaltennamen, Tags als kommagetrennte Liste
- Excel (.xlsx): nativer Export via xlsx-Library mit Spaltenbreiten
- Export-Dropdown: CSV und Excel jeweils für aktuelle Ansicht und nur mit E-Mail

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Timo Uttenweiler
2026-03-20 17:38:49 +01:00
parent 042fbeb672
commit 8fb881cbbc
2 changed files with 81 additions and 49 deletions

View File

@@ -520,8 +520,8 @@ export default function LeadVaultPage() {
}
}
function exportCSV(emailOnly = false) {
const params = new URLSearchParams({ search: debouncedSearch, sortBy, sortDir });
function exportFile(format: "csv" | "xlsx", emailOnly = false) {
const params = new URLSearchParams({ search: debouncedSearch, sortBy, sortDir, format });
filterStatus.forEach(s => params.append("status", s));
filterSource.forEach(s => params.append("sourceTab", s));
if (filterHasEmail) params.set("hasEmail", filterHasEmail);
@@ -560,9 +560,10 @@ export default function LeadVaultPage() {
</button>
<div className="absolute right-0 top-9 hidden group-hover:block z-50 bg-[#1a1a28] border border-[#2e2e3e] rounded-lg shadow-xl p-1 min-w-[220px]">
{[
["Aktuelle Ansicht (CSV)", () => exportCSV()],
["Alle Leads (CSV)", () => exportCSV()],
["Nur mit E-Mail (CSV)", () => exportCSV(true)],
["Aktuelle Ansicht (CSV)", () => exportFile("csv")],
["Aktuelle Ansicht (Excel)", () => exportFile("xlsx")],
["Nur mit E-Mail (CSV)", () => exportFile("csv", true)],
["Nur mit E-Mail (Excel)", () => exportFile("xlsx", true)],
].map(([label, fn]) => (
<button key={label as string} onClick={fn as () => void}
className="w-full text-left px-3 py-2 text-sm text-gray-300 hover:bg-[#2e2e3e] rounded">