Add a per-user lead agent and make the right pane task-focused
This commit is contained in:
Vendored
+21
@@ -55,6 +55,27 @@ function modal(text, buttons) {
|
||||
actions.at(-1)?.focus();
|
||||
});
|
||||
}
|
||||
export function openPanel(title, mount) {
|
||||
if (document.querySelector("dialog.panel[open]")) {
|
||||
return;
|
||||
}
|
||||
const close = h("button", { type: "button", class: "panel-close", title: "Close (Esc)" }, "×");
|
||||
const body = h("div", { class: "panel-body" });
|
||||
const dialog = h("dialog", { class: "modal panel" }, h("header", { class: "panel-head" }, h("h2", {}, title), close), body);
|
||||
close.onclick = () => dialog.close();
|
||||
dialog.onclick = (e) => {
|
||||
if (e.target === dialog || e.target.closest("a[href^='#']")) {
|
||||
dialog.close();
|
||||
}
|
||||
};
|
||||
document.body.append(dialog);
|
||||
const dispose = mount(body);
|
||||
dialog.onclose = () => {
|
||||
dispose();
|
||||
dialog.remove();
|
||||
};
|
||||
dialog.showModal();
|
||||
}
|
||||
export async function showAlert(text) {
|
||||
await modal(text, [{ label: "OK", value: "ok", class: "primary" }]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user