Team-depth breakdown: members per generation on admin org panel + member dashboard

- chain.js getOrgShare now returns genCounts (breadth-first members per
  generation below the root)
- Admin "Your Organization vs. the Network" panel renders a Gen 1..N bar list
  with fill-vs-capacity (2^n slots)
- Member dashboard "Your team" card gains a Team Depth section computed from
  the subtree client-side, labeling each generation with the level whose
  upgrade pays that position (gen D pays at the level D+1 buy)
- AI chat system prompt updated to describe the new dashboard section

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-08-18 16:40:22 -05:00
parent 9dbe7eddcb
commit b66d3a50e8
5 changed files with 43 additions and 4 deletions
+9 -1
View File
@@ -637,8 +637,16 @@ function getOrgShare(rootId) {
const orgPol = (rm.earnedPol || 0) + (root.downPol || 0);
let generations = 0;
(function depth(n, dep) { if (!n) return; if (dep > generations) generations = dep; depth(n.left, dep + 1); depth(n.right, dep + 1); })(root, 0);
// members per generation below the root (gen 1 = the root's matrix children)
const genCounts = [];
{ let layer = [rootId]; const gseen = new Set([rootId]);
while (layer.length && genCounts.length < 60) {
const next = [];
for (const nid of layer) { const mm = state.members[nid]; if (!mm) continue;
for (const c of [mm.l, mm.r]) if (c && !gseen.has(c) && state.members[c]) { gseen.add(c); next.push(c); } }
if (!next.length) break; genCounts.push(next.length); layer = next; } }
return {
...base, found: true, orgBelow, orgMembers, generations,
...base, found: true, orgBelow, orgMembers, generations, genCounts,
memberPct: +(100 * orgMembers / totalMembers).toFixed(1),
belowPct: +(100 * orgBelow / totalMembers).toFixed(1),
orgPol: +orgPol.toFixed(2),