feat: advanced label designer for spool print page#14
Conversation
b035b11 to
585c9f7
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 585c9f74fe
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
a9eaf00 to
53d9961
Compare
bb182b2 to
79ab91a
Compare
|
@codex review |
79ab91a to
03b8bc4
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 79ab91a767
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
03b8bc4 to
a34a9c5
Compare
|
@ManuelW77 I am curious what you think about this |
|
Hi @akira69 ,
But i can't see you advanced label designer - as i'm also don't know how to do it (obviously) correct, can you please provide me how to do this right? Thanks in advance. |
|
I can do a build for for you. Let me figure that out and I'll send you a link or something. It's because in my fork it is just a PR and it's not actually merged. |
|
Actually if you grab my specific branch you can build it: Here are minimal instructions for building my Instructions to Build and Run in Docker
|
|
Thanks, seems my missing step was the 'git checkout' - had to use the 'main' run command, but now i can test a few things. Looks very promising to me. |
|
@Tschipel Full disclaimer ahead, certainly there are issues and errors that need to be improved in the label designer tab implementation. This is part of the reason I didn't do a PR upstream. However, let me try to address your points:
I thought I had squashed this bug, the regular print tab should not change if the label designer is adjusted (in fact I even added a screenshot proving this in my PR...) could be that I didn't commit that fix from my local workspace or there's a further bug I missed.
The intent here is to have the print label function un-affected by the new label designer tab. and therefore 2 separate label printing areas. I felt this was easier to get implemented, as the label designer is quite complex in comparison. However as mentioned above these should be completely separated - if there's cross-talk that's a bug. or if it's not saving - that's a bug. Please try to exercise the preset saving function - perhaps there's a bug or a missing feature that doesn't retain the label designer changes without saving a preset.
perhaps that logo element is not getting pulled successfully - To fix this, it should be a asset in the build and not pulled from a webpage. I will try to fix it.
do you see that bug in the label designer? I can't test it right now myself. |
- backend: add ruff>=0.4 and mypy>=1.10 to dev optional-dependencies with ruff config (E/W/F/I/UP/B rules, py311 target, 120 char line) and mypy config (ignore_missing_imports, check_untyped_defs) - frontend: add eslint, typescript-eslint, eslint-plugin-astro as devDependencies; add 'check' (astro check) and 'lint' scripts scoped to PR #14 files only ([id]/index.astro, [id]/print.astro, src/lib/label-template.ts) - frontend: create eslint.config.mjs with flat config for TS + Astro - fix: replace @ts-ignore with @ts-expect-error in [id]/index.astro (QRCode UMD global) as required by @typescript-eslint/ban-ts-comment
- backend: add ruff>=0.4 and mypy>=1.10 to dev optional-dependencies with ruff config (E/W/F/I/UP/B rules, py311 target, 120 char line) and mypy config (ignore_missing_imports, check_untyped_defs) - frontend: add eslint, typescript-eslint, eslint-plugin-astro as devDependencies; add 'check' (astro check) and 'lint' scripts scoped to PR #14 files only ([id]/index.astro, [id]/print.astro, src/lib/label-template.ts) - frontend: create eslint.config.mjs with flat config for TS + Astro - fix: replace @ts-ignore with @ts-expect-error in [id]/index.astro (QRCode UMD global) as required by @typescript-eslint/ban-ts-comment
- backend: add ruff>=0.4 and mypy>=1.10 to dev optional-dependencies with ruff config (E/W/F/I/UP/B rules, py311 target, 120 char line) and mypy config (ignore_missing_imports, check_untyped_defs) - frontend: add eslint, typescript-eslint, eslint-plugin-astro as devDependencies; add 'check' (astro check) and 'lint' scripts scoped to PR #14 files only ([id]/index.astro, [id]/print.astro, src/lib/label-template.ts) - frontend: create eslint.config.mjs with flat config for TS + Astro - fix: replace @ts-ignore with @ts-expect-error in [id]/index.astro (QRCode UMD global) as required by @typescript-eslint/ban-ts-comment
|
@Tschipel : I did fix a bunch of bugs - maybe you'd find it resolving all the issues you noted, I hope :D |
|
Wonderful - a lot of bugs are fixed - but the behavior for not touched 'print settings' tab is still different |
ooof, embarrassing - bad testing on my part |
|
@Tschipel I need to build this and test myself in detail but I think it's fixed: Commit The fix moves |
791f71a to
cc1425b
Compare
|
Two additional fixes landed in cc1425b from an exhaustive cross-contamination audit run after the main fix:
The audit found no other cross-contamination pathways. Zoom state is intentionally shared between tabs as a UI preference. localStorage keys are separate per tab. |
Adds a per-spool label designer at /spools/[id]/print with: - Interactive label preview (print to scale) - Logo, title, QR code, information, side column sections - Preset save/load/delete with dirty tracking - Template parser with token substitution - 2nd title row and 2nd information column support - PDF/PNG export
Updates spool detail page to link to /spools/[id]/print with pre-populated query params and extra fields via sessionStorage
- make title ==...== render full-row inverse consistently - allow [size=..] tags case-insensitively in template markup - move QR custom URL field under link mode context and relabel as base URL - append spool ID automatically for QR custom URL mode - remove QR URL token chips to avoid template confusion - add i18n keys for QR custom URL base label/hint
- add {color-swatch[N]} token support (N in ch units, default 8)
- render swatch from filament.color_hex with safe normalization
- support swatch token in optional token blocks
- expose swatch token in designer token chips and syntax help
- make title and subtitle format controls auto-growing wrapped textareas - move QR custom URL base above position and vertical align controls - clarify syntax help that size works with field values and swatches - simplify color swatch helper text
- add @@text@@ markup for filament-color inverse styling - choose black or white text automatically from color brightness - support full-row title/subtitle color inverse when template is wrapped in @@...@@ - document the new syntax in template help
…nt preview The previous fix (cda0350) added labelPreview.innerHTML = '' in activateTab for both tab directions, which correctly cleared cross-tab DOM pollution but introduced a new regression: the module-level qrContainer reference captured the original static HTML element at init time. After innerHTML clear, that element was detached from the DOM. ensureClassicPreviewLayout() rebuilt the HTML with a new label-qr-container element, but qrContainer still pointed to the dead original -- so all QR rendering in updatePreview wrote to a detached node and QR code never appeared in Print Settings on any render. Fixes: - Remove module-level qrContainer capture; declare it as a local variable inside updatePreview() after ensureClassicPreviewLayout() runs, so it always references the current DOM element - Add activePreviewTab guard at the start of updatePre- Add activePreviewTab guard at the start of updatePre- Add activePreviewTab guard at the start of updatePre- Add activePreviewTab guard at the start oasync renders that yield across a tab switch are correctly abandoned rather than completing completing completing completing completing completing completis: completing completing completing completing completing completi: completing completing completing completing completing completa completing completing completing completing completing completer completing completing completing completing completing completasigner tab - npm run lint: 0 errors; npm run check: passed; npm run build: passed
…cleanup Two follow-up fixes from exhaustive cross-contamination audit: - Add `transform: none` and `transform-origin: unset` to the @media print rules in both updatePreview and updateDesignerPreview. Without this, printing with preview zoom != 100% would scale the printed label by the zoom factor, producing incorrect label dimensions on physical paper. - In activateTab()'s print branch, explicitly clear the designer's inline border and padding before the async updatePreview call, matching the symmetrical cleanup already present in the designer branch. Eliminates the brief flash of the designer's dashed border during the QR library await on tab switch. Audit result: no other cross-contamination pathways found between tabs. Zoom state is intentionally shared (UI preference). localStorage keys are separate. buildSpoolData() is pure. style#page-style is always replaced. Also fixed in this patch set (companion commit 3db8eb5): - Move qrContainer capture inside updatePreview() after ensureClassicPreviewLayout() so it always references the live DOM node rather than the detached original after innerHTML clear - Add activePreviewTab guards to both updatePreview() and updateDesignerPreview() so async renders that straddle a tab switch are correctly abandoned instead of writing into the wrong tab's DOM - Strengthen isStale() checks to also bail when the render's target tab is no longer active - Replace @ts-ignore with @ts-expect-error; fix let -> const lint warnings
cc1425b to
75e5533
Compare



Advanced Label Designer
Replaces the existing simple print page with a full label designer accessible per-spool at
/spools/{id}/print.What's New
Two-tab interface:
Label Designer features:
localStorage){filament.name}token, max font size, fit-to-width, line above/below, justification, margincolor_swatch[1],id,name,type,subtype,color,color_hex,manufacturer,extruder_temp,bed_temp,weight,diameter,finish,density,priceid,remaining_weight,tag,location,purchased_atNew files:
frontend/src/lib/label-template.ts(227 lines) — token substitution engine, preset serialization, render helpersfrontend/src/pages/spools/[id]/print.astro(3800+ lines) — complete label designer pagei18n: +54 translation strings in
en.jsonandde.jsonNo backend changes — pure frontend addition; no new migrations.
Screenshots
Label preview with manufacturer logo, material, color and print temps:
Zoomed-in label preview:
Print Settings tab:
Label Designer — template config with token chips: