Lock the right pane while focused, add project focus, quiet lead

This commit is contained in:
Ian Gulliver
2026-10-15 09:59:13 -07:00
parent bdd1ae48f0
commit fdd005b591
32 changed files with 576 additions and 227 deletions
+15 -6
View File
@@ -1,7 +1,7 @@
import { post } from "./api.js";
import { errorText, h, replace, showAlert } from "./dom.js";
import { openSettings } from "./settings.js";
import { activeTasks, currentSession, findTask, focusTask, lastVisits, onEach, state } from "./state.js";
import { activeTasks, currentSession, findTask, focusedProject, focusProject, focusTask, lastVisits, onEach, state } from "./state.js";
import { openStatus } from "./status.js";
export function mountNavbar(root) {
const crumb = h("button", { class: "crumb", title: "Switch task (⌘K)" });
@@ -15,14 +15,14 @@ export function mountNavbar(root) {
const me = h("span", { class: "me" });
const render = () => {
const task = state.selectedTaskId ? findTask(state.selectedTaskId) : undefined;
const project = task ? state.projects.find((p) => p.id === task.project_id) : undefined;
replace(crumb, task ? `${project?.name ?? ""} ▸ ${task.title}` : "No task", " ▾");
const project = focusedProject();
replace(crumb, task ? `${project?.name ?? ""} ▸ ${task.title}` : (project?.name ?? "No task"), " ▾");
conn.className = state.connected ? "connection up" : "connection down";
conn.title = state.connected ? "live" : "reconnecting";
connLabel.hidden = state.connected;
replace(me, state.me?.display_name ?? "");
};
onEach(["me", "projects", "tasks", "selection", "connection"], render);
onEach(["me", "projects", "tasks", "selection", "focus", "connection"], render);
replace(root, h("a", { href: "#/", class: "brand" }, "byre"), crumb, h("span", { class: "spacer" }), status, settings, connLabel, conn, me);
render();
addEventListener("keydown", (e) => {
@@ -86,8 +86,17 @@ function openSwitcher() {
const el = h("li", {}, h("span", { class: `dot ${sess?.state ?? "none"}`, title: sess?.state ?? "no session" }), h("span", { class: "task-title" }, h("span", { class: "project-name" }, project.name), " ", task.title), count > 0 && h("span", { class: "badge", title: "inbox items" }, count), h("span", { class: "task-state" }, sess?.state ?? "no agent"));
return { el, pick: () => go(task.id) };
});
const current = state.selectedTaskId ? findTask(state.selectedTaskId) : undefined;
const project = state.projects.find((p) => p.id === current?.project_id) ?? state.projects[0];
for (const p of state.projects.filter((p) => `${p.name} todo`.toLowerCase().includes(q))) {
const el = h("li", {}, h("span", { class: "dot none" }), h("span", { class: "task-title" }, h("span", { class: "project-name" }, p.name), " TODO.md"), h("span", { class: "task-state" }, "project"));
rows.push({
el,
pick: () => {
close();
focusProject(p.id);
},
});
}
const project = focusedProject() ?? state.projects[0];
if (title && project) {
const el = h("li", { class: "new-task" }, h("span", { class: "task-title" }, "New task in ", h("span", { class: "project-name" }, project.name), ": ", title));
rows.push({ el, pick: () => void create(project.id, title) });