fix(queue): extend Charcoal-style label fix to Specific-Printer panel (#1718 round 3)

Round 2 fixed the model-mode FilamentOverride: tray_info_idx →
  sub-brand, plus a material-disambiguated colour name from a new
  /inventory/colors/by-material endpoint. The printer-mode panel that
  renders the same 3MF (FilamentMapping) was reading the same raw
  fields — item.type for the required label, getColorName(item.color)
  for the swatch tooltip — and was not touched, so picking "Specific
  Printer" still showed "Required: PLA - Black" for a slice the
  "Any H2D" branch already labelled "Bambu PLA Matte - Charcoal".

  Extract the three-query resolution machinery from FilamentOverride
  into a shared hook useFilamentLabels (returns positional
  {resolvedName, colorLabel} per slot). Both panels call it; both
  read the same labels. The hook also owns extractMaterialHint so the
  "strip leading brand token" rule has one source of truth.

  FilamentMapping required-side now reads {resolvedName} instead of
  {item.type}; swatch tooltip reads `Required: {resolvedName} -
  {colorLabel}` instead of `Required: {item.type} -
  getColorName(item.color)`.
This commit is contained in:
maziggy
2026-06-11 14:49:52 +02:00
parent 3b1395e3c0
commit 6b477088a2
13 changed files with 1323 additions and 429 deletions
+14
View File
@@ -4529,6 +4529,20 @@ export const api = {
getFilamentIdMap: () =>
request<Record<string, string>>('/cloud/filament-id-map'),
/** Material-disambiguated hex→name lookup. Same hex can map to different
* catalog names depending on material (e.g. #000000 is "Charcoal" in PLA
* Matte but "Black" in PLA Basic). The flat ``/inventory/colors/map``
* collapses these to the first hit; this endpoint preserves the material
* context. Returns ``{color_name: null}`` when the hex isn't in the
* catalog at all. #1718. */
getColorByMaterial: (hex: string, material?: string) => {
const params = new URLSearchParams({ hex });
if (material) params.set('material', material);
return request<{ color_name: string | null }>(
`/inventory/colors/by-material?${params.toString()}`,
);
},
// MakerWorld URL-paste import flow.
getMakerworldStatus: () =>
request<MakerworldStatus>('/makerworld/status'),