mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-16 20:45:33 -08:00
Refuse a new question until a noted one is dealt with
AI Assisted
This commit is contained in:
1 parent
92d4d880bf
commit
1a17578aa9
19 files changed
+475
-24
No files matched your search
@@ -760,6 +760,15 @@ export function renderAside() {
|
||||
aside.appendChild(box);
|
||||
}
|
||||
|
||||
// The agent answered a note and has not yet dealt with the question itself:
|
||||
// say so, because the reply may have changed what the question asks.
|
||||
const last = thread[thread.length - 1];
|
||||
if (item.noted === true && isOpen(item) && !finish() && last && threadWho(last) === "agent") {
|
||||
const tag = el("p", "pill noted-tag", "Plan2Code replied, check this still fits");
|
||||
tag.setAttribute("role", "note");
|
||||
aside.appendChild(tag);
|
||||
}
|
||||
|
||||
if (waiting && !waitingShown) {
|
||||
const box = el("div", "msg you pending");
|
||||
const who = el("div", "msg-who");
|
||||
|
||||
@@ -523,9 +523,13 @@ export function adopt(body) {
|
||||
arrived.length === 1
|
||||
? "A new question from Plan2Code. It is in the list on the left."
|
||||
: `${arrived.length} new questions from Plan2Code. They are in the list on the left.`;
|
||||
banner(staleLine ? `${staleLine} ${arrivedLine}` : arrivedLine, "info");
|
||||
// The notice stays until a click, Escape or opening the question: a
|
||||
// question that arrives mid-sentence is easy to miss in eight seconds.
|
||||
// The question already on screen needs no mark: it is where they are looking.
|
||||
for (const q of arrived) if (!(page.view === "questions" && page.selected === q.id)) page.newQuestions.add(q.id);
|
||||
arrivalNotice = staleLine ? `${staleLine} ${arrivedLine}` : arrivedLine;
|
||||
banner(arrivalNotice, "info");
|
||||
clearTimeout(arrivalBannerTimer);
|
||||
arrivalBannerTimer = setTimeout(() => !page.gone && banner(null), 8000);
|
||||
} else {
|
||||
page.selected = arrived[0].id;
|
||||
page.view = "questions";
|
||||
@@ -534,6 +538,7 @@ export function adopt(body) {
|
||||
}
|
||||
|
||||
if (!page.selected || !byId(page.selected)) page.selected = pickDefault();
|
||||
pruneNewQuestions();
|
||||
// A reply that lands while another tab is open: a dot on Ask, and one chime.
|
||||
// Not on the first load, which has nothing new to announce.
|
||||
const dot = unreadDot({ lastSeenReplyId: page.local.chat.lastSeenReplyId, frameChat: page.chatFrame, viewIsAsk: page.view === "ask" });
|
||||
@@ -600,6 +605,24 @@ function scrollRail(where) {
|
||||
}
|
||||
|
||||
let arrivalBannerTimer = null;
|
||||
// The text of a notice that stays up (see adopt), so only that banner is cleared.
|
||||
let arrivalNotice = "";
|
||||
|
||||
function dropArrivalNotice() {
|
||||
if (arrivalNotice && $("banner").textContent === arrivalNotice) banner(null);
|
||||
arrivalNotice = "";
|
||||
}
|
||||
|
||||
// Marks that no longer apply: a question that is answered or gone, or the one
|
||||
// now on screen. The notice goes with the last mark.
|
||||
function pruneNewQuestions() {
|
||||
const had = page.newQuestions.size;
|
||||
for (const id of [...page.newQuestions]) {
|
||||
const item = byId(id);
|
||||
if (!item || !isOpen(item) || (page.view === "questions" && page.selected === id)) page.newQuestions.delete(id);
|
||||
}
|
||||
if (had && !page.newQuestions.size) dropArrivalNotice();
|
||||
}
|
||||
|
||||
// Typing in any text field, the question's own or the notes beside it. A
|
||||
// focused Markdown field surfaces as its .md-host (the editor inside its
|
||||
@@ -819,6 +842,8 @@ export function render() {
|
||||
if (rendering) return;
|
||||
rendering = true;
|
||||
try {
|
||||
// A question opened by any route (the pager, a tab switch) loses its New mark.
|
||||
pruneNewQuestions();
|
||||
trackAbout();
|
||||
const enteringAsk = page.view === "ask" && drawnView !== "ask";
|
||||
const switchingTab = drawnView !== null && page.view !== drawnView;
|
||||
@@ -1606,9 +1631,15 @@ export function renderSidebar() {
|
||||
mark.title = m.label;
|
||||
b.appendChild(mark);
|
||||
b.appendChild(el("span", null, item.title));
|
||||
if (page.newQuestions.has(item.id)) {
|
||||
const fresh = el("span", "rail-new", "New");
|
||||
fresh.title = "arrived while you were typing";
|
||||
b.appendChild(fresh);
|
||||
}
|
||||
b.addEventListener("click", () => {
|
||||
page.selected = item.id;
|
||||
page.view = "questions";
|
||||
pruneNewQuestions();
|
||||
render();
|
||||
$("main").focus();
|
||||
});
|
||||
@@ -2313,6 +2344,10 @@ export function wireChrome() {
|
||||
true
|
||||
);
|
||||
|
||||
// A click or Escape puts a staying arrival notice away; the list keeps the "New" mark.
|
||||
document.addEventListener("pointerdown", () => arrivalNotice && dropArrivalNotice(), true);
|
||||
document.addEventListener("keydown", (e) => e.key === "Escape" && arrivalNotice && dropArrivalNotice(), true);
|
||||
|
||||
$("meter-pill").addEventListener("click", () => toggleMeterPop());
|
||||
$("meter-help").addEventListener("click", () => {
|
||||
toggleMeterPop(false);
|
||||
|
||||
@@ -155,6 +155,9 @@ export const page = {
|
||||
// The pose pane on screen when a render began, held back from the clear so
|
||||
// posePane() can take it up again. See posePane.
|
||||
heldPose: null,
|
||||
// Questions that arrived while the person was typing and are not opened yet
|
||||
// (a "New" mark in the list). Page-local, never saved.
|
||||
newQuestions: new Set(),
|
||||
// The workspace scope (a spec dir, "" for the project) this tab last asked
|
||||
// for: its own pick, not whatever the frame says. And true from a launch's
|
||||
// scope sync until its send has gone (or failed).
|
||||
|
||||
@@ -280,10 +280,14 @@
|
||||
.card.is-inflight { border-color: var(--stage); }
|
||||
.card.is-inflight .option.is-locked.is-recorded {
|
||||
border-color: var(--stage);
|
||||
text-transform: none;
|
||||
letter-spacing: 0;
|
||||
background: var(--stage-soft);
|
||||
}
|
||||
.card.is-inflight .option.is-locked.is-recorded:hover {
|
||||
border-color: var(--stage);
|
||||
text-transform: none;
|
||||
letter-spacing: 0;
|
||||
background: var(--stage-soft);
|
||||
}
|
||||
.card.is-inflight .option-mark.on { color: var(--stage); }
|
||||
@@ -961,3 +965,14 @@ h4.md-h, h5.md-h, h6.md-h { font-size: 15px; }
|
||||
.modal-actions:has(#stop-cancel) .btn { width: 100%; }
|
||||
}
|
||||
|
||||
|
||||
/* A noted card whose last word in the thread is the agent's reply. */
|
||||
.noted-tag {
|
||||
display: block;
|
||||
margin: 2px 0 10px;
|
||||
background: var(--stage-soft);
|
||||
color: var(--stage);
|
||||
border-color: var(--stage);
|
||||
text-transform: none;
|
||||
letter-spacing: 0;
|
||||
}
|
||||
@@ -777,3 +777,18 @@ button.waiting-jump:hover { text-decoration-color: var(--accent); }
|
||||
}
|
||||
@keyframes arrival-draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
|
||||
|
||||
|
||||
/* A question that arrived while the person was typing, until it is opened. */
|
||||
.rail-new {
|
||||
flex: none;
|
||||
align-self: flex-start;
|
||||
margin-top: 2px;
|
||||
padding: 0 6px;
|
||||
border-radius: 999px;
|
||||
font-size: 10.5px;
|
||||
font-weight: 700;
|
||||
letter-spacing: .04em;
|
||||
text-transform: uppercase;
|
||||
background: var(--accent-soft);
|
||||
color: var(--accent);
|
||||
}
|
||||
Reference in new issue
Block a user