Skip to content

Commit f20897d

Browse files
committed
feat(manufacturers): add logo-aware UI and label workflows on top of export
- Add manufacturer logo management (upload, delete, organization) - Integrate logos into label print dialogs (positioning, sizing) - Add vendor logo components and utilities - Support logo source toggle (color/print profile) - Add i18n strings for logo UI elements - Extend vendor database with logo support This commit layers vendor logo features on top of the export workflow. All export functionality is preserved; logos are optional additions to print/export dialogs.
1 parent e81b670 commit f20897d

23 files changed

Lines changed: 2167 additions & 385 deletions

.playwright-cli/page-2026-03-14T13-03-08-306Z.yml

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- generic [ref=e2]: loading

client/public/locales/en/common.json

Lines changed: 112 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,12 @@
6565
"helpMargin": "Margins should be configured to match your label paper and printer, changing these will affect the size of the entire grid.",
6666
"helpPrinterMargin": "Safe-Zone should be set to how close to the paper edge your printer can print, changing these will not affect the entire grid.",
6767
"print": "Print",
68-
"exportLabels": "Export Labels",
6968
"columns": "Columns",
7069
"rows": "Rows",
7170
"paperSize": "Paper Size",
7271
"customSize": "Custom",
7372
"dimensions": "Dimensions",
7473
"amlLabelSize": "AML Label Size",
75-
"exportFormat": "Export Format",
76-
"exportFormatOptions": {
77-
"png": "PNG",
78-
"aml": "AML"
79-
},
80-
"exportAsZip": "Export as .zip",
81-
"exportDpi": "Export DPI",
82-
"exportDpiHelp": "Higher DPI makes sharper PNG/AML exports but increases file size and export time.",
8374
"showBorder": "Show Border",
8475
"previewScale": "Preview Scale",
8576
"skipItems": "Skip Items",
@@ -102,10 +93,6 @@
10293
"grid": "Grid"
10394
},
10495
"settings": "Presets",
105-
"spoolPrintPresets": "Spool Print Presets",
106-
"filamentPrintPresets": "Filament Print Presets",
107-
"spoolImagePresets": "Spool Image Presets",
108-
"filamentImagePresets": "Filament Image Presets",
10996
"defaultSettings": "Default",
11097
"addSettings": "Add New Preset",
11198
"newSetting": "New",
@@ -114,27 +101,76 @@
114101
"deleteSettingsConfirm": "Are you sure you want to delete this preset?",
115102
"settingsName": "Preset Name",
116103
"saveSetting": "Save Presets",
104+
"savePreset": "Save Preset",
117105
"saveAsImage": "Save as Image",
118-
"saveAsAmlLabels": "Save as AML (Labels)"
106+
"saveAsAmlLabels": "Save as AML (Labels)",
107+
"saveAsAmlPages": "Save as AML (Pages)",
108+
"spoolImagePresets": "Spool Image Presets",
109+
"filamentImagePresets": "Filament Image Presets",
110+
"exportFormat": "Export Format",
111+
"exportFormatOptions": {
112+
"png": "PNG",
113+
"aml": "AML"
114+
},
115+
"exportAsZip": "Export as .zip",
116+
"exportDpi": "Export DPI",
117+
"exportDpiHelp": "Higher DPI improves image quality for exports but increases file size.",
118+
"exportLabels": "Export Labels",
119+
"filenamePreview": "Filename Preview",
120+
"filenamePreviewAdditional": "Additional Example",
121+
"zipFilenamePreview": "ZIP Filename"
119122
},
120123
"qrcode": {
121124
"button": "Print Labels",
125+
"selectButton": "Print / Export Labels",
122126
"exportButton": "Export Labels",
127+
"selectTitle": "Export / Print Labels",
123128
"exportFilamentTitle": "Export Filament Labels",
124129
"exportSpoolTitle": "Export Spool Labels",
125130
"printFilamentTitle": "Print Filament Labels",
126131
"printSpoolTitle": "Print Spool Labels",
127-
"selectButton": "Export/Print",
128-
"selectTitle": "Export / Print Labels",
129132
"title": "Label Printing",
133+
"sectionLogo": "Logo",
134+
"sectionTitle": "Title",
135+
"sectionQRCode": "QR Code",
136+
"sectionInformation": "Information",
130137
"template": "Label Template",
131-
"filenameTemplate": "Filename Template",
132-
"filenameTemplateTooltipSpool": "Use {} to insert values of the spool object as text. Refer to the label template rules and available tags for more details.",
133-
"filenameTemplateTooltipFilament": "Use {} to insert values of the filament object as text. Refer to the label template rules and available tags for more details.",
134-
"templateHelp": "Use {} to insert values of the spool object as text. For example, {id} will be replaced with the spool id, or {filament.material} will be replaced with the material of the spool. if a value is missing it will be replaced with \"?\". A second set of {} can be used to remove this. In addition, any text between the sets of {} will be removed if the value is missing. For example, {Lot Nr: {lot_nr}} will only show the label if the spool has a lot number. Enclose text with double asterix ** to make it bold. Click the button to view a list of all available tags.",
135-
"templateHelpFilament": "Use {} to insert values of the filament object as text. For example, {id} will be replaced with the filament id, or {vendor.name} will be replaced with the vendor name. If a value is missing it will be replaced with \"?\". A second set of {} can be used to remove this. In addition, any text between the sets of {} will be removed if the value is missing. For example, {Article: {article_number}} will only show the label if a filament has an article number. Enclose text with double asterix ** to make it bold. Click the button to view a list of all available tags.",
138+
"titleTemplate": "Title Template",
139+
"infoTemplate": "Information Template",
140+
"templateHelp": "Use {} to insert values of the spool object as text. For example, {id} will be replaced with the spool id, or {filament.material} will be replaced with the material of the spool. if a value is missing it will be replaced with \"?\". A second set of {} can be used to remove this. In addition, any text between the sets of {} will be removed if the value is missing. For example, {Lot Nr: {lot_nr}} will only show the label if the spool has a lot number. Enclose text with double asterix ** to make it bold, and use ==text== to invert text. Click the button to view a list of all available tags.",
141+
"templateHelpFilament": "Use {} to insert values of the filament object as text. For example, {id} will be replaced with the filament id, or {vendor.name} will be replaced with the vendor name. If a value is missing it will be replaced with \"?\". A second set of {} can be used to remove this. In addition, any text between the sets of {} will be removed if the value is missing. For example, {Article: {article_number}} will only show the label if a filament has an article number. Enclose text with double asterix ** to make it bold, and use ==text== to invert text. Click the button to view a list of all available tags.",
136142
"textSize": "Label Text Size",
137-
"showContent": "Print Label",
143+
"infoTextSize": "Information Text Size",
144+
"titleTextSize": "Title Text Size",
145+
"titleMaxTextSize": "Title Max Text Size",
146+
"titleAreaHeight": "Title Area Height",
147+
"showContent": "Show Information on label",
148+
"showManufacturerLogo": "Show Manufacturer Logo",
149+
"logoSource": "Logo Source",
150+
"logoSourceOptions": {
151+
"print": "Print Logo",
152+
"color": "Color Logo"
153+
},
154+
"showTitle": "Show Title",
155+
"titleFitToWidth": "Fit Title to Width",
156+
"titleFitToWidthOptions": {
157+
"on": "On",
158+
"off": "Off"
159+
},
160+
"appliedTextSize": "Applied Size",
161+
"logoSize": "Logo Size",
162+
"logoAlign": "Logo Horizontal Align",
163+
"titleAlign": "Title Horizontal Align",
164+
"qrCodePosition": "QR Code Position",
165+
"qrCodePositionLeft": "Left",
166+
"qrCodePositionRight": "Right",
167+
"qrCodeAlign": "QR Code Vertical Align",
168+
"qrCodeAlignTop": "Top",
169+
"qrCodeAlignCenter": "Center",
170+
"qrCodeAlignBottom": "Bottom",
171+
"qrCodeSize": "QR Code Size",
172+
"infoAlign": "Information Horizontal Align",
173+
"infoVerticalAlign": "Information Vertical Align",
138174
"useHTTPUrl": {
139175
"label": "QR code link",
140176
"tooltip": "Will use proprietary link that will work only if scanned from Spoolman's scanning feature (default). URL uses either the base URL specified in settings, or the current page URL if not set.",
@@ -149,12 +185,17 @@
149185
"no": "No",
150186
"simple": "Simple",
151187
"withIcon": "With Icon"
152-
}
188+
},
189+
"filenameTemplate": "Filename Template",
190+
"filenameTemplateTooltipSpool": "Use {} to insert values of the spool object as text. Refer to the label template rules and available tags for details.",
191+
"filenameTemplateTooltipFilament": "Use {} to insert values of the filament object as text. Refer to the label template rules and available tags for details.",
192+
"titleTemplateTooltipSpool": "Use {} to insert values of the spool object as text. Refer to the label template rules and available tags for details.",
193+
"titleTemplateTooltipFilament": "Use {} to insert values of the filament object as text. Refer to the label template rules and available tags for details."
153194
},
154195
"spoolSelect": {
155196
"title": "Select Spools",
156-
"description": "Select spools to export or print labels for.",
157-
"searchPlaceholder": "Search vendor, filament, material, location, lot #",
197+
"description": "Select spools to print labels for.",
198+
"searchPlaceholder": "Search vendor, name, material, lot #",
158199
"showArchived": "Show Archived",
159200
"noSpoolsSelected": "You have not selected any spools.",
160201
"selectAll": "Select/Unselect All",
@@ -163,7 +204,7 @@
163204
},
164205
"filamentSelect": {
165206
"title": "Select Filaments",
166-
"description": "Select filaments to export or print labels for.",
207+
"description": "Select filaments to print labels for.",
167208
"searchPlaceholder": "Search vendor, name, material, article #",
168209
"noFilamentsSelected": "You have not selected any filaments.",
169210
"selectAll": "Select/Unselect All",
@@ -305,14 +346,27 @@
305346
"vendor": "Manufacturers",
306347
"fields": {
307348
"id": "ID",
349+
"logo": "Logo",
350+
"logo_url": "Logo URL",
351+
"print_logo_url": "Print Logo URL",
352+
"logo_preview": "Logo Preview",
353+
"print_logo_preview": "Print Logo Preview",
308354
"name": "Name",
309355
"empty_spool_weight": "Empty Spool Weight",
310356
"external_id": "External ID",
311357
"registered": "Registered",
312-
"comment": "Comment"
358+
"comment": "Comment",
359+
"logo_suggestions": "Logo Suggestions",
360+
"print_logo_suggestions": "Print Logo Suggestions",
361+
"logo_suggestions_placeholder": "Select a suggested logo path",
362+
"logo_suggestions_none": "None"
313363
},
314364
"fields_help": {
315-
"empty_spool_weight": "The weight of an empty spool from this manufacturer."
365+
"empty_spool_weight": "The weight of an empty spool from this manufacturer.",
366+
"logo_url": "Optional custom logo used in the UI. Supports absolute URLs or local paths like /vendor-logos/web/bambu-lab-web.png. Use any image your browser can display from that path or URL.",
367+
"print_logo_url": "Optional custom logo used for label rendering. Supports absolute URLs or local paths like /vendor-logos/print/bambu-lab.png. Use any image your browser can display from that path or URL.",
368+
"logo_suggestions": "Checks available logo files in /vendor-logos/web for names similar to this manufacturer.",
369+
"print_logo_suggestions": "Checks available logo files in /vendor-logos/print for names similar to this manufacturer."
316370
},
317371
"titles": {
318372
"create": "Create Manufacturer",
@@ -322,8 +376,27 @@
322376
"show": "Show Manufacturer",
323377
"show_title": "[Manufacturer #{{id}}] {{name}}"
324378
},
379+
"buttons": {
380+
"sync_logos": "Sync Logos",
381+
"clear_logo_url": "Clear URL",
382+
"convert_logo_to_print": "Convert Logo to Print",
383+
"convert_logo_to_print_help": "Creates a black-and-white print logo from the current Logo URL and stores it as a separate local print logo file.",
384+
"convert_logo_to_print_help_locked": "A Print Logo URL is already set. Clear Print Logo URL to enable creating a new print logo from the current Logo URL."
385+
},
386+
"logo_filter": {
387+
"has_logo": "Has Logo",
388+
"no_logo": "No Logo"
389+
},
325390
"form": {
326-
"vendor_updated": "This manufacturer has been updated by someone/something else since you opened this page. Saving will overwrite those changes!"
391+
"vendor_updated": "This manufacturer has been updated by someone/something else since you opened this page. Saving will overwrite those changes!",
392+
"logo_sync_no_match": "No matching logos found for this manufacturer name.",
393+
"logo_sync_applied": "Suggested logo paths applied.",
394+
"logo_preview_auto_notice": "using auto-matched logo from available logo files",
395+
"logo_preview_default_notice": "no logo defined, using default generated text logo",
396+
"logo_convert_requires_web_logo": "Set a Logo URL first.",
397+
"logo_convert_requires_empty_print_logo": "Clear Print Logo URL first to generate a new print logo.",
398+
"logo_convert_success": "Generated print logo from web logo.",
399+
"logo_convert_error": "Could not generate a print logo from this Logo URL."
327400
}
328401
},
329402
"home": {
@@ -358,6 +431,16 @@
358431
"round_prices": {
359432
"label": "Round prices",
360433
"tooltip": "Round prices to the nearest whole number."
434+
},
435+
"logo_sync": {
436+
"title": "Global Manufacturer Logo Sync",
437+
"description": "Syncs missing logo URLs across the whole manufacturer database using the bundled logo manifest. Existing logo URLs are not overwritten.",
438+
"where": "Source: /vendor-logos/manifest.json (bundled static web/print logo files). Matching ignores minor punctuation/case differences in names.",
439+
"button": "Sync Logos Now",
440+
"not_ready": "Logo manifest is not available yet.",
441+
"load_error": "Could not load manufacturers for logo sync.",
442+
"done": "Logo sync complete. Matched {{matched}}, updated {{updated}}.",
443+
"scope_note": "This action syncs the whole manufacturer database. You can sync a single manufacturer from its Edit page."
361444
}
362445
},
363446
"extra_fields": {

client/src/components/qrCodeScanner.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ const QRCodeScannerModal = () => {
1717
}
1818
const result = detectedCodes[0].rawValue;
1919

20-
// Accept both compact WEB+SPOOLMAN payloads and full show-page URLs so
21-
// exported and printed labels keep scanning after base URL changes.
20+
// Check for the spoolman ID format
2221
const spoolMatch = result.match(/^web\+spoolman:s-(?<id>[0-9]+)$/i);
2322
if (spoolMatch && spoolMatch.groups) {
2423
setVisible(false);
@@ -57,8 +56,6 @@ const QRCodeScannerModal = () => {
5756
onScan={onScan}
5857
formats={["qr_code"]}
5958
onError={(err: unknown) => {
60-
// Map browser/scanner-library failures onto translated messages instead of
61-
// exposing raw exception names in the modal.
6259
const error = err as Error;
6360
console.error(error);
6461
if (error.name === "NotAllowedError") {
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { CSSProperties, useEffect, useMemo, useState } from "react";
2+
import { IVendor } from "../pages/vendors/model";
3+
import { getVendorLogoCandidates } from "../utils/vendorLogo";
4+
5+
interface VendorLogoProps {
6+
vendor?: IVendor;
7+
usePrintLogo?: boolean;
8+
showFallbackText?: boolean;
9+
imgStyle?: CSSProperties;
10+
fallbackStyle?: CSSProperties;
11+
}
12+
13+
// Walk the vendor's candidate logo URLs in order, then optionally fall back to plain vendor text.
14+
export function VendorLogo({
15+
vendor,
16+
usePrintLogo = false,
17+
showFallbackText = false,
18+
imgStyle,
19+
fallbackStyle,
20+
}: VendorLogoProps) {
21+
const candidates = useMemo(() => getVendorLogoCandidates(vendor, usePrintLogo), [vendor, usePrintLogo]);
22+
const [currentCandidateIndex, setCurrentCandidateIndex] = useState(0);
23+
useEffect(() => {
24+
// Reset to the highest-priority candidate whenever the vendor or logo mode changes.
25+
setCurrentCandidateIndex(0);
26+
}, [vendor, usePrintLogo]);
27+
28+
const currentSrc = candidates[currentCandidateIndex];
29+
const fallbackText = vendor?.name ?? "";
30+
31+
if (currentSrc) {
32+
return (
33+
<img
34+
src={currentSrc}
35+
alt={vendor?.name ? `${vendor.name} logo` : "Manufacturer logo"}
36+
style={imgStyle}
37+
onError={() => {
38+
// Try the next candidate before giving up so a stale saved path can still fall
39+
// back to the local runtime logo filenames inferred from the vendor name.
40+
setCurrentCandidateIndex((idx) => idx + 1);
41+
}}
42+
/>
43+
);
44+
}
45+
46+
if (showFallbackText && fallbackText) {
47+
return <div style={fallbackStyle}>{fallbackText}</div>;
48+
}
49+
50+
return null;
51+
}
52+
53+
export default VendorLogo;

0 commit comments

Comments
 (0)