Live-review iteration on the browser SPA, driven by crit feedback. Sidebar / session tree - Compact single-line leaf rows; status shown as a faint "alive" row wash instead of per-row dots (exited rows dim + keep the "exited" badge). - Host is now the first level of nesting (host → label path → session); the inline @daemon is dropped from rows. - Flush, borderless search input spanning the sidebar; drag-to-resize grip on the sidebar edge (width persisted to localStorage); narrower default. - Per-row clone action (opens the spawn modal prefilled); right-pointing chevron when collapsed. Chrome / layout - Buttons swapped to a bracket terminal style ([ + Spawn ]); ghost/icon drop the brackets. Old filled styles removed. - Squared corners globally (radius tokens) and tighter, denser spacing. - Session tally + daemon chips moved into the centered app header. - Shorter control height; shared --bar-h aligns the search and attach bars. Attach / terminal - Useful attach title (name · command @ host) over a bare UUID. - Robust fit: compute columns from the viewport's scrollbar-excluded clientWidth (fixes mobile under-fit and desktop overflow); ResizeObserver + font-load refit; full-bleed terminal on mobile. Spawn / empty states - Spawn modal accepts a prefill (clone); real "+ Spawn" buttons in welcome and no-sessions empty states. Dev - New ?kit design-kit page (kit.ts/kit.css, DEV-only) showcasing components. - Richer ?mock fixture with deeper label nesting. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+35
-7
@@ -1,15 +1,29 @@
|
||||
import { renderSidebar, renderTopbar } from "./catalog.js";
|
||||
import { ConnectionPool } from "./connections.js";
|
||||
import { CatalogStore } from "./events.js";
|
||||
import { openSpawnModal } from "./spawn.js";
|
||||
import { initTheme } from "./theme.js";
|
||||
import { sessionName } from "./types.js";
|
||||
import "./styles.css";
|
||||
|
||||
initTheme();
|
||||
|
||||
const root = document.getElementById("app");
|
||||
if (!root) {
|
||||
const rootEl = document.getElementById("app");
|
||||
if (!rootEl) {
|
||||
throw new Error("missing #app");
|
||||
}
|
||||
const root: HTMLElement = rootEl;
|
||||
|
||||
// Dev-only: `?kit` renders the standalone design kit instead of the app shell,
|
||||
// so the component system can be reviewed as a whole. Stripped from production
|
||||
// builds by Vite (dynamic import behind import.meta.env.DEV).
|
||||
if (import.meta.env.DEV && location.search.includes("kit")) {
|
||||
void import("./kit.js").then((m) => root.replaceChildren(m.renderKit()));
|
||||
} else {
|
||||
void bootApp();
|
||||
}
|
||||
|
||||
async function bootApp(): Promise<void> {
|
||||
|
||||
const store = new CatalogStore();
|
||||
store.start();
|
||||
@@ -46,9 +60,16 @@ function renderWelcome(): HTMLElement {
|
||||
<div class="empty-glyph" aria-hidden="true">⌘</div>
|
||||
<div class="empty-title">No session open</div>
|
||||
<p class="empty-hint">
|
||||
Pick a session from the list, or press <kbd>+ Spawn</kbd> to start one.
|
||||
Open sessions keep streaming in the background — switching back is instant.
|
||||
</p>`;
|
||||
Pick a session from the list, or start a new one. Open sessions keep
|
||||
streaming in the background — switching back is instant.
|
||||
</p>
|
||||
<div class="empty-actions"></div>`;
|
||||
const spawn = document.createElement("button");
|
||||
spawn.type = "button";
|
||||
spawn.className = "btn btn-primary";
|
||||
spawn.textContent = "+ Spawn session";
|
||||
spawn.addEventListener("click", () => openSpawnModal(store.snapshot().daemons));
|
||||
(el.querySelector(".empty-actions") as HTMLElement).appendChild(spawn);
|
||||
return el;
|
||||
}
|
||||
|
||||
@@ -78,10 +99,15 @@ function parseRoute(): Route {
|
||||
function dispatch(): void {
|
||||
const route = parseRoute();
|
||||
switch (route.kind) {
|
||||
case "attach":
|
||||
case "attach": {
|
||||
shellEl.dataset.route = "attach";
|
||||
pool.activate(route.sessionId, content);
|
||||
const s = store.snapshot().sessions.get(route.sessionId);
|
||||
const info = s
|
||||
? { name: sessionName(s), command: s.command, daemon: s.daemon_id }
|
||||
: undefined;
|
||||
pool.activate(route.sessionId, content, info);
|
||||
return;
|
||||
}
|
||||
case "not-found":
|
||||
shellEl.dataset.route = "notfound";
|
||||
pool.parkActive();
|
||||
@@ -97,3 +123,5 @@ function dispatch(): void {
|
||||
|
||||
window.addEventListener("hashchange", dispatch);
|
||||
dispatch();
|
||||
|
||||
} // bootApp
|
||||
|
||||
Reference in New Issue
Block a user