From 88b6c96a1118d6345985bc4708ddad8ce255c7a0 Mon Sep 17 00:00:00 2001 From: Talha Ahmed Date: Tue, 1 Sep 2026 19:31:22 +0500 Subject: [PATCH] Talent Pool: Export button beside All Departments filter (client-side CSV of filtered grid) Co-Authored-By: Claude Fable 5 --- frontend/src/screens/TalentPool.jsx | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/frontend/src/screens/TalentPool.jsx b/frontend/src/screens/TalentPool.jsx index 20c3961..78548ee 100644 --- a/frontend/src/screens/TalentPool.jsx +++ b/frontend/src/screens/TalentPool.jsx @@ -227,6 +227,38 @@ export default function TalentPool() { toast(`${c.name} moved to ${stage}`, 'success') } + /* CSV of the FILTERED grid, built client-side — there is no /candidate export + endpoint (jobs and reports each own theirs). Exporting `list` rather than + `pool` means the file always matches what the recruiter is looking at, + search and department filter included. Company/skills are seed-overlay + values, same as the cards render. */ + function exportCsv() { + if (!list.length) { + toast('Nothing to export — current filters match no candidates', 'warning') + return + } + const esc = (v) => { + const s = v == null ? '' : String(v) + return /[",\n]/.test(s) ? `"${s.replaceAll('"', '""')}"` : s + } + const header = ['Name', 'Email', 'Current Title', 'Company', 'Departments', 'Stage', 'Experience (yrs)', 'Source', 'AI Score', 'Skills'] + const lines = list.map((c) => [ + c.name, c.email, c.currentTitle, c.currentCompany, + (c.departments || []).join('; '), c.stage, c.experience, + c.source, c.aiScore ?? '', (c.skills || []).join('; '), + ].map(esc).join(',')) + const blob = new Blob([[header.join(','), ...lines].join('\n')], { type: 'text/csv;charset=utf-8' }) + const url = URL.createObjectURL(blob) + const a = document.createElement('a') + a.href = url + a.download = `talent-pool-${new Date().toISOString().slice(0, 10)}.csv` + document.body.appendChild(a) + a.click() + a.remove() + URL.revokeObjectURL(url) + toast(`Exported ${list.length} candidate${list.length === 1 ? '' : 's'} to CSV`, 'success') + } + return (
All Departments {departments.map((d) => )} +