Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions vscode-extension/media/blameView.css
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ body.vscode-high-contrast-light tr.ai-line-cursor td.line-num { box-shadow: inse
transition: border-color 120ms, color 120ms, background 120ms;
}
.menu-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.back-btn { margin-left: 0; }
.tasklet-menu .back-btn { margin-bottom: 12px; }

/* ── Section label ── */
.section-label { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px; }
Expand Down
41 changes: 41 additions & 0 deletions vscode-extension/media/blameView.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

let selectedTaskletId = null;
let selectedLine = null;
const navStack = [];

const tbody = document.getElementById('code-body');

Expand Down Expand Up @@ -99,6 +100,7 @@
function handleLineClick(lineIdx) {
const ownerId = LINE_MAP[String(lineIdx)];
if (ownerId === undefined) { return; }
navStack.length = 0;

// Toggle off if clicking the already-selected line of the same tasklet.
if (selectedLine === lineIdx && selectedTaskletId === ownerId) {
Expand Down Expand Up @@ -238,6 +240,7 @@
promptContent.innerHTML = `
<div class="tasklet-card">
<div class="card-nav">
${backButtonHtml()}
<div class="card-title">${esc(t.name)}</div>
<button class="menu-btn" id="all-tasklets-btn">All Tasklets</button>
</div>
Expand Down Expand Up @@ -270,7 +273,10 @@
});
});

bindBackButton();

document.getElementById('all-tasklets-btn').addEventListener('click', () => {
navStack.push({ taskletId: selectedTaskletId, line: selectedLine });
showTaskletMenu();
clearSelection();
selectedTaskletId = null;
Expand All @@ -288,6 +294,7 @@
const t = TASKLETS[taskletId];
if (!t || t.lines.length === 0) { return; }

navStack.push({ taskletId: selectedTaskletId, line: selectedLine });
selectedTaskletId = taskletId;

// Move the selected line to the live line of this tasklet nearest the
Expand All @@ -310,6 +317,36 @@
if (tr) { tr.scrollIntoView({ block: 'center', behavior: 'smooth' }); }
}

// ── Back navigation ───────────────────────────────────────────────────────
// A null taskletId in navStack means the All Tasklets menu.

function backButtonHtml() {
return navStack.length > 0 ? `<button class="menu-btn back-btn" id="back-btn">← Back</button>` : '';
}

function bindBackButton() {
const backBtn = document.getElementById('back-btn');
if (backBtn) { backBtn.addEventListener('click', goBack); }
}

function goBack() {
const prev = navStack.pop();
if (!prev) { return; }
selectedTaskletId = prev.taskletId;
selectedLine = prev.line;

if (selectedTaskletId === null) {
clearSelection();
showTaskletMenu();
return;
}

applySelection(selectedTaskletId);
showPrompt(selectedTaskletId);
const tr = tbody.querySelector(`tr[data-line="${selectedLine}"]`);
if (tr) { tr.scrollIntoView({ block: 'center', behavior: 'smooth' }); }
}

// ── Tasklet menu ──────────────────────────────────────────────────────────
// Only tasklets that still own at least one live line are listed; fully
// overridden tasklets are only reachable via the per-line previous-tasklets
Expand All @@ -325,14 +362,18 @@

promptContent.innerHTML = `
<div class="tasklet-menu">
${backButtonHtml()}
<div class="menu-title">All Tasklets</div>
<ul class="tasklet-list">${items}</ul>
</div>`;

bindBackButton();

promptContent.querySelectorAll('.tasklet-list li').forEach(li => {
li.addEventListener('click', () => {
const id = li.dataset.id;
const t = TASKLETS[id];
navStack.push({ taskletId: null, line: null });
selectedTaskletId = id;
// Move the line cursor onto this tasklet's first live line so the
// previous-tasklets dropdown reflects this tasklet's context.
Expand Down
Loading