Show the whole-organization totals above the matrix view

New org bar at the top of the Your team panel: total members below
(full-depth rollup), generations deep, qualified count, and POL
earned below. Chatbot canned answer + AI prompt updated in sync.
This commit is contained in:
martbost
2026-08-20 16:16:22 -05:00
parent d6fa42999f
commit 9f66412f8c
4 changed files with 24 additions and 2 deletions
+20
View File
@@ -75,6 +75,25 @@
};
out.innerHTML=`<ul class="mt-tree">${node(home,0)}</ul>`;
}
function renderOrgBar(d){
const el=document.getElementById('dOrgBar');
if(!el)return;
const st=d.subtree;
if(!st||!st.downCount){el.innerHTML='';return}
let gens=0,layer=[st];
while(layer.length&&gens<60){
const next=[];
layer.forEach(n=>{if(n.left)next.push(n.left);if(n.right)next.push(n.right);});
if(!next.length)break;gens++;layer=next;
}
const q=Object.values(treeUI.byId).filter(n=>n.id!==d.id&&n.directCount>=2).length;
el.innerHTML=`<div style="display:flex;gap:10px;flex-wrap:wrap;margin:0 0 14px">`+
`<div class="fact" style="flex:1;min-width:130px"><small>Your organization</small><strong style="font-size:22px;color:var(--gold)">${st.downCount.toLocaleString()} member${st.downCount===1?'':'s'}</strong></div>`+
`<div class="fact" style="flex:1;min-width:110px"><small>Generations deep</small><strong style="font-size:22px">${gens}</strong></div>`+
`<div class="fact" style="flex:1;min-width:110px"><small>Qualified below you</small><strong style="font-size:22px">${q}</strong></div>`+
`<div class="fact" style="flex:1;min-width:140px"><small>Earned below you</small><strong style="font-size:22px;color:var(--ok)">${fmt(st.downPol)} POL</strong></div>`+
`</div>`;
}
function renderTree(){
const tb=document.getElementById('dTreeToggle');
if(tb)tb.textContent=treeUI.mode==='pyramid'?'List view':'Pyramid view';
@@ -107,6 +126,7 @@
`<div class="fact"><small>Member since</small><strong>${date(d.joinedAt)}</strong></div>`;
treeUI.byId={};treeUI.parent={};treeUI.homeId=d.id;treeUI.rootId=d.id;
indexTree(d.subtree,null);
renderOrgBar(d);
renderTree();
// spillover explainer — shown exactly when the confusing state exists:
// positions sitting under you while you're not yet qualified