Skip to content

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

Draft
CompleteDotTech wants to merge 2 commits into
mainfrom
codex/qr-distinct-styles-20261025
Draft

CompleteDotTech wants to merge 2 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
{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>
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