Skip to content

Feature/multi label pagination#1

Merged
u8array merged 9 commits into
mainfrom
feature/multi-label-pagination
May 3, 2026
Merged

Feature/multi label pagination#1
u8array merged 9 commits into
mainfrom
feature/multi-label-pagination

Conversation

@u8array
Copy link
Copy Markdown
Owner

@u8array u8array commented May 3, 2026

No description provided.

u8array added 7 commits May 3, 2026 17:23
…support

Replace the single top-level objects array with pages[] + currentPageIndex.
Object mutations now operate on pages[currentPageIndex]; consumers read via
the new useCurrentObjects() / currentObjects() selectors.

Adds page-management actions (addPage, removePage, duplicatePage,
setCurrentPage). Persisted state migrates legacy { objects } shape into
{ pages: [{ objects }], currentPageIndex: 0 } via persist version bump.

UI is unchanged (single page, no pagination control yet); follow-up commits
add the navigation UI, multi-page ZPL export/import, and JSON format update.
Adds a small bottom-center widget to the canvas with page indicator,
prev/next, add-page, and remove-page controls. Page Up / Page Down
navigate between pages. README keyboard shortcuts table updated.

The single ZPL output still concatenates only the current page's
objects; multi-page export comes in the next commit.
Adds generateMultiPageZPL() which emits one ^XA...^XZ block per page.
Download and the live ZPL output panel now include every page; the
Labelary preview and Print path stay single-page (current page only)
since Labelary renders one image at a time.
Splits incoming ZPL on ^XA boundaries and parses each block as its own
page. The first block's dimensions become the document's; differing
dimensions in later blocks are flagged in the import report.

importZplText now returns { labelConfig, pages, report, notice }
instead of a flat objects array. Adds tests covering single, multi,
mixed-dimension, and malformed input.
The canonical .json shape becomes { label, pages: [{ objects }, ...] }.
parseDesignFile auto-migrates legacy { label, objects } files into a
single-page document so older saves keep loading.
Replaces the multi-label limitation with a dedicated Pages section in
the usage flow and notes that the Labelary preview shows only the
current page even though the export contains every page.
The bottom-center page widget now appears only with 2+ pages so the
default single-label canvas stays uncluttered. Adding a page is moved
to a new File menu entry so the feature stays discoverable.

README updated to match the new entry point.
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces multi-page support for ZPL labels, refactoring the state to manage a collection of pages and adding a pagination control for navigation. It updates ZPL generation, import services, and file serialization to support multiple labels while providing a migration path for legacy single-page designs. Feedback identifies that the ZPL block splitting logic should be improved to handle case-insensitivity and the ~XA prefix to ensure reliable parsing of imported ZPL code.

Comment thread src/lib/zplImportService.ts
ZPL commands are case-insensitive per spec; the existing splitter
matched only uppercase ^XA, so lowercase or mixed-case input fell
through and produced no pages. Switches to a regex split with capture
group so the original delimiter is preserved when re-attached.
@u8array
Copy link
Copy Markdown
Owner Author

u8array commented May 3, 2026

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces multi-page support to the ZPL designer, refactoring the state to manage an array of pages and updating the canvas, import/export services, and design file persistence to handle multiple labels. A new pagination control component and keyboard shortcuts for page navigation were also implemented. Feedback indicates that document-wide actions in the application shell should evaluate content across all pages to avoid being incorrectly disabled when the current page is empty, and highlights several hardcoded strings that should be moved to localization files for better internationalization support.

Comment thread src/components/AppShell.tsx Outdated
Comment thread src/components/AppShell.tsx
Comment thread src/components/Canvas/PaginationControl.tsx
Address two PR review findings:

1. hasObjects was computed from the current page's objects only, so
   Export ZPL / Save Design / Send to Zebra were incorrectly disabled
   when the current page was empty even if other pages had content.
   Switched to checking pages.some(p => p.objects.length > 0).

2. The "Add page" menu entry was hardcoded English. Added the
   t.app.addPage translation key across all 32 locales.
@u8array u8array merged commit 66ffa3b into main May 3, 2026
2 checks passed
@u8array u8array deleted the feature/multi-label-pagination branch May 4, 2026 08:10
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.

1 participant