Replace goto-grid button with clickable grid cell label in component detail

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-22 01:29:08 +00:00
parent d489c1e306
commit 08b8e2dd4d
3 changed files with 13 additions and 5 deletions

View File

@@ -443,14 +443,14 @@ function build_detail_inv_entry(entry) {
type_el.className = `type-pill type-${entry.location_type}`; type_el.className = `type-pill type-${entry.location_type}`;
type_el.textContent = LOCATION_TYPE_LABEL[entry.location_type] ?? entry.location_type; type_el.textContent = LOCATION_TYPE_LABEL[entry.location_type] ?? entry.location_type;
set_text(el, '.detail-inv-ref', entry.location_type === 'grid' ? grid_cell_label(entry) : (entry.location_ref || '—'));
set_text(el, '.detail-inv-qty', entry.quantity ? `×${entry.quantity}` : ''); set_text(el, '.detail-inv-qty', entry.quantity ? `×${entry.quantity}` : '');
set_text(el, '.detail-inv-notes', entry.notes || ''); set_text(el, '.detail-inv-notes', entry.notes || '');
if (entry.location_type === 'grid' && entry.grid_id) { if (entry.location_type === 'grid' && entry.grid_id) {
const goto_btn = qs(el, '.detail-inv-goto-grid'); const ref_el = qs(el, '.detail-inv-ref');
goto_btn.hidden = false; ref_el.textContent = grid_cell_label(entry);
goto_btn.addEventListener('click', () => navigate(`/grids/viewer/${entry.grid_id}`)); ref_el.classList.add('detail-inv-ref-link');
ref_el.addEventListener('click', () => navigate(`/grids/viewer/${entry.grid_id}`));
// Show the grid cell image as a read-only thumbnail // Show the grid cell image as a read-only thumbnail
const grid = all_grids.find(g => g.id === entry.grid_id); const grid = all_grids.find(g => g.id === entry.grid_id);

View File

@@ -643,6 +643,15 @@ nav {
.type-pill.type-bom { background: var(--badge-bom-bg); color: var(--badge-bom-text); } .type-pill.type-bom { background: var(--badge-bom-bg); color: var(--badge-bom-text); }
.type-pill.type-digital { background: var(--badge-digital-bg); color: var(--badge-digital-text); } .type-pill.type-digital { background: var(--badge-digital-bg); color: var(--badge-digital-text); }
.detail-inv-ref-link {
cursor: pointer;
color: var(--accent);
}
.detail-inv-ref-link:hover {
text-decoration: underline;
}
.inv-component-link { .inv-component-link {
cursor: pointer; cursor: pointer;
color: var(--accent); color: var(--accent);

View File

@@ -91,7 +91,6 @@
<span class="detail-inv-qty"></span> <span class="detail-inv-qty"></span>
<span class="detail-inv-notes"></span> <span class="detail-inv-notes"></span>
<span class="row-actions"> <span class="row-actions">
<button class="btn-icon btn-goto-grid detail-inv-goto-grid" title="View in grid" hidden></button>
<button class="btn-icon btn-edit" title="Edit"></button> <button class="btn-icon btn-edit" title="Edit"></button>
<button class="btn-icon btn-danger btn-delete" title="Delete"></button> <button class="btn-icon btn-danger btn-delete" title="Delete"></button>
</span> </span>