Skip to content

Fix duplicate QR design choices while preserving saved styles - #5

Merged
CompleteDotTech merged 4 commits into
mainfrom
codex/qr-distinct-styles-20261025
Nov 14, 2026
Merged

CompleteDotTech merged 4 commits into
mainfrom
codex/qr-distinct-styles-20261025

Conversation

@CompleteDotTech

Copy link
Copy Markdown
Contributor

The design picker exposed 22 body names, 15 eye frames, and 18 eye balls even though they produced only 5, 3, and 2 distinct geometries. Offer those distinct choices, normalize old names to visually identical aliases, and keep template values selectable. Invalid JSON style values still fall back safely.

Explain beside the download controls and in the README that PNG uses standard modules and foreground/background colors; SVG preserves shapes, eye colors, gradients, and logos. Legacy eye-flip fields remain documented as unsupported compatibility fields.

Fixes #2.

Validation:

  • npm run typecheck, npm test (57 passed), npm run build, and npm run smoke:qr passed.
  • All 55 legacy style names and 14 presets produce SVGs byte-identical to the base renderer (69 comparisons).
  • Independent full-diff review found no blockers; 23 focused design tests and the 69 compatibility comparisons passed independently.
  • git diff --check passed.

Local tests used synthetic example.com data. Hosted CI and scanner/device acceptance are not claimed.

import { describe, expect, it } from 'vitest';
import { bodyShapes, defaultDesignConfig, eyeBalls, eyeFrames, normalizeDesignConfig, templates } from '../src/qr/design';
import { renderQr } from '../src/qr/renderer';
import type { DesignConfig } from '../src/shared/types';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Finish and deletes all Designconfig.... Thanks

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The SVG export hint is misleading because downloads use the selected saved design rather than the current preview, so it must clarify that users need to save changes first.

1 open issue
What changed in this PR

This PR addresses #2 by limiting the QR design picker to distinct geometries while preserving saved styles through legacy aliases.

Changes:

  • Offer five body shapes, three eye frames, and two eye balls, with normalized template values.
  • Add tests for distinct output, legacy aliases, invalid style inputs, and PNG behavior.
  • Document export styling limits and unsupported legacy eye-flip fields.
File Description
tests/​design-styles.test.ts Adds geometry, compatibility, preset, and PNG regression tests.
src/​qr/​renderer.ts Simplifies rendering branches to use canonical style names.
src/​qr/​design.ts Defines distinct choices, maps legacy aliases, and normalizes presets.
src/​client/​App.tsx Adds export-format guidance beside download controls.
README.md Documents style counts, compatibility aliases, and rendering limitations.

Review effort: Max

Comment thread src/client/App.tsx Outdated
{selected && <a className="btn btn-secondary" href={`/api/qr-codes/${selected.id}/render?file=svg`}><Download size={14} aria-hidden /> SVG</a>}
</div>
<p className="note">PDF and EPS are intentionally disabled in this MVP — print renderer is the next phase.</p>
<p className="note">SVG preserves the preview design. PNG uses standard square modules and foreground/background colors; shapes, eye colors, gradients, and logos are SVG-only. PDF and EPS export are unavailable.</p>
@CompleteDotTech
CompleteDotTech marked this pull request as ready for review November 14, 2026 16:20
@CompleteDotTech
CompleteDotTech merged commit 188d5bd into main Nov 14, 2026
4 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-11-14T16:22:40.917083Z 67e67cd Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

Most body shapes, eye frames and eye balls render identically

3 participants