|
|
@@ -2763,7 +2763,7 @@ function PrinterCard({
|
|
|
// Get saved slot preset mapping (for user-configured slots)
|
|
|
const slotPreset = slotPresets?.[globalTrayId];
|
|
|
|
|
|
- // Fill level fallback chain: AMS remain → Spoolman → Inventory spool
|
|
|
+ // Fill level fallback chain: Spoolman → Inventory → AMS remain
|
|
|
const trayTag = tray?.tray_uuid?.toUpperCase();
|
|
|
const linkedSpool = trayTag ? linkedSpools?.[trayTag] : undefined;
|
|
|
const spoolmanFill = getSpoolmanFillLevel(linkedSpool);
|
|
|
@@ -2775,12 +2775,11 @@ function PrinterCard({
|
|
|
}
|
|
|
return null;
|
|
|
})();
|
|
|
- const effectiveFill = hasFillLevel && tray.remain > 0
|
|
|
- ? tray.remain
|
|
|
- : (spoolmanFill ?? inventoryFill ?? (hasFillLevel ? tray.remain : null));
|
|
|
- const fillSource = (hasFillLevel && tray.remain === 0 && (spoolmanFill !== null || inventoryFill !== null))
|
|
|
- ? (spoolmanFill !== null ? 'spoolman' as const : 'inventory' as const)
|
|
|
- : 'ams' as const;
|
|
|
+ const effectiveFill = spoolmanFill ?? inventoryFill ?? (hasFillLevel ? tray.remain : null);
|
|
|
+ const fillSource = spoolmanFill !== null ? 'spoolman' as const
|
|
|
+ : inventoryFill !== null ? 'inventory' as const
|
|
|
+ : hasFillLevel ? 'ams' as const
|
|
|
+ : undefined;
|
|
|
|
|
|
// Build filament data for hover card
|
|
|
const filamentData = tray?.tray_type ? {
|
|
|
@@ -2817,7 +2816,7 @@ function PrinterCard({
|
|
|
</div>
|
|
|
{/* Fill bar */}
|
|
|
<div className="mt-1 h-1.5 bg-black/30 rounded-full overflow-hidden">
|
|
|
- {effectiveFill !== null && effectiveFill >= 0 && tray ? (
|
|
|
+ {effectiveFill !== null && effectiveFill >= 0 && tray && (
|
|
|
<div
|
|
|
className="h-full rounded-full transition-all"
|
|
|
style={{
|
|
|
@@ -2825,9 +2824,7 @@ function PrinterCard({
|
|
|
backgroundColor: getFillBarColor(effectiveFill),
|
|
|
}}
|
|
|
/>
|
|
|
- ) : tray?.tray_type ? (
|
|
|
- <div className="h-full w-full rounded-full bg-white/50 dark:bg-gray-500/40" />
|
|
|
- ) : null}
|
|
|
+ )}
|
|
|
</div>
|
|
|
</div>
|
|
|
);
|
|
|
@@ -2987,7 +2984,7 @@ function PrinterCard({
|
|
|
// Get saved slot preset mapping (for user-configured slots)
|
|
|
const slotPreset = slotPresets?.[globalTrayId];
|
|
|
|
|
|
- // Fill level fallback chain: AMS remain → Spoolman → Inventory spool
|
|
|
+ // Fill level fallback chain: Spoolman → Inventory → AMS remain
|
|
|
const htTrayTag = tray?.tray_uuid?.toUpperCase();
|
|
|
const htLinkedSpool = htTrayTag ? linkedSpools?.[htTrayTag] : undefined;
|
|
|
const htSpoolmanFill = getSpoolmanFillLevel(htLinkedSpool);
|
|
|
@@ -3000,12 +2997,11 @@ function PrinterCard({
|
|
|
}
|
|
|
return null;
|
|
|
})();
|
|
|
- const htEffectiveFill = hasFillLevel && tray.remain > 0
|
|
|
- ? tray.remain
|
|
|
- : (htSpoolmanFill ?? htInventoryFill ?? (hasFillLevel ? tray.remain : null));
|
|
|
- const htFillSource = (hasFillLevel && tray.remain === 0 && (htSpoolmanFill !== null || htInventoryFill !== null))
|
|
|
- ? (htSpoolmanFill !== null ? 'spoolman' as const : 'inventory' as const)
|
|
|
- : 'ams' as const;
|
|
|
+ const htEffectiveFill = htSpoolmanFill ?? htInventoryFill ?? (hasFillLevel ? tray.remain : null);
|
|
|
+ const htFillSource = htSpoolmanFill !== null ? 'spoolman' as const
|
|
|
+ : htInventoryFill !== null ? 'inventory' as const
|
|
|
+ : hasFillLevel ? 'ams' as const
|
|
|
+ : undefined;
|
|
|
|
|
|
// Build filament data for hover card
|
|
|
const filamentData = tray?.tray_type ? {
|
|
|
@@ -3043,7 +3039,7 @@ function PrinterCard({
|
|
|
</div>
|
|
|
{/* Fill bar */}
|
|
|
<div className="mt-1 h-1.5 bg-black/30 rounded-full overflow-hidden">
|
|
|
- {htEffectiveFill !== null && htEffectiveFill >= 0 ? (
|
|
|
+ {htEffectiveFill !== null && htEffectiveFill >= 0 && (
|
|
|
<div
|
|
|
className="h-full rounded-full transition-all"
|
|
|
style={{
|
|
|
@@ -3051,9 +3047,7 @@ function PrinterCard({
|
|
|
backgroundColor: getFillBarColor(htEffectiveFill),
|
|
|
}}
|
|
|
/>
|
|
|
- ) : tray?.tray_type ? (
|
|
|
- <div className="h-full w-full rounded-full bg-white/50 dark:bg-gray-500/40" />
|
|
|
- ) : null}
|
|
|
+ )}
|
|
|
</div>
|
|
|
</div>
|
|
|
);
|
|
|
@@ -3264,7 +3258,12 @@ function PrinterCard({
|
|
|
}
|
|
|
return null;
|
|
|
})();
|
|
|
- const extEffectiveFill = extSpoolmanFill ?? extInventoryFill ?? null;
|
|
|
+ const extHasFillLevel = extTray.tray_type && extTray.remain >= 0;
|
|
|
+ const extEffectiveFill = extSpoolmanFill ?? extInventoryFill ?? (extHasFillLevel ? extTray.remain : null);
|
|
|
+ const extFillSource = extSpoolmanFill !== null ? 'spoolman' as const
|
|
|
+ : extInventoryFill !== null ? 'inventory' as const
|
|
|
+ : extHasFillLevel ? 'ams' as const
|
|
|
+ : undefined;
|
|
|
|
|
|
const extFilamentData = {
|
|
|
vendor: (isBambuLabSpool(extTray) ? 'Bambu Lab' : 'Generic') as 'Bambu Lab' | 'Generic',
|
|
|
@@ -3275,9 +3274,7 @@ function PrinterCard({
|
|
|
fillLevel: extEffectiveFill,
|
|
|
trayUuid: extTray.tray_uuid || null,
|
|
|
tagUid: extTray.tag_uid || null,
|
|
|
- fillSource: extSpoolmanFill !== null ? 'spoolman' as const
|
|
|
- : extInventoryFill !== null ? 'inventory' as const
|
|
|
- : undefined,
|
|
|
+ fillSource: extFillSource,
|
|
|
};
|
|
|
|
|
|
const isEmpty = !extTray.tray_type;
|
|
|
@@ -3295,7 +3292,7 @@ function PrinterCard({
|
|
|
{extTray.tray_type || '—'}
|
|
|
</div>
|
|
|
<div className="mt-1 h-1.5 bg-black/30 rounded-full overflow-hidden">
|
|
|
- {extEffectiveFill !== null && extEffectiveFill >= 0 && !isEmpty ? (
|
|
|
+ {extEffectiveFill !== null && extEffectiveFill >= 0 && !isEmpty && (
|
|
|
<div
|
|
|
className="h-full rounded-full transition-all"
|
|
|
style={{
|
|
|
@@ -3303,9 +3300,7 @@ function PrinterCard({
|
|
|
backgroundColor: getFillBarColor(extEffectiveFill),
|
|
|
}}
|
|
|
/>
|
|
|
- ) : !isEmpty ? (
|
|
|
- <div className="h-full w-full rounded-full bg-white/50 dark:bg-gray-500/40" />
|
|
|
- ) : null}
|
|
|
+ )}
|
|
|
</div>
|
|
|
{extLabel && <div className="text-[7px] text-white/40 mt-0.5 truncate">{extLabel}</div>}
|
|
|
</div>
|