Skip to content

[Frontend/Feature] Export Full Scan History as CSV (Closes #54) #180

Description

@jpdevhub

Problem

Issue #54 requests a CSV export feature. Users who scan frequently want to download their history for personal records or to import into Excel.

Goal

Add a single 'Export CSV' button to the Scan History section of ResultsPage.tsx that downloads all scan records as a .csv file.

Acceptance Criteria

  • 'Export CSV' button appears in the scan history section header (only when there are > 0 scans)
  • CSV columns: Date, Time, Scan ID, Grade, Freshness Score, Species, Market, City
  • CSV filename: freshscan-history-{YYYY-MM-DD}.csv
  • Export is client-side only (no server call needed) — uses existing scans state from ResultsPage
  • Uses the Blob + URL.createObjectURL browser API (no external library needed)
  • Translation key added: results.exportCsv in en.json, hi.json, bn.json
  • Works on mobile (triggers native file download)

Implementation Hint

const blob = new Blob([csvString], { type: 'text/csv' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url; a.download = filename; a.click();

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions