Skip to content

Commit 81be8e8

Browse files
committed
feat(es-app): hide project board under All (anomalyco#153)
1 parent 6fe2013 commit 81be8e8

4 files changed

Lines changed: 309 additions & 84 deletions

File tree

‎packages/es-app/src/components/sidebar.tsx‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/* Left nav: the board plus every active session. Collapsed, it becomes a
2-
* mini icon rail — expand toggle up top (where the switcher lives), board
1+
/* Left nav: the project board plus every active session. Collapsed, it becomes
2+
* a mini icon rail — expand toggle up top (where the switcher lives), board
33
* icon, then one status dot per session, still navigable. Archived sessions
44
* drop to a collapsed section at the bottom of the expanded view. */
55
import { createEffect, createSignal, For, onCleanup, Show } from "solid-js"
@@ -205,9 +205,11 @@ export default function Sidebar() {
205205
<Show when={!nativeHeader}><button class="mini-btn" title="expand sidebar (^h)" onClick={toggleLeft}>
206206
⟩
207207
</button></Show>
208-
<A href="/" end activeClass="active" class="mini-item" title={`board — ${current()}`}>
209-
▦
210-
</A>
208+
<Show when={!allProjects()}>
209+
<A href="/" end activeClass="active" class="mini-item" title={`board — ${current()}`}>
210+
▦
211+
</A>
212+
</Show>
211213
<NewSession compact />
212214
<Show when={pinnedSessions().length}>
213215
<div class="mini-pinned-heading" title="Pinned sessions" aria-label="Pinned sessions" />
@@ -254,9 +256,12 @@ export default function Sidebar() {
254256
</For>
255257
</div>
256258
</Show>
257-
<A href="/" end activeClass="active" class="nav-item board-link">
258-
▦ {allProjects() ? `${current()} board` : "board"}
259-
</A>
259+
{/* the board is per project; All has no board until it is redesigned */}
260+
<Show when={!allProjects()}>
261+
<A href="/" end activeClass="active" class="nav-item board-link">
262+
▦ board
263+
</A>
264+
</Show>
260265
<NewSession />
261266
<div class="search-box">
262267
<input

‎packages/es-app/src/index.css‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,14 @@ table { border-collapse: collapse; font-size: 12.5px; width: 100%; max-width: 98
945945
td { padding: 4px 10px 4px 0; border-bottom: 1px solid var(--surface0); }
946946
.session-list { font-size: 13px; }
947947

948+
/* All-projects landing (no per-project board under All) */
949+
.all-landing .session-list { max-width: 980px; }
950+
.all-landing .session-list .pr { display: flex; gap: 10px; align-items: baseline; padding: 4px 0; border-bottom: 1px solid var(--surface0); }
951+
.all-landing .session-list .pr > a { display: inline-flex; gap: 6px; align-items: center; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
952+
.all-landing .session-list .pr > .dim { margin-inline-start: auto; flex-shrink: 0; font-size: 12px; white-space: nowrap; }
953+
.all-landing-project h2 { display: flex; gap: 8px; align-items: baseline; }
954+
.all-landing-board { font-size: 11px; padding: 1px 8px; color: var(--lavender); background: var(--mantle); text-transform: none; letter-spacing: normal; font-weight: normal; }
955+
948956
.context-pct { font-size: 11px; color: var(--subtext0); font-family: var(--font-mono); text-align: right; }
949957
.context-pct.warn { color: var(--yellow); }
950958
.context-pct.high { color: var(--red); }

‎packages/es-app/src/pages/home.tsx‎

Lines changed: 159 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* Home = the es dashboard: attention queue + thread cards, from :7777. */
22
import { createMemo, createSignal, For, onMount, Show } from "solid-js"
33
import { A, useNavigate } from "@solidjs/router"
4-
import { ago, linkUrl, sessionHref, useDashboard } from "../state"
4+
import { ago, linkUrl, sessionHref, useDashboard, type SessionRow } from "../state"
55
import { ticketUrl } from "../ticket-url"
66
import { es as esApi } from "../api"
77
import { PrList } from "../components/pr"
@@ -327,6 +327,87 @@ function AllSessions() {
327327
)
328328
}
329329

330+
/* All-projects landing: the board is per project, so `/` under All lists every
331+
* active root session grouped by project instead of one project's board. */
332+
function AllProjectsLanding() {
333+
const { sessions, sessionsLoading, sessionsError, notifications, dotFor, editspaces, setEditspace, markViewed } =
334+
useDashboard()
335+
const groups = createMemo(() => {
336+
const byProject = new Map<string, SessionRow[]>()
337+
for (const s of sessions()) {
338+
const key = s.project || s.directory.split("/").filter(Boolean).at(-1) || s.directory
339+
byProject.set(key, [...(byProject.get(key) ?? []), s])
340+
}
341+
// sessions() is activity-sorted, so each group's first row is its newest
342+
return [...byProject].sort((a, b) => b[1][0].updated - a[1][0].updated)
343+
})
344+
// a group has a board when any of its sessions lives under a registered editspace
345+
const boardFor = (name: string, rows: SessionRow[]) => (editspaces()?.editspaces ?? []).find((item) => {
346+
const root = item.root.replace(/\/+$/, "").replace(/\/\.editspace$/, "")
347+
return item.name === name || rows.some((s) => s.directory === root || s.directory.startsWith(`${root}/`))
348+
})?.name
349+
return (
350+
<main class="all-landing">
351+
<AppHeader>
352+
<h1>All projects</h1>
353+
<span class="dim">
354+
{sessions().length} active session{sessions().length === 1 ? "" : "s"} · {groups().length} project{groups().length === 1 ? "" : "s"}
355+
</span>
356+
<span style="flex:1" />
357+
<span class="dim">choose a project for its board</span>
358+
</AppHeader>
359+
<Show when={notifications().length}>
360+
<h2>Needs you</h2>
361+
<div class="session-list">
362+
<For each={notifications()}>
363+
{(n) => (
364+
<div class="pr">
365+
<A href={sessionHref(n.session, n.directory)} onClick={() => markViewed(n.session, true)}>
366+
<span class={`dot ${dotFor({ id: n.session, updated: n.updated, pending: n.kind !== "idle" })}`} />
367+
<SessionIcon />
368+
{n.title}
369+
</A>
370+
<span class="dim">{n.editspace ? `${n.editspace} · ` : ""}{n.kind}</span>
371+
</div>
372+
)}
373+
</For>
374+
</div>
375+
</Show>
376+
<Show when={sessionsError()}><div class="err">{sessionsError()}</div></Show>
377+
<Show when={groups().length} fallback={<div class="dim">{sessionsLoading() ? "loading…" : "no active sessions"}</div>}>
378+
<For each={groups()}>
379+
{([project, rows]) => (
380+
<section class="all-landing-project" aria-label={project}>
381+
<h2>
382+
{project} <span class="dim">({rows.length})</span>
383+
<Show when={boardFor(project, rows)}>
384+
{(name) => <button type="button" class="all-landing-board" title={`${name()} board`} onClick={() => setEditspace(name())}>
385+
{name() === project ? "board" : `${name()} board`}
386+
</button>}
387+
</Show>
388+
</h2>
389+
<div class="session-list">
390+
<For each={rows}>
391+
{(s) => (
392+
<div class="pr">
393+
<A href={sessionHref(s.id, s.directory)} title={s.directory}>
394+
<span class={`dot ${dotFor(s)}`} />
395+
<SessionIcon />
396+
{s.title || s.id}
397+
</A>
398+
<span class="dim">{dotFor(s)} · {ago(s.updated)}</span>
399+
</div>
400+
)}
401+
</For>
402+
</div>
403+
</section>
404+
)}
405+
</For>
406+
</Show>
407+
</main>
408+
)
409+
}
410+
330411
/* Front desk composer: one ask opens the concierge session (a normal session
331412
* view). A busy front desk absorbs the ask — we navigate to it either way. */
332413
function FrontDesk() {
@@ -410,87 +491,89 @@ export default function Home() {
410491
}
411492

412493
return (
413-
<Show when={state()} fallback={<div class="dim">loading… (is es-dashboard running on :7777?)</div>}>
414-
{(st) => (
415-
<main>
416-
<AppHeader>
417-
<h1>{st().editspace}</h1>
418-
<span class="dim">
419-
updated {ago(st().generated_at * 1000)} · tracker {st().tracker_at ? ago(st().tracker_at * 1000) : "never"} · prs{" "}
420-
{st().prs_at ? ago(st().prs_at * 1000) : "never"}
421-
</span>
422-
<span class="err">
423-
{[st().tracker_error && `tracker: ${st().tracker_error}`, st().prs_error && `prs: ${st().prs_error}`]
424-
.filter(Boolean)
425-
.join(" · ")}
426-
</span>
427-
<span style="flex:1" />
428-
<Show when={st().curated_at}>
429-
<span class="dim">curated {ago(st().curated_at * 1000)}</span>
430-
</Show>
431-
<button onClick={curate} disabled={curating() || st().curating}>
432-
{curating() || st().curating ? "curating…" : "curate"}
433-
</button>
434-
<button onClick={refresh} disabled={refreshing()}>
435-
{refreshing() ? "refreshing…" : "refresh"}
436-
</button>
437-
</AppHeader>
494+
<Show when={!dashboard.allProjects()} fallback={<AllProjectsLanding />}>
495+
<Show when={state()} fallback={<div class="dim">loading… (is es-dashboard running on :7777?)</div>}>
496+
{(st) => (
497+
<main>
498+
<AppHeader>
499+
<h1>{st().editspace}</h1>
500+
<span class="dim">
501+
updated {ago(st().generated_at * 1000)} · tracker {st().tracker_at ? ago(st().tracker_at * 1000) : "never"} · prs{" "}
502+
{st().prs_at ? ago(st().prs_at * 1000) : "never"}
503+
</span>
504+
<span class="err">
505+
{[st().tracker_error && `tracker: ${st().tracker_error}`, st().prs_error && `prs: ${st().prs_error}`]
506+
.filter(Boolean)
507+
.join(" · ")}
508+
</span>
509+
<span style="flex:1" />
510+
<Show when={st().curated_at}>
511+
<span class="dim">curated {ago(st().curated_at * 1000)}</span>
512+
</Show>
513+
<button onClick={curate} disabled={curating() || st().curating}>
514+
{curating() || st().curating ? "curating…" : "curate"}
515+
</button>
516+
<button onClick={refresh} disabled={refreshing()}>
517+
{refreshing() ? "refreshing…" : "refresh"}
518+
</button>
519+
</AppHeader>
438520

439-
<FrontDesk />
521+
<FrontDesk />
440522

441-
<h2>Needs you</h2>
442-
<Queue
443-
attention={st().attention}
444-
threads={st().threads}
445-
directory={st().root}
446-
briefing={st().briefing ?? []}
447-
onBrief={brief}
448-
/>
523+
<h2>Needs you</h2>
524+
<Queue
525+
attention={st().attention}
526+
threads={st().threads}
527+
directory={st().root}
528+
briefing={st().briefing ?? []}
529+
onBrief={brief}
530+
/>
449531

450-
<h2>Threads</h2>
451-
<div class="grid">
452-
<For each={st().threads}>
453-
{(t: any) => (
454-
<ThreadCard
455-
t={t}
456-
directory={st().root}
457-
onDigest={digest}
458-
onBrief={brief}
459-
briefing={st().briefing ?? []}
460-
/>
461-
)}
462-
</For>
463-
</div>
532+
<h2>Threads</h2>
533+
<div class="grid">
534+
<For each={st().threads}>
535+
{(t: any) => (
536+
<ThreadCard
537+
t={t}
538+
directory={st().root}
539+
onDigest={digest}
540+
onBrief={brief}
541+
briefing={st().briefing ?? []}
542+
/>
543+
)}
544+
</For>
545+
</div>
464546

465-
<h2>Unattached PRs</h2>
466-
<div>
467-
<Show when={st().unattached_prs.length} fallback={<span class="dim">none</span>}>
468-
<PrList prs={st().unattached_prs} />
469-
</Show>
470-
</div>
547+
<h2>Unattached PRs</h2>
548+
<div>
549+
<Show when={st().unattached_prs.length} fallback={<span class="dim">none</span>}>
550+
<PrList prs={st().unattached_prs} />
551+
</Show>
552+
</div>
471553

472-
<AllSessions />
554+
<AllSessions />
473555

474-
<h2>Frontier</h2>
475-
<Show when={st().frontier.length} fallback={<span class="dim">empty</span>}>
476-
<table>
477-
<For each={st().frontier}>
478-
{(f: any) => (
479-
<tr>
480-
<td>
481-
<a href={linkUrl(ticketUrl(f.key, f.url))} target="_blank">
482-
{f.key}
483-
</a>
484-
</td>
485-
<td class="dim">{f.issue_type}</td>
486-
<td>{f.summary}</td>
487-
</tr>
488-
)}
489-
</For>
490-
</table>
491-
</Show>
492-
</main>
493-
)}
556+
<h2>Frontier</h2>
557+
<Show when={st().frontier.length} fallback={<span class="dim">empty</span>}>
558+
<table>
559+
<For each={st().frontier}>
560+
{(f: any) => (
561+
<tr>
562+
<td>
563+
<a href={linkUrl(ticketUrl(f.key, f.url))} target="_blank">
564+
{f.key}
565+
</a>
566+
</td>
567+
<td class="dim">{f.issue_type}</td>
568+
<td>{f.summary}</td>
569+
</tr>
570+
)}
571+
</For>
572+
</table>
573+
</Show>
574+
</main>
575+
)}
576+
</Show>
494577
</Show>
495578
)
496579
}

0 commit comments

Comments
 (0)