-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/multi label pagination #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b916eda
refactor(store): introduce pages array as foundation for multi-label …
u8array a7818f9
feat(canvas): add pagination control for multi-label navigation
u8array ea61b4e
feat(zpl): export and display all pages as concatenated ZPL blocks
u8array 6697a63
feat(zpl): import multi-label ZPL into pages
u8array ecd5be3
feat(design-file): save/load multi-page JSON with legacy fallback
u8array cc2ff1b
docs(readme): document multi-page support
u8array 46c858e
refactor(canvas): hide pagination control on single-page documents
u8array 621c6ce
fix(zpl-import): split on case-insensitive ^XA
u8array f2f64be
fix(app): document-wide hasObjects + i18n for "Add page"
u8array File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| import { useLabelStore } from "../../store/labelStore"; | ||
|
|
||
| export function PaginationControl() { | ||
| const pageCount = useLabelStore((s) => s.pages.length); | ||
| const currentPageIndex = useLabelStore((s) => s.currentPageIndex); | ||
| const setCurrentPage = useLabelStore((s) => s.setCurrentPage); | ||
| const addPage = useLabelStore((s) => s.addPage); | ||
| const removePage = useLabelStore((s) => s.removePage); | ||
|
|
||
| // Hide entirely on single-page documents; "Add page" lives in the File menu. | ||
| if (pageCount <= 1) return null; | ||
|
|
||
| const canPrev = currentPageIndex > 0; | ||
| const canNext = currentPageIndex < pageCount - 1; | ||
| const canRemove = pageCount > 1; | ||
|
|
||
| return ( | ||
| <div className="absolute bottom-3 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1 bg-surface border border-border rounded px-1 py-0.5"> | ||
| <button | ||
| onClick={() => canPrev && setCurrentPage(currentPageIndex - 1)} | ||
| disabled={!canPrev} | ||
| title="Previous page (Page Up)" | ||
| aria-label="Previous page" | ||
| className="w-6 h-6 flex items-center justify-center text-muted hover:text-text disabled:opacity-25 disabled:cursor-not-allowed font-mono text-sm transition-colors" | ||
| > | ||
| ‹ | ||
| </button> | ||
| <span className="font-mono text-[10px] text-text px-2 select-none whitespace-nowrap"> | ||
| Page {currentPageIndex + 1} / {pageCount} | ||
| </span> | ||
| <button | ||
| onClick={() => canNext && setCurrentPage(currentPageIndex + 1)} | ||
| disabled={!canNext} | ||
| title="Next page (Page Down)" | ||
| aria-label="Next page" | ||
| className="w-6 h-6 flex items-center justify-center text-muted hover:text-text disabled:opacity-25 disabled:cursor-not-allowed font-mono text-sm transition-colors" | ||
| > | ||
| › | ||
| </button> | ||
| <div className="w-px h-3.5 bg-border mx-0.5" /> | ||
| <button | ||
| onClick={addPage} | ||
| title="Add page" | ||
| aria-label="Add page" | ||
| className="w-6 h-6 flex items-center justify-center text-muted hover:text-text font-mono text-sm transition-colors" | ||
| > | ||
| + | ||
| </button> | ||
| <button | ||
| onClick={() => canRemove && removePage(currentPageIndex)} | ||
| disabled={!canRemove} | ||
| title="Delete current page" | ||
| aria-label="Delete current page" | ||
| className="w-6 h-6 flex items-center justify-center text-muted hover:text-text disabled:opacity-25 disabled:cursor-not-allowed font-mono text-sm transition-colors" | ||
| > | ||
| − | ||
| </button> | ||
| </div> | ||
| ); | ||
| } | ||
|
u8array marked this conversation as resolved.
|
||
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
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
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
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.