From e6f2ff5587bc7a7f4a6de0f8ed9d89fce4539642 Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Sat, 21 Mar 2026 16:49:50 -0400 Subject: [PATCH] Add SmeltingPanel component for managing smelting operations and recipes --- web/client/src/components/SmeltingPanel.jsx | 130 ++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 web/client/src/components/SmeltingPanel.jsx diff --git a/web/client/src/components/SmeltingPanel.jsx b/web/client/src/components/SmeltingPanel.jsx new file mode 100644 index 0000000..4651a26 --- /dev/null +++ b/web/client/src/components/SmeltingPanel.jsx @@ -0,0 +1,130 @@ +import React from 'react'; +import { useInventoryStore } from '../store/inventoryStore'; +import { formatItemName } from '../utils/itemUtils'; +import ItemIcon from './ItemIcon'; +import './SmeltingPanel.css'; + +function SmeltingPanel() { + const inventory = useInventoryStore((state) => state.inventory); + const smeltingPaused = useInventoryStore((state) => state.smeltingPaused); + const disabledRecipes = useInventoryStore((state) => state.disabledRecipes); + const smeltable = useInventoryStore((state) => state.smeltable); + const toggleSmelting = useInventoryStore((state) => state.toggleSmelting); + const toggleRecipe = useInventoryStore((state) => state.toggleRecipe); + const enableAllRecipes = useInventoryStore((state) => state.enableAllRecipes); + const disableAllRecipes = useInventoryStore((state) => state.disableAllRecipes); + + const furnaceStatus = inventory.furnaceStatus || {}; + const furnaceEntries = Object.entries(furnaceStatus); + + const smeltableEntries = Object.entries(smeltable); + + return ( +
+ {/* Header */} +
+

🔥 Smelting Dashboard

+
+ +
+
+ + {smeltingPaused && ( +
⚠️ Smelting is PAUSED
+ )} + + {/* Furnace status */} +
+

🔥 Furnaces ({inventory.furnaceCount || 0})

+ {furnaceEntries.length > 0 ? ( +
+ {furnaceEntries.map(([name, status]) => ( +
+
{name.replace(/^minecraft:/, '')}
+
+ {status.input && ( +
+ In: + + {status.input.count || 0} +
+ )} + {status.fuel && ( +
+ Fuel: + + {status.fuel.count || 0} +
+ )} + {status.output && ( +
+ Out: + + {status.output.count || 0} +
+ )} + {!status.input && !status.fuel && !status.output && ( + Empty + )} +
+
+ ))} +
+ ) : ( +
No furnace data available
+ )} +
+ + {/* Recipe list */} +
+

📋 Smelting Recipes ({smeltableEntries.length})

+
+ + +
+
+ {smeltableEntries.map(([input, recipe]) => { + const isDisabled = disabledRecipes[input]; + return ( +
toggleRecipe(input)} + > +
+ {isDisabled ? '⬜' : '✅'} +
+
+ + {formatItemName(input)} +
+ +
+ + {formatItemName(recipe.result)} +
+
+ {(recipe.furnaces || []).map((f) => ( + + {f.replace(/^minecraft:/, '')} + + ))} +
+
+ ); + })} + {smeltableEntries.length === 0 && ( +
No smelting recipes loaded
+ )} +
+
+
+ ); +} + +export default SmeltingPanel;