Fix cell inventory: clickable entries navigate to component; use display name
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1193,13 +1193,20 @@ function open_cell_inventory(grid, row, col, e) {
|
|||||||
entries.forEach(entry => {
|
entries.forEach(entry => {
|
||||||
const comp = component_by_id(entry.component_id);
|
const comp = component_by_id(entry.component_id);
|
||||||
const item = document.createElement('div');
|
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');
|
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');
|
const qty_span = document.createElement('span');
|
||||||
qty_span.className = 'cell-inv-qty';
|
qty_span.className = 'cell-inv-qty';
|
||||||
qty_span.textContent = entry.quantity || '';
|
qty_span.textContent = entry.quantity || '';
|
||||||
item.append(name_span, qty_span);
|
item.append(name_span, qty_span);
|
||||||
|
if (comp) {
|
||||||
|
item.addEventListener('click', () => {
|
||||||
|
overlay.remove();
|
||||||
|
selected_component_id = comp.id;
|
||||||
|
navigate('/components');
|
||||||
|
});
|
||||||
|
}
|
||||||
list_el.appendChild(item);
|
list_el.appendChild(item);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1464,6 +1464,17 @@ nav {
|
|||||||
white-space: nowrap;
|
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 {
|
.cell-inv-empty {
|
||||||
font-size: 0.85rem;
|
font-size: 0.85rem;
|
||||||
color: var(--text-faint);
|
color: var(--text-faint);
|
||||||
|
|||||||
Reference in New Issue
Block a user