Skip to content

Add an export-to-CSV button on HistoryPage that downloads executed proposals with their ID, amount, token, recipient, and execution date #184

Description

@thegreatfeez

Frontend — History & Filtering

Summary

Users who manage payroll or grants need a paper trail they can import into a spreadsheet. This issue adds a single "Export CSV" button to HistoryPage that triggers a browser download of all executed proposals in a standard comma-separated format.

Background

HistoryPage.tsx already receives a historyProposals array containing executed, expired, and revoked proposals. The Proposal type in frontend/src/types/accord.ts includes id, amount, token, to (recipient), status, and deadline. There is currently no dedicated execution timestamp — the contributor should either use the deadline field as a proxy date or add an executedAt field to the Proposal type and populate it in mapProposal in frontend/src/lib/contract.ts. No external CSV library should be added; the file can be built from a plain string and downloaded via a temporary anchor element.

What Needs to Be Done

  1. In frontend/src/pages/HistoryPage.tsx, add an "Export CSV" button in the header row next to the "Proposal History" heading. The button should only be enabled when at least one executed proposal exists.
  2. When clicked, filter historyProposals to only those with status === "executed", build a CSV string with a header row (ID,Amount,Token,Recipient,Date) and one data row per proposal, then trigger a file download named accord-history.csv using a temporary anchor element with a blob URL.
  3. If no executedAt field exists on the Proposal type, add one (nullable string) to frontend/src/types/accord.ts and populate it with the formatted deadline value in mapProposal inside frontend/src/lib/contract.ts until a true execution timestamp is available from the contract.

Acceptance Criteria

  • An "Export CSV" button appears on HistoryPage when executed proposals are present.
  • The button is disabled or hidden when no executed proposals exist.
  • Clicking the button downloads a file named accord-history.csv.
  • The downloaded file contains a header row and one data row per executed proposal with ID, amount, token, recipient, and a date value.
  • No external npm package is added to implement the export.

Files to Look At

  • frontend/src/pages/HistoryPage.tsx — add the button and CSV download logic here
  • frontend/src/types/accord.ts — check the Proposal type; add executedAt if needed
  • frontend/src/lib/contract.tsmapProposal is where new fields on Proposal get populated

Difficulty: Easy

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions