Skip to content

feat: Add file download buttons to Orders by Timeslot dashboard#86

Merged
choden-dev merged 2 commits into
mainfrom
feat/dashboard-file-download
Apr 25, 2026
Merged

feat: Add file download buttons to Orders by Timeslot dashboard#86
choden-dev merged 2 commits into
mainfrom
feat/dashboard-file-download

Conversation

@choden-dev
Copy link
Copy Markdown
Owner

Summary

Previously, admins had to click into each individual order page to view and download files for printing. This was tedious when processing multiple orders for a timeslot.

Changes

API: /api/admin/orders-by-timeslot

  • Now includes stagingKey and permanentKey in the file data returned for each order, enabling the dashboard to generate presigned download URLs directly.

UI: OrdersByTimeslotView

  • Per-file "⬇ Open" button — next to each file name in the Files column. Fetches a presigned R2 URL and opens it in a new tab.
  • "⬇ Download All Files" button — in each timeslot header bar. Opens all files across all orders in that timeslot at once (URLs fetched in parallel, tabs opened with a small delay to avoid popup blockers).
  • File key resolution logic (permanent vs staging bucket) mirrors the existing OrderFilesViewer component used on individual order pages.

How it works

  1. Dashboard calls /api/admin/file-url with the appropriate R2 key to get a temporary presigned URL (valid 1 hour)
  2. Opens the URL in a new browser tab for viewing/downloading
  3. For bulk download, all presigned URLs are fetched in parallel, then opened sequentially with 300ms delays

Testing

  • Verified TypeScript compilation passes with no errors
  • Linting passes (Biome)

Previously admins had to click into each individual order to view and
download files for printing. This adds:

- Per-file 'Open' button next to each file name in the dashboard table
- 'Download All Files' button in each timeslot header to open all files
  for that timeslot at once

API changes:
- orders-by-timeslot endpoint now includes stagingKey and permanentKey
  in the file data so the dashboard can generate presigned download URLs

The file key resolution logic (permanent vs staging) mirrors the
existing OrderFilesViewer component.
@choden-dev choden-dev merged commit 79bdb30 into main Apr 25, 2026
4 checks passed
@choden-dev choden-dev deleted the feat/dashboard-file-download branch April 25, 2026 23:38
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