diff --git a/frontend/src/components/PrintModal/FilamentMapping.tsx b/frontend/src/components/PrintModal/FilamentMapping.tsx index 46cda6e2a..a6ef51ffd 100644 --- a/frontend/src/components/PrintModal/FilamentMapping.tsx +++ b/frontend/src/components/PrintModal/FilamentMapping.tsx @@ -52,6 +52,21 @@ export function FilamentMapping({ return map; }, [assignments]); + const trayRemainingWeightMap = useMemo(() => { + const map = new Map(); + 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({ {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 ( - ))} + ); + })} {/* Status icon */} {item.status === 'match' ? ( diff --git a/frontend/src/i18n/locales/de.ts b/frontend/src/i18n/locales/de.ts index 9307e8732..5177a3eb5 100644 --- a/frontend/src/i18n/locales/de.ts +++ b/frontend/src/i18n/locales/de.ts @@ -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', diff --git a/frontend/src/i18n/locales/en.ts b/frontend/src/i18n/locales/en.ts index 09ba17fe3..7dfd40772 100644 --- a/frontend/src/i18n/locales/en.ts +++ b/frontend/src/i18n/locales/en.ts @@ -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', diff --git a/frontend/src/i18n/locales/fr.ts b/frontend/src/i18n/locales/fr.ts index 8af201a5d..c1e83e6b5 100644 --- a/frontend/src/i18n/locales/fr.ts +++ b/frontend/src/i18n/locales/fr.ts @@ -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', diff --git a/frontend/src/i18n/locales/it.ts b/frontend/src/i18n/locales/it.ts index 67f05a0e9..954d49258 100644 --- a/frontend/src/i18n/locales/it.ts +++ b/frontend/src/i18n/locales/it.ts @@ -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', diff --git a/frontend/src/i18n/locales/ja.ts b/frontend/src/i18n/locales/ja.ts index 58ee1f9fd..8716177c6 100644 --- a/frontend/src/i18n/locales/ja.ts +++ b/frontend/src/i18n/locales/ja.ts @@ -2666,6 +2666,7 @@ export default { selectPlate: 'プレートを選択', filamentMapping: 'フィラメントマッピング', totalCost: '合計コスト:', + slotRemainingShort: ' - 残{{grams}}g', printSettings: '印刷設定', bedLeveling: 'ベッドレベリング', layerInspection: '第一層検査', diff --git a/frontend/src/i18n/locales/pt-BR.ts b/frontend/src/i18n/locales/pt-BR.ts index e5d949c06..9e2614e7d 100644 --- a/frontend/src/i18n/locales/pt-BR.ts +++ b/frontend/src/i18n/locales/pt-BR.ts @@ -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',