mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-17 11:25:48 +02:00
feat(queue): show spool grams left in filament slot mapping
This commit is contained in:
@@ -52,6 +52,21 @@ export function FilamentMapping({
|
||||
return map;
|
||||
}, [assignments]);
|
||||
|
||||
const trayRemainingWeightMap = useMemo(() => {
|
||||
const map = new Map<number, number | null>();
|
||||
for (const assignment of assignments || []) {
|
||||
const isExternal = assignment.ams_id === 255;
|
||||
const globalTrayId = getGlobalTrayId(assignment.ams_id, assignment.tray_id, isExternal);
|
||||
const spool = assignment.spool;
|
||||
if (!spool) {
|
||||
map.set(globalTrayId, null);
|
||||
continue;
|
||||
}
|
||||
map.set(globalTrayId, Math.max(0, Math.round((spool.label_weight ?? 0) - (spool.weight_used ?? 0))));
|
||||
}
|
||||
return map;
|
||||
}, [assignments]);
|
||||
|
||||
const totalCost = useMemo(() => {
|
||||
let total = 0;
|
||||
for (const item of filamentComparison) {
|
||||
@@ -198,11 +213,20 @@ export function FilamentMapping({
|
||||
</option>
|
||||
{loadedFilaments
|
||||
.filter((f) => item.nozzle_id == null || f.extruderId === item.nozzle_id)
|
||||
.map((f) => (
|
||||
.map((f) => {
|
||||
const remainingWeight = trayRemainingWeightMap.get(f.globalTrayId);
|
||||
const remainingLabel = remainingWeight != null
|
||||
? t('printModal.slotRemainingShort', {
|
||||
grams: remainingWeight,
|
||||
defaultValue: ` - ${remainingWeight}g left`,
|
||||
})
|
||||
: '';
|
||||
return (
|
||||
<option key={f.globalTrayId} value={f.globalTrayId} className="bg-bambu-dark text-white">
|
||||
{f.label}: {f.type} ({f.colorName})
|
||||
{f.label}: {f.type} ({f.colorName}){remainingLabel}
|
||||
</option>
|
||||
))}
|
||||
);
|
||||
})}
|
||||
</select>
|
||||
{/* Status icon */}
|
||||
{item.status === 'match' ? (
|
||||
|
||||
@@ -2744,6 +2744,7 @@ export default {
|
||||
selectPlate: 'Platte auswählen',
|
||||
filamentMapping: 'Filamentzuordnung',
|
||||
totalCost: 'Gesamtkosten:',
|
||||
slotRemainingShort: ' - {{grams}}g übrig',
|
||||
printSettings: 'Druckeinstellungen',
|
||||
bedLeveling: 'Bett-Nivellierung',
|
||||
flowCalibration: 'Fluss-Kalibrierung',
|
||||
|
||||
@@ -2748,6 +2748,7 @@ export default {
|
||||
selectPlate: 'Select Plate',
|
||||
filamentMapping: 'Filament Mapping',
|
||||
totalCost: 'Total cost:',
|
||||
slotRemainingShort: ' - {{grams}}g left',
|
||||
printSettings: 'Print Settings',
|
||||
bedLeveling: 'Bed Leveling',
|
||||
flowCalibration: 'Flow Calibration',
|
||||
|
||||
@@ -2732,6 +2732,7 @@ export default {
|
||||
selectPlate: 'Choisir le plateau',
|
||||
filamentMapping: 'Mapping Filament',
|
||||
totalCost: 'Coût total :',
|
||||
slotRemainingShort: ' - {{grams}}g rest.',
|
||||
printSettings: 'Réglages d\'impression',
|
||||
bedLeveling: 'Nivellement plateau',
|
||||
flowCalibration: 'Calibration débit',
|
||||
|
||||
@@ -2457,6 +2457,7 @@ export default {
|
||||
selectPlate: 'Seleziona piatto',
|
||||
filamentMapping: 'Mappatura filamento',
|
||||
totalCost: 'Costo totale:',
|
||||
slotRemainingShort: ' - {{grams}}g rim.',
|
||||
printSettings: 'Impostazioni stampa',
|
||||
bedLeveling: 'Livellamento piatto',
|
||||
flowCalibration: 'Calibrazione flusso',
|
||||
|
||||
@@ -2666,6 +2666,7 @@ export default {
|
||||
selectPlate: 'プレートを選択',
|
||||
filamentMapping: 'フィラメントマッピング',
|
||||
totalCost: '合計コスト:',
|
||||
slotRemainingShort: ' - 残{{grams}}g',
|
||||
printSettings: '印刷設定',
|
||||
bedLeveling: 'ベッドレベリング',
|
||||
layerInspection: '第一層検査',
|
||||
|
||||
@@ -2742,6 +2742,7 @@ export default {
|
||||
selectPlate: 'Selecionar Placa',
|
||||
filamentMapping: 'Mapeamento de Filamento',
|
||||
totalCost: 'Custo total:',
|
||||
slotRemainingShort: ' - {{grams}}g rest.',
|
||||
printSettings: 'Configurações de Impressão',
|
||||
bedLeveling: 'Nivelamento da Mesa',
|
||||
flowCalibration: 'Calibração de Fluxo',
|
||||
|
||||
Reference in New Issue
Block a user