feat(scan): support 1D barcode scanning in Scan mode - #305
Draft
lyqht wants to merge 1 commit into
Draft
Conversation
mini-qr's Scan mode already used html5-qrcode (which decodes 1D barcodes), but the UX was QR-only. This wires up real barcode support: - Capture the decoded symbology (format) from camera and file/image scans and use it to distinguish QR-family 2D codes from 1D barcodes. - Widen the camera viewfinder (function-form qrbox, no forced square aspect ratio) so wide/short 1D barcodes scan reliably. - Skip URL/email/phone heuristics for barcodes so a numeric UPC/EAN is no longer mislabeled as a phone number; show the symbology instead (e.g. "Barcode · EAN-13"). - Add a "Search this barcode online" lookup link for retail product symbologies (UPC/EAN); keep Copy and "Create QR from value" actions. - Relabel scan headings/result panel to include barcodes; add i18n keys. Add scanFormats util (format -> category/label/lookup) with unit tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FvjrRLwHUqPdkVVTN6EiRq
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
📚 Storybook preview for this PR: https://mini-qr-storybook-6iwlxzgdb-lyqhts-projects.vercel.app Updated on every push to this branch. |
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
mini-qr's Scan mode already used
html5-qrcode(which can decode 1D barcodes), but the UX was QR-only. This PR turns on real barcode support and tailors the result UX to it.qrbox, no forced square aspect ratio — so wide/short 1D barcodes scan reliably.Barcode · EAN-13).locales/en.json(Crowdin picks up translations).src/utils/scanFormats.tshelper (format → category / label / lookup URL) built test-first, with unit tests.Files
src/components/QRCodeCameraScanner.vue— emit detected format, adaptive viewfindersrc/components/QRCodeScan.vue— track format, branch type-detection, result-panel actionssrc/utils/scanFormats.ts(+.test.ts) — pure helperslocales/en.json— new stringsVerification
vitestnode project: 188/188 pass (incl. 9 newscanFormatstests, written test-first)vite buildsucceedseslintclean (0 errors); type-check adds no new errors (the one inQRCodeScan.vueis pre-existing onmain)Out of scope (intentional)
No manual QR/barcode toggle (auto-detect matches the dominant UX of comparable tools), no continuous/multi-scan history, no barcode generation, no new dependency.
🤖 Generated with Claude Code
Generated by Claude Code