Skip to content

[WC-3181] Barcode Generator: Complete app#2059

Open
yordan-st wants to merge 18 commits intomainfrom
barcode-widget
Open

[WC-3181] Barcode Generator: Complete app#2059
yordan-st wants to merge 18 commits intomainfrom
barcode-widget

Conversation

@yordan-st
Copy link
Contributor

@yordan-st yordan-st commented Feb 9, 2026

Pull request type

New feature (non-breaking change which adds functionality)\


Description

  • Complete Barcode generator app with:
  • comprehensive configuration for all barcode types;
  • improved runtime UI display
  • realistic design preview inside Studio Pro
  • design-time and runtime error handling for incompatible barcode values
  • comprehensive tests matching the current feature set

@yordan-st yordan-st force-pushed the barcode-widget branch 3 times, most recently from 21331d1 to 086c244 Compare February 17, 2026 13:28
@yordan-st yordan-st marked this pull request as ready for review February 17, 2026 16:55
@yordan-st yordan-st requested a review from a team as a code owner February 17, 2026 16:55
r0b1n
r0b1n previously approved these changes Feb 20, 2026
// Validate barcode value at runtime
const validationResult = validateBarcodeValue(format, value);
if (!validationResult.valid) {
const errorMsg = validationResult.message || "Invalid barcode value";
Copy link
Collaborator

Choose a reason for hiding this comment

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

If it errored out, message should be always present, validateBarcodeValue should responsible for that.

You can make it type safe by doing something like:

export type ValidationResult =
    | {
          valid: true;
      }
    | {
          valid: false;
          message: string;
      };

Copy link
Collaborator

@r0b1n r0b1n Mar 11, 2026

Choose a reason for hiding this comment

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

Also looks like validateBarcodeValue accepts string as format, make it accept a defined set of formats based on xml typings, not just any string.

Copy link
Collaborator

Choose a reason for hiding this comment

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

fixed

import { LogLevelEnum } from "../../typings/BarcodeGeneratorProps";

export const useRenderBarcode = (): RefObject<SVGSVGElement | null> => {
function printError(message: string, logLevel: LogLevelEnum) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This feels out of place, make it live in a separate file

Copy link
Collaborator

Choose a reason for hiding this comment

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

fixed

size: number;
title: string;
level: QrLevelEnum;
image?: {
Copy link
Collaborator

@r0b1n r0b1n Mar 11, 2026

Choose a reason for hiding this comment

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

Call it overlay to be consistent with xml properties

Copy link
Collaborator

Choose a reason for hiding this comment

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

fixed

buttonPosition: "top" | "bottom";
}

type codeType = "barcode" | "qrcode";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Keep types PascalCase

Copy link
Collaborator

Choose a reason for hiding this comment

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

fixed

r0b1n and others added 15 commits March 12, 2026 13:30
- remove unnecessary context, use props instead
- split config, make it more typed
- add class and style to the widget
- remove unnecessary hooks, use simple utils instead
- update icons and tiles
- hide ean128 for qrcode
- change code value to expression
- add button position and card view config
- implement layout, styling and icon
- static value consistency checks
- dynamic value warnings and runtime error alert
- enable displayValue for addons
- improve conditional visibility for certain configurations
- improve descriptions
- added svg assets for barcode preview
- add asset resolver for image sources
- encapsulate svg logic into hook
- cleaner main preview component
- simplified preview DOM
- removed redundant css classes
- merged remaining preview styles into main stylesheet
- renamed qr overlay property and css classes
- updated tests error messages to check for new messages
- anchor changed to button
- createad DownloadButton component
- changed preview max height to 200px
- change icon for structure preview
- changed dynamic value description to generic
- added configurable filename
- error state recovery on revalidation
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.

3 participants