Skip to content

feat(ui): export transactions to CSV — current filtered rows, UTF-8 BOM, date-stamped filename (v1.20 E) - #68

Merged
argszero merged 1 commit into
mainfrom
feat/ui-ue-round5-export-csv
Aug 17, 2026
Merged

argszero merged 1 commit into
mainfrom
feat/ui-ue-round5-export-csv

Conversation

@argszero

Copy link
Copy Markdown
Owner

Summary

Item E of rant 2026-08-17T20:46:57 (UI/UE 第五轮多角度深化, v1.20): 交易记录导出 CSV — export transactions to CSV.

  • 「导出 CSV」button (#tx-export-btn, right-aligned ghost button under the transaction tabs) in the Transactions view
  • Exports the currently filtered rows — tab filter (全部/消费/收益) → filterRows(list, TX_COLUMNS, txTable.filters) — same data source as the table and summary bar (consistent with v1.19 B)
  • CSV format: UTF-8 BOM (\uFEFF, no mojibake in Excel) + \r\n line endings; header 时间,类型,模型 / Key,Token 用量,点数,状态; type mapped to Chinese via TX_TYPE; points kept signed; RFC4180 double-quote escaping for fields containing ,/"/newlines
  • Download: Blob(text/csv;charset=utf-8)URL.createObjectURL → temp <a download> click → remove → revoke after 1s
  • Filename: aitokenpool-transactions-YYYYMMDD.csv (local date)
  • Empty result → info toast「没有可导出的交易记录」, nothing exported; success → toast「已导出 N 条交易记录」

Rant reference (verbatim)

E. 交易记录导出 CSV — Blob + a[download],UTF-8 BOM,文件名 aitokenpool-transactions-YYYYMMDD.csv

Verification

  • DOM-stub smoke test: 20/20 assertions (view + binding → Blob/anchor/download/filename → BOM bytes EF BB BF + header + full 13 rows → consume-tab subset (5) → pts column-filter subset (1) → empty no-export → HTML structure)
  • node --check ui/js/app.js ✓, CSS braces balanced ✓
  • cargo test ✓ (1 passed), cargo fmt --check
  • Docs: docs/user-stories.md v1.20 entry (E added), ui/README.md「交易记录导出 CSV 约定」section

Progress on rant 20:46:57: A (#63) + B (#65) + C (#66) + D (#67) + E (#68) merged; remaining F–G.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant