mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-20 00:38:38 +02:00
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:
@@ -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'),
|
||||
|
||||
Reference in New Issue
Block a user