Skip to content

Add label preview before full generation#9

Merged
emares17 merged 1 commit into
mainfrom
feature/label-preview
Apr 23, 2026
Merged

Add label preview before full generation#9
emares17 merged 1 commit into
mainfrom
feature/label-preview

Conversation

@emares17

Copy link
Copy Markdown
Owner

Summary

  • New POST /preview endpoint generates only the first sheet as a base64 PDF — no Supabase storage, no DB writes, 10/hour rate limit
  • PDFSheetGenerator.generate_preview_sheet() writes to BytesIO instead of disk and calibrates bar widths against all labels so the preview is accurate
  • New LabelPreview component (self-contained) decodes base64 → Blob URL and renders the PDF in an iframe; exposes Generate All and Close actions
  • labelUploader switches to a side-by-side layout when a preview is active — form stays on the left (580px), preview panel fills the remaining width and sticks as the user scrolls

Test plan

  • Upload a CSV, click Preview First Sheet — confirm the right panel opens with the correct first-sheet PDF
  • Verify label count and total sheets in the preview header match the file
  • Click Generate All from the preview panel — confirm full generation completes and the preview closes
  • Click X — confirm the preview panel closes without generating
  • Tweak column mapping or template, re-click Preview First Sheet — confirm the preview updates
  • Test with QR barcode type selected — confirm QR codes appear in the preview
  • Test all 4 label templates — confirm layout matches full generation output
  • Hit the preview endpoint 11 times in an hour — confirm 429 is returned

🤖 Generated with Claude Code

- POST /preview endpoint returns base64 first-sheet PDF without storing
  anything in Supabase (10/hour rate limit, same validation as /upload)
- PDFSheetGenerator.generate_preview_sheet() renders to BytesIO instead
  of disk, calibrates on all labels for accurate bar widths
- generate_label_preview() in label_service mirrors upload parsing but
  skips zip creation, DB writes, and storage upload
- New LabelPreview component decodes base64 -> Blob URL, renders PDF in
  an iframe with loading state, exposes Generate All and Close actions
- labelUploader splits into side-by-side layout when preview is active;
  preview panel is sticky so it stays visible while scrolling the form

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@railway-app

railway-app Bot commented Apr 23, 2026

Copy link
Copy Markdown

🚅 Deployed to the BarcodeGenerator-pr-9 environment in LabelGenius

Service Status Web Updated (UTC)
LabelGenius-Frontend ✅ Success (View Logs) Web Apr 23, 2026 at 1:52 am
LabelGenius-Backend ✅ Success (View Logs) Web Apr 23, 2026 at 1:50 am

@railway-app
railway-app Bot temporarily deployed to LabelGenius / BarcodeGenerator-pr-9 April 23, 2026 01:49 Destroyed
@emares17
emares17 merged commit c76ebfb into main Apr 23, 2026
3 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.

1 participant