mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-09-30 11:12:35 +02:00
Show remaining spool weigth instead of used
This commit is contained in:
@@ -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>
|
||||
)}
|
||||
|
||||
@@ -2347,7 +2347,7 @@ export default {
|
||||
kProfiles: 'K-Profiles',
|
||||
addKProfile: 'Aggiungi K-Profile',
|
||||
assignSpool: 'Assegna Bobina',
|
||||
unassignSpool: 'Deassegna',
|
||||
unassignSpool: 'Scollega',
|
||||
assignSuccess: 'Bobina assegnata e slot AMS configurato',
|
||||
assignFailed: 'Assegnazione bobina fallita',
|
||||
selectSpool: 'Seleziona una bobina da assegnare a questo slot',
|
||||
@@ -2397,7 +2397,7 @@ export default {
|
||||
externalSpool: 'Bobina esterna',
|
||||
profile: 'Profilo',
|
||||
kFactor: 'K Factor',
|
||||
fill: 'Riempi',
|
||||
fill: 'Residuo',
|
||||
configure: 'Configura',
|
||||
},
|
||||
|
||||
|
||||
@@ -2906,6 +2906,7 @@ function PrinterCard({
|
||||
material: assignment.spool.material,
|
||||
brand: assignment.spool.brand,
|
||||
color_name: assignment.spool.color_name,
|
||||
remainingWeightGrams: Math.max(0, Math.round(assignment.spool.label_weight - assignment.spool.weight_used)),
|
||||
} : null,
|
||||
onAssignSpool: filamentData.vendor !== 'Bambu Lab' ? () => setAssignSpoolModal({
|
||||
printerId: printer.id,
|
||||
@@ -3144,6 +3145,7 @@ function PrinterCard({
|
||||
material: assignment.spool.material,
|
||||
brand: assignment.spool.brand,
|
||||
color_name: assignment.spool.color_name,
|
||||
remainingWeightGrams: Math.max(0, Math.round(assignment.spool.label_weight - assignment.spool.weight_used)),
|
||||
} : null,
|
||||
onAssignSpool: filamentData.vendor !== 'Bambu Lab' ? () => setAssignSpoolModal({
|
||||
printerId: printer.id,
|
||||
@@ -3330,6 +3332,7 @@ function PrinterCard({
|
||||
material: assignment.spool.material,
|
||||
brand: assignment.spool.brand,
|
||||
color_name: assignment.spool.color_name,
|
||||
remainingWeightGrams: Math.max(0, Math.round(assignment.spool.label_weight - assignment.spool.weight_used)),
|
||||
} : null,
|
||||
onAssignSpool: () => setAssignSpoolModal({
|
||||
printerId: printer.id,
|
||||
|
||||
Reference in New Issue
Block a user