Repository navigation
🚀 Add result export - #4
Merged
Merged
Conversation
|
Visit the preview URL for this PR (updated for commit 6723d5b): https://dogmatch-33--pr4-export-results-son2hfn2.web.app (expires Thu, 23 Apr 2026 20:57:35 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 3be598a5fc061b587f1c015bd81cd7e7b2c794a8 |
There was a problem hiding this comment.
Pull request overview
Adds a “Download” button on the quiz results page to export the user’s top-10 matches as a single-page, print-ready A4 PDF, using an off-screen printable layout and client-side rasterization/PDF generation.
Changes:
- Introduces a dedicated printable results layout (
PrintableResults) for consistent PDF formatting. - Adds an export button (
ExportResultsButton) that renders the printable view off-screen, captures it withhtml2canvas, and saves viajsPDF. - Updates the results header layout to place the new Download button alongside the main results header (responsive stacking on mobile).
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/pages/quiz/Results.tsx |
Adds a flex header row and mounts the new export button with required props. |
src/pages/quiz/ExportResultsButton.tsx |
Implements PDF generation flow (off-screen render → image wait → html2canvas → jsPDF save) plus toast UX. |
src/pages/quiz/PrintableResults.tsx |
Defines the printable A4-ish layout used for export (branding, title, top-10 table). |
package.json |
Adds html2canvas and jspdf dependencies. |
yarn.lock |
Locks new transitive dependencies required by jspdf/html2canvas. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a Download button to the quiz results page that exports the user's top-10 dog matches as a one-page, print-ready PDF.
Changes
src/pages/quiz/PrintableResults.tsx— dedicated A4-portrait printable layout (branded header, personalized title, top-10 table with rank medals, photos, match %, and key traits). Solo & couple modes both supported, with per-partner score breakdowns rendered under each row in couple mode.src/pages/quiz/ExportResultsButton.tsx— outlined button (with download icon) that triggers PDF generation. Renders the printable layout off-screen, waits for images to load, then rasterizes viahtml2canvasand wraps the result in a single-page A4 PDF viajsPDF(scaled to fit so it never spills to a second page). Includes loading state ("Preparing...") and success/error toasts. Filename uses the top breed, e.g.dogmatch-golden-retriever.pdf.src/pages/quiz/Results.tsx— "Your perfect match is..." header and the new Download button share a flex row, stacking vertically on mobile.jspdfandhtml2canvas(dynamically imported so they land in code-split chunks — main bundle only grows by ~4 kB; the PDF libs are fetched on first click).UX notes
Test plan
dogmatch-<top-breed>.pdf