Merge pull request 'Keep Political CP menus fully expanded' (#327) from dev/MC:dev/alpha-1.0.0.7-the-great-migration into main

This commit is contained in:
Dev 2026-11-15 21:58:16 +01:00
commit 17a90db7b5

View file

@ -17,7 +17,7 @@ function show(){
const tab=POLITICAL_TABS.find(t=>t.id===route.tab),page=tab.pages.find(([id])=>id===route.page);
content.setAttribute('aria-label',page[1]);
sidebar.replaceChildren(el('div','ELECTION CHAMBERS','side-hero'));sidebarRight.replaceChildren(el('div','OFFICES & INSTRUMENTS','side-hero'));
const menu=(host,title,items)=>{const block=el('details',undefined,'category-block');block.open=items.some(([id])=>id===page[0])||title==='Imperial Senate';const summary=el('summary',title,'category-heading'),links=el('div',undefined,'category-links');for(const[id,label]of items){const group=POLITICAL_TABS.find(t=>t.pages.some(([p])=>p===id));const link=el('a',undefined,'navitem');link.href='#'+group.id+'/'+id;link.append(icon(group.id==='directory'?'elections':group.id),el('span',label));if(id===page[0])link.setAttribute('aria-current','page');links.append(link);}block.append(summary,links);host.append(block);};
const menu=(host,title,items)=>{const block=el('section',undefined,'category-block');const summary=el('div',title,'category-heading'),links=el('div',undefined,'category-links');for(const[id,label]of items){const group=POLITICAL_TABS.find(t=>t.pages.some(([p])=>p===id));const link=el('a',undefined,'navitem');link.href='#'+group.id+'/'+id;link.append(icon(group.id==='directory'?'elections':group.id),el('span',label));if(id===page[0])link.setAttribute('aria-current','page');links.append(link);}block.append(summary,links);host.append(block);};
menu(sidebar,'Imperial Senate',[['imperial-elections','Emperor election'],['house-elections','House Leader elections']]);
menu(sidebar,'Small Council',ELECTIONS.filter(e=>e.chamber==='Small Council').map(e=>['election-'+e.id,e.label]));
menu(sidebar,'Voting Directory',POLITICAL_TABS.find(t=>t.id==='directory').pages);