Skip to content

feat(web): add CSV export for the AI Traffic visit log - #630

Merged
gkhngyk merged 1 commit into
ansvisor:mainfrom
d180:feature/traffic-csv-export
Aug 3, 2026
Merged

gkhngyk merged 1 commit into
ansvisor:mainfrom
d180:feature/traffic-csv-export

Conversation

@d180

@d180 d180 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • AI Traffic was the only data-heavy dashboard page with no CSV export — the header only had a date picker, and toCsv wasn't imported in the file.
  • Adds an "Export CSV" button to the header that fetches the visit log via the existing getTrafficLogs action (up to 1000 rows — PostgREST's un-paginated select cap — rather than the current page's 20), matching the active date window and platform/search filters.
  • Exports timestamp, platform, page_url, referrer columns, following the existing ansvisor_${slug}_traffic_${date}.csv naming convention.
  • Shows a spinner while exporting and a toast on failure, mirroring the Citations page's export implementation.

Related issue

Closes #607

Type of change

  • feat — New feature

Checklist

  • Branch follows the naming convention (feature/)
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean implementation, and documenting the PostgREST cap in the comment is appreciated. One non-blocking suggestion: result.total is already in hand — when total > TRAFFIC_EXPORT_LIMIT, a small warning toast ("Exported first 1,000 of N visits") would avoid a silently truncated file. Fine as a follow-up. Thanks!

@gkhngyk
gkhngyk merged commit 965d0e3 into ansvisor:main Aug 3, 2026
4 checks passed
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.

AI Traffic: add CSV export for the visit log

2 participants