diff --git a/public/app.mjs b/public/app.mjs index 1d537c1..54fb259 100644 --- a/public/app.mjs +++ b/public/app.mjs @@ -1193,13 +1193,20 @@ function open_cell_inventory(grid, row, col, e) { entries.forEach(entry => { const comp = component_by_id(entry.component_id); const item = document.createElement('div'); - item.className = 'cell-inv-item'; + item.className = 'cell-inv-item cell-inv-item-link'; const name_span = document.createElement('span'); - name_span.textContent = comp?.name ?? '?'; + name_span.textContent = comp ? component_display_name(comp) : '?'; const qty_span = document.createElement('span'); qty_span.className = 'cell-inv-qty'; qty_span.textContent = entry.quantity || ''; item.append(name_span, qty_span); + if (comp) { + item.addEventListener('click', () => { + overlay.remove(); + selected_component_id = comp.id; + navigate('/components'); + }); + } list_el.appendChild(item); }); } diff --git a/public/style.css b/public/style.css index d99265c..fe95848 100644 --- a/public/style.css +++ b/public/style.css @@ -1464,6 +1464,17 @@ nav { white-space: nowrap; } +.cell-inv-item-link { + cursor: pointer; + border-radius: 3px; + padding: 0.1rem 0.25rem; + margin: 0 -0.25rem; +} + +.cell-inv-item-link:hover { + background: var(--hover, rgba(255,255,255,0.06)); +} + .cell-inv-empty { font-size: 0.85rem; color: var(--text-faint);