Harden components: add ErrorBoundary, null-safe rendering

This commit is contained in:
MayaTheShy
2026-03-21 17:51:07 -04:00
parent 0ce63bacd7
commit fe6ac23329
6 changed files with 109 additions and 42 deletions

View File

@@ -35,9 +35,9 @@ function CraftingPanel() {
{(craftable || []).map((recipe, idx) => (
<div key={idx} className="craft-card">
<div className="craft-output">
<ItemIcon itemName={recipe.output} size={32} />
<ItemIcon itemName={recipe.output || ''} size={32} />
<div className="craft-info">
<span className="craft-name">{formatItemName(recipe.output)}</span>
<span className="craft-name">{formatItemName(recipe.output || '')}</span>
<span className="craft-count">Produces {recipe.count || 1}</span>
</div>
</div>
@@ -45,8 +45,8 @@ function CraftingPanel() {
<div className="craft-ingredients">
{recipe.slots && Object.entries(recipe.slots).map(([slot, item]) => (
<div key={slot} className="craft-ingredient">
<ItemIcon itemName={item} size={16} />
<span>{formatItemName(item)}</span>
<ItemIcon itemName={item || ''} size={16} />
<span>{formatItemName(item || '')}</span>
</div>
))}
</div>