Show remaining spool weigth instead of used

This commit is contained in:
Matteo Parenti
2026-02-17 17:25:04 +01:00
parent e17b55fe22
commit 7efbb1fc58
4 changed files with 12 additions and 5 deletions
+1 -1
View File
@@ -177,7 +177,7 @@ export function AssignSpoolModal({ isOpen, onClose, printerId, amsId, trayId, tr
<p className="text-xs text-bambu-gray">
{spool.color_name || ''}
{spool.label_weight ? ` - ${spool.label_weight}g` : ''}
{spool.weight_used > 0 ? ` (${Math.round(spool.weight_used)}g used)` : ''}
{spool.label_weight ? ` (${Math.max(0, Math.round(spool.label_weight - spool.weight_used))}g remaining)` : ''}
</p>
</div>
{selectedSpoolId === spool.id && (
@@ -24,7 +24,7 @@ interface SpoolmanConfig {
interface InventoryConfig {
onAssignSpool?: () => void;
onUnassignSpool?: () => void;
assignedSpool?: { id: number; material: string; brand: string | null; color_name: string | null } | null;
assignedSpool?: { id: number; material: string; brand: string | null; color_name: string | null; remainingWeightGrams?: number | null } | null;
}
interface ConfigureSlotConfig {
@@ -148,6 +148,7 @@ export function FilamentHoverCard({ data, children, disabled, className = '', sp
};
const colorHex = data.colorHex ? `#${data.colorHex.replace('#', '')}` : null;
const assignedRemainingWeight = inventory?.assignedSpool?.remainingWeightGrams ?? null;
return (
<div
@@ -238,7 +239,10 @@ export function FilamentHoverCard({ data, children, disabled, className = '', sp
{t('ams.fill')}
</span>
<span className="text-xs text-white font-semibold flex items-center gap-1">
{data.fillLevel !== null ? `${data.fillLevel}%` : '—'}
<span>{data.fillLevel !== null ? `${data.fillLevel}%` : '—'}</span>
{assignedRemainingWeight !== null && data.fillLevel !== null && (
<span className="text-[9px] text-bambu-gray font-normal">• {assignedRemainingWeight}g</span>
)}
{data.fillSource === 'spoolman' && data.fillLevel !== null && (
<span className="text-[9px] text-bambu-gray font-normal">{t('spoolman.fillSourceLabel')}</span>
)}