Replace browser popups with in-page dialogs; focus new-task prompt
This commit is contained in:
+3
-3
@@ -1,5 +1,5 @@
|
||||
import { post } from "./api.js";
|
||||
import { errorText, h, replace } from "./dom.js";
|
||||
import { errorText, h, replace, showAlert } from "./dom.js";
|
||||
import { openTranscript, type View } from "./panes.js";
|
||||
import { activeTasks, currentSession, findTask, onEach, state } from "./state.js";
|
||||
|
||||
@@ -37,7 +37,7 @@ export function mountNavbar(root: HTMLElement, show: (view: View) => void): void
|
||||
render();
|
||||
|
||||
addEventListener("keydown", (e) => {
|
||||
if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
|
||||
if (e.key === "k" && (e.metaKey || e.ctrlKey) && !document.querySelector("dialog[open]")) {
|
||||
e.preventDefault();
|
||||
openSwitcher();
|
||||
}
|
||||
@@ -85,7 +85,7 @@ function openSwitcher(): void {
|
||||
const task = await post("/api/projects/{projectId}/tasks", { path: { projectId }, body: { title } });
|
||||
go(task.id);
|
||||
} catch (err) {
|
||||
alert(errorText(err));
|
||||
void showAlert(errorText(err));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user