Skip to content

armgit / kanzo

Public Imported from GitHub
0

Self-hosted, sharable kanban for humans and agents. One 4.7 MB binary, 5 MB of RAM, 10 to 60 tokens per agent reply, starts in 3 ms, zero setup.

Make New project a dialog

emanuele-em1602c85de200
diff --git a/src/app.js b/src/app.js
index 5ca7e46..ae1b21b 100644
--- a/src/app.js
+++ b/src/app.js
@@ -457,7 +457,7 @@ document.addEventListener("mousedown", (e) => {
// A click outside the task panel closes it. Cards are left to open their own task,
// and the project menu to do its job.
document.addEventListener("mousedown", (e) => {
- if (state.task && e.button === 0 && !e.target.closest("#panel, .card, .menu, #search-dialog, #sync-dialog")) closeTask();
+ if (state.task && e.button === 0 && !e.target.closest("#panel, .card, .menu, .search-dialog")) closeTask();
});
window.addEventListener("resize", closeMenu);
window.addEventListener("blur", closeMenu);
@@ -700,20 +700,20 @@ window.addEventListener("pagehide", () => {
// ---------- new project ----------
function showNewProject() {
- $("#new-project-toggle").hidden = true;
- $("#new-project").hidden = false;
+ $("#project-dialog").hidden = false;
$("#new-project [name=slug]").focus();
}
function hideNewProject() {
$("#new-project").reset();
- $("#new-project").hidden = true;
- $("#new-project-toggle").hidden = false;
+ $("#project-dialog").hidden = true;
}
$("#new-task").addEventListener("click", newTask);
$("#new-project-toggle").addEventListener("click", showNewProject);
$("#new-project-cancel").addEventListener("click", hideNewProject);
+$("#project-dialog").addEventListener("mousedown", (e) => { if (e.target.id === "project-dialog") hideNewProject(); });
+$("#project-dialog").addEventListener("keydown", (e) => { if (e.key === "Escape") { e.stopPropagation(); hideNewProject(); } });
$("#new-project").addEventListener("submit", async (e) => {
e.preventDefault();
const f = new FormData(e.target);
diff --git a/src/index.html b/src/index.html
index 428b642..fdda427 100644
--- a/src/index.html
+++ b/src/index.html
@@ -112,8 +112,6 @@ aside {
.menu .option:hover { background: var(--hover); }
.menu .value { margin-left: auto; padding-left: 12px; color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu .switch { margin-left: auto; }
-form.new-project { display: flex; flex-direction: column; gap: 6px; padding: 4px 2px 10px; }
-form.new-project .row { display: flex; gap: 6px; margin-top: 2px; }
/* Controls */
input.field, textarea.field, select.field {
@@ -333,17 +331,17 @@ header .repo-link .icon svg { width: 14px; height: 14px; }
.search-field input { flex: 1; min-width: 0; border: 0; background: none; font-size: 16px; }
.search-field input::-webkit-search-cancel-button { display: none; }
.results { overflow-y: auto; padding: 6px; }
-.sync-window {
+.dialog-window {
width: min(520px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 22px 22px 18px;
background: var(--menu); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow);
}
-.sync-window h2 { margin: 0; font-size: 17px; font-weight: 600; }
-.sync-window p { margin: 0; color: var(--muted); line-height: 1.45; }
-.sync-window .error { color: var(--danger); white-space: pre-line; font-size: 13px; }
-.sync-window .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
-.sync-window .row a { margin-right: auto; color: var(--muted); font-size: 13px; }
-.sync-window .row a:hover { color: var(--text); }
-.sync-window .btn:disabled { opacity: .6; cursor: default; }
+.dialog-window h2 { margin: 0; font-size: 17px; font-weight: 600; }
+.dialog-window p { margin: 0; color: var(--muted); line-height: 1.45; }
+.dialog-window .error { color: var(--danger); white-space: pre-line; font-size: 13px; }
+.dialog-window .row { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
+.dialog-window .row a { margin-right: auto; color: var(--muted); font-size: 13px; }
+.dialog-window .row a:hover { color: var(--text); }
+.dialog-window .btn:disabled { opacity: .6; cursor: default; }
.results .label { color: var(--faint); font-size: 12px; padding: 8px 12px 4px; }
.results .note { color: var(--faint); padding: 14px 12px; }
.result {
@@ -369,7 +367,7 @@ header .repo-link .icon svg { width: 14px; height: 14px; }
.nav { flex-direction: row; overflow-x: auto; }
.nav a { width: auto; }
.nav .label { display: none; }
- #new-project-toggle, form.new-project { display: none; }
+ #new-project-toggle { display: none; }
.columns { grid-auto-columns: minmax(78vw, 1fr); padding: 0 12px 12px; }
header { padding: 12px; }
}
@@ -383,15 +381,6 @@ header .repo-link .icon svg { width: 14px; height: 14px; }
<button class="ghost" id="search-open" title="Search (/ or ⌘K)" aria-label="Search tasks"><span class="icon" data-icon="search"></span></button>
</div>
<button class="ghost" id="new-project-toggle"><span class="icon" data-icon="newProject"></span>New project</button>
- <form class="new-project" id="new-project" hidden>
- <input class="field" name="slug" placeholder="slug, e.g. api" required autocomplete="off" pattern="[a-zA-Z0-9][a-zA-Z0-9\-]{0,31}" title="Letters, digits and -, up to 32">
- <input class="field" name="name" placeholder="Name (optional)" autocomplete="off">
- <input class="field" name="repo" placeholder="GitHub owner/repo (optional)" autocomplete="off">
- <div class="row">
- <button class="btn primary" type="submit">Create</button>
- <button class="btn" type="button" id="new-project-cancel">Cancel</button>
- </div>
- </form>
<nav class="nav" id="nav"></nav>
<button class="ghost update" id="update" hidden><span class="icon" data-icon="update"></span><span id="update-label"></span></button>
<button class="ghost" id="settings" aria-haspopup="menu"><span class="icon" data-icon="settings"></span>Settings</button>
@@ -440,7 +429,7 @@ header .repo-link .icon svg { width: 14px; height: 14px; }
</div>
<div class="search-dialog" id="sync-dialog" hidden>
- <form class="sync-window" id="sync-form" role="dialog" aria-labelledby="sync-title">
+ <form class="dialog-window" id="sync-form" role="dialog" aria-labelledby="sync-title">
<h2 id="sync-title">Sync your board</h2>
<p>Keep this board the same on all your machines through a private git repo you own. Use the same repo on each machine.</p>
<input class="field" id="sync-url" placeholder="https://github.com/you/kanzo-data" autocomplete="off" spellcheck="false" aria-label="Repository URL">
@@ -452,6 +441,19 @@ header .repo-link .icon svg { width: 14px; height: 14px; }
</div>
</form>
</div>
+<div class="search-dialog" id="project-dialog" hidden>
+ <form class="dialog-window" id="new-project" role="dialog" aria-labelledby="project-title">
+ <h2 id="project-title">New project</h2>
+ <p>The slug starts each task's key, like api#12.</p>
+ <input class="field" name="slug" placeholder="Slug, like api" aria-label="Slug" required autocomplete="off" spellcheck="false" pattern="[a-zA-Z0-9][a-zA-Z0-9\-]{0,31}" title="Letters, digits and -, up to 32">
+ <input class="field" name="name" placeholder="Name (optional)" aria-label="Name" autocomplete="off">
+ <input class="field" name="repo" placeholder="GitHub owner/repo (optional)" aria-label="GitHub repo" autocomplete="off" spellcheck="false">
+ <div class="row">
+ <button class="btn" type="button" id="new-project-cancel">Cancel</button>
+ <button class="btn primary" type="submit">Create</button>
+ </div>
+ </form>
+</div>
<div class="search-dialog" id="search-dialog" hidden>
<div class="search-window" role="dialog" aria-label="Search tasks">
<label class="search-field"><span class="icon" data-icon="search"></span><input id="search" type="search" placeholder="Search tasks" autocomplete="off" spellcheck="false" aria-label="Search tasks"></label>