feat(viz): pin the World to one mission by default
Two leftovers from the sidebar swap. The header still read "N ORGS · N AGENTS", describing the org->company->team forest this tier stopped rendering; it now counts the missions and the distinct people the sidebar actually lists. And with nothing selected the World still fell back to every agent of every mission in one space. That is not a picture of anything that happens — missions do not share a stage, and past a few dozen agents the scene says less the more it shows. It now pins to the most recent mission (the workforce feed is ordered newest-first) and stays on whatever mission is pinned when an agent is selected from the graph rather than from a mission group. Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5
parent
44079eb8b4
commit
b210acf3c2
@@ -749,12 +749,23 @@ export function Dashboard({ user, orgs, claws }: { user?: { display_name?: strin
|
|||||||
// keeps that mission focused, which is what makes clicking around inside a
|
// keeps that mission focused, which is what makes clicking around inside a
|
||||||
// mission feel stable.
|
// mission feel stable.
|
||||||
const focusedMissionId: string | null = (() => {
|
const focusedMissionId: string | null = (() => {
|
||||||
if (!isWorld || !worldSel) return null;
|
if (!isWorld) return null;
|
||||||
|
// Default to the most recent mission rather than the whole workspace.
|
||||||
|
//
|
||||||
|
// The unfocused view drew every agent of every mission into one space,
|
||||||
|
// which is not a picture of anything that happens: missions do not share a
|
||||||
|
// stage, and at tens of agents the scene says less the more it shows.
|
||||||
|
// `/api/workforce` orders missions newest-first, so [0] is the one someone
|
||||||
|
// opening this page is most likely asking about.
|
||||||
|
if (!worldSel) return (workforce?.missions ?? [])[0]?.mission_id ?? null;
|
||||||
if (worldSel.startsWith("mission-group:")) return worldSel.slice("mission-group:".length);
|
if (worldSel.startsWith("mission-group:")) return worldSel.slice("mission-group:".length);
|
||||||
const grouped = (workforce?.missions ?? []).find((m) =>
|
const grouped = (workforce?.missions ?? []).find((m) =>
|
||||||
m.agents.some((a) => `${m.mission_id}:${a.id}` === worldSel),
|
m.agents.some((a) => `${m.mission_id}:${a.id}` === worldSel),
|
||||||
);
|
);
|
||||||
return grouped?.mission_id ?? null;
|
// An agent selected from somewhere other than a mission group (the World
|
||||||
|
// graph itself) keeps whatever mission was already pinned, instead of
|
||||||
|
// silently reverting to the default.
|
||||||
|
return grouped?.mission_id ?? (workforce?.missions ?? [])[0]?.mission_id ?? null;
|
||||||
})();
|
})();
|
||||||
const focusedMission = (workforce?.missions ?? []).find((m) => m.mission_id === focusedMissionId) ?? null;
|
const focusedMission = (workforce?.missions ?? []).find((m) => m.mission_id === focusedMissionId) ?? null;
|
||||||
const focusAgentIds: Set<string> | null = focusedMission
|
const focusAgentIds: Set<string> | null = focusedMission
|
||||||
@@ -901,7 +912,10 @@ export function Dashboard({ user, orgs, claws }: { user?: { display_name?: strin
|
|||||||
{isWorld ? (
|
{isWorld ? (
|
||||||
<div style={{ padding: "16px 16px 12px", borderBottom: "1px solid rgba(255,255,255,.06)", display: "flex", alignItems: "flex-start", gap: 8 }}>
|
<div style={{ padding: "16px 16px 12px", borderBottom: "1px solid rgba(255,255,255,.06)", display: "flex", alignItems: "flex-start", gap: 8 }}>
|
||||||
<div style={{ flex: 1, minWidth: 0 }}>
|
<div style={{ flex: 1, minWidth: 0 }}>
|
||||||
<div style={{ fontFamily: mono, fontSize: 10, letterSpacing: ".12em", color: "#5a5a62", marginBottom: 6 }}>{orgs.length} ORG{orgs.length === 1 ? "" : "S"} · {allAgents.length} AGENTS</div>
|
{/* Counts the things this sidebar actually lists. It used to
|
||||||
|
read "N ORGS", which described the org→company→team forest
|
||||||
|
this tier no longer shows. */}
|
||||||
|
<div style={{ fontFamily: mono, fontSize: 10, letterSpacing: ".12em", color: "#5a5a62", marginBottom: 6 }}>{(workforce?.missions ?? []).length} MISSION{(workforce?.missions ?? []).length === 1 ? "" : "S"} · {distinctAgentCount} AGENT{distinctAgentCount === 1 ? "" : "S"}</div>
|
||||||
<div style={{ fontSize: 18, fontWeight: 700, color: "#f3f3f5", letterSpacing: "-.01em" }}>Visualizations</div>
|
<div style={{ fontSize: 18, fontWeight: 700, color: "#f3f3f5", letterSpacing: "-.01em" }}>Visualizations</div>
|
||||||
</div>
|
</div>
|
||||||
<button type="button" onClick={() => { setSelectMode((v) => { if (v) setSelectedAgents(new Set()); return !v; }); }} title="Select to manage" aria-label="Select to manage" style={{ flex: "none", width: 34, height: 34, borderRadius: 9, border: `1px solid ${selectMode ? "rgba(255,111,97,.5)" : "rgba(255,255,255,.12)"}`, background: selectMode ? "rgba(255,111,97,.12)" : "transparent", color: selectMode ? "#ff6f61" : "#9a9aa2", cursor: "pointer", display: "inline-flex", alignItems: "center", justifyContent: "center" }}><Wrench aria-hidden size={16} /></button>
|
<button type="button" onClick={() => { setSelectMode((v) => { if (v) setSelectedAgents(new Set()); return !v; }); }} title="Select to manage" aria-label="Select to manage" style={{ flex: "none", width: 34, height: 34, borderRadius: 9, border: `1px solid ${selectMode ? "rgba(255,111,97,.5)" : "rgba(255,255,255,.12)"}`, background: selectMode ? "rgba(255,111,97,.12)" : "transparent", color: selectMode ? "#ff6f61" : "#9a9aa2", cursor: "pointer", display: "inline-flex", alignItems: "center", justifyContent: "center" }}><Wrench aria-hidden size={16} /></button>
|
||||||
|
|||||||
Reference in New Issue
Block a user