forked from unimatrix/web
Use the registered DuneForge name in the CP workspace switch
This commit is contained in:
parent
8b728d414e
commit
6dc15b20b1
3 changed files with 22 additions and 4 deletions
|
|
@ -253,5 +253,5 @@ document.querySelector('#mobile-menu').onclick=()=>{const opened=sidebar.classLi
|
|||
// Finish the shared page pattern for retained adapters as they mount.
|
||||
const headingObserver=new MutationObserver(()=>{const hero=content.querySelector(':scope > .hero');if(!hero)return;for(const host of content.querySelectorAll('.citizen-live-host')){for(const heading of host.querySelectorAll(':scope > .cp-v2-template-page > .cp-v2-template-heading')){const title=heading.querySelector('h3')?.textContent,copy=heading.querySelector('p')?.textContent,icon=heading.querySelector('img');if(title)hero.querySelector('h1').textContent=title;if(copy)hero.querySelector('p').textContent=copy;if(icon)hero.querySelector('img').src=icon.src;heading.remove();}for(const duplicate of host.closest('article.card')?.querySelectorAll(':scope > h2, :scope > .hint')||[])duplicate.remove();}});headingObserver.observe(content,{childList:true,subtree:true});
|
||||
|
||||
function renderComfortNavigation(active){let bar=document.querySelector(".comfort-workspaces");if(!bar){bar=el("nav","comfort-workspaces");bar.setAttribute("aria-label","Account workspaces");(document.querySelector(".command-banner")||document.querySelector("#portals")).after(bar);}bar.replaceChildren();const select=el("select");select.setAttribute("aria-label","Personal service");const personal=menu.workspaces.filter(w=>!["clan","bureau","forge"].includes(w.id));if(!personal.some(w=>w.id===active)){const placeholder=el("option","","Choose a personal service");placeholder.value="";placeholder.disabled=true;placeholder.selected=true;select.append(placeholder);}for(const w of personal){const o=el("option","",w.label);o.value=w.id;o.selected=active===w.id;select.append(o);}const label=el("label","comfort-service","Personal");label.append(select);select.onchange=()=>go(select.value);bar.append(label);const organisation=el("a","comfort-org","Organisations");organisation.href="https://www.dunerealms.com/realm-hub.html";bar.append(organisation);for(const w of menu.workspaces.filter(w=>["bureau","forge"].includes(w.id))){const b=el("button","comfort-staff",w.id==="bureau"?"Staff":"Development");b.type="button";b.setAttribute("aria-current",active===w.id?"page":"false");b.onclick=()=>go(w.id);bar.append(b);}}
|
||||
function renderComfortNavigation(active){let bar=document.querySelector(".comfort-workspaces");if(!bar){bar=el("nav","comfort-workspaces");bar.setAttribute("aria-label","Account workspaces");(document.querySelector(".command-banner")||document.querySelector("#portals")).after(bar);}bar.replaceChildren();const select=el("select");select.setAttribute("aria-label","Personal service");const personal=menu.workspaces.filter(w=>!["clan","bureau","forge"].includes(w.id));if(!personal.some(w=>w.id===active)){const placeholder=el("option","","Choose a personal service");placeholder.value="";placeholder.disabled=true;placeholder.selected=true;select.append(placeholder);}for(const w of personal){const o=el("option","",w.label);o.value=w.id;o.selected=active===w.id;select.append(o);}const label=el("label","comfort-service","Personal");label.append(select);select.onchange=()=>go(select.value);bar.append(label);const organisation=el("a","comfort-org","Organisations");organisation.href="https://www.dunerealms.com/realm-hub.html";bar.append(organisation);for(const w of menu.workspaces.filter(w=>["bureau","forge"].includes(w.id))){const b=el("button","comfort-staff",w.id==="bureau"?"Staff":w.label);b.type="button";b.setAttribute("aria-current",active===w.id?"page":"false");b.onclick=()=>go(w.id);bar.append(b);}}
|
||||
if(parent!==window)document.documentElement.classList.add('dune-embedded');
|
||||
|
|
|
|||
|
|
@ -113,18 +113,24 @@ similar-looking implementations.
|
|||
`homepage-header.mjs`, `portal-navigation.mjs` and `site-chrome.mjs`.
|
||||
- DuneForge workspace route: `https://cp.dunerealms.com/#forge/git-workspace`.
|
||||
PR619 adds it to the shared My Account menu.
|
||||
- The CP workspace switch currently labels the Forge workspace "Development"
|
||||
- The CP workspace switch labelled the Forge workspace "Development"
|
||||
in `renderComfortNavigation` even though its registry label is DuneForge.
|
||||
That mismatch has been identified, not fixed in code commit207002b.
|
||||
The follow-up navigation fix uses the registered workspace label and retains
|
||||
the existing route and access-filtered workspace list. Its regression check
|
||||
verifies the DuneForge button, destination and absence without Forge access.
|
||||
- The public live portal and CP were compared directly: their returned
|
||||
header HTML, footer HTML and header runtime bytes were identical at the
|
||||
check. Both runtimes were 26,971 characters and contained the shared mount.
|
||||
This does not prove the signed-in rendered views or cached browser state
|
||||
match. The owner's reported visual difference still needs rendered,
|
||||
signed-in verification; do not claim it is fixed from source equality alone.
|
||||
- An in-app browser check reached the live CP sign-in shell and confirmed
|
||||
the shared public navigation, but no signed-in session was available there.
|
||||
No account was signed in or altered for this check.
|
||||
- Pending: verify the signed-in rendering, remove the actual cause of any
|
||||
visual divergence, keep workspace navigation distinct from global chrome,
|
||||
align the DuneForge workspace label and publish through the build.
|
||||
and publish through the build. Do not replace the canonical shared header
|
||||
with a second CP-specific header.
|
||||
|
||||
## Plugin coordination and corrected GUI acceptance
|
||||
|
||||
|
|
|
|||
|
|
@ -26,3 +26,15 @@ test('personal bank appears once directly below correspondence with existing acc
|
|||
test('shop administration opens the native commerce login in a separate tab',()=>{
|
||||
const item=menu.workspaces.find(w=>w.id==='bureau').groups.flatMap(g=>g.items).find(i=>i.id==='shop-admin');assert.equal(item.href,'https://shop.dunerealms.com/admin/');assert.equal(item.target,'_blank');assert.ok(item.viewPermission);
|
||||
});
|
||||
|
||||
test('the CP workspace switch names DuneForge consistently and keeps its existing route',()=>{
|
||||
const start=source.indexOf('function renderComfortNavigation('),end=source.indexOf('\nif(parent',start);
|
||||
assert(start>=0&&end>start);const calls=[],bar={children:[],replaceChildren(){this.children=[];},append(...children){this.children.push(...children);}};
|
||||
const element=(tag,cls,text)=>({tag,cls,text,children:[],setAttribute(){},append(...children){this.children.push(...children);}});
|
||||
const execute=workspaces=>{runInNewContext(source.slice(start,end)+';renderComfortNavigation("forge");',{
|
||||
menu:{workspaces},document:{querySelector:selector=>selector==='.comfort-workspaces'?bar:null},el:element,go:id=>calls.push(id),
|
||||
});return bar.children.filter(node=>node.tag==='button');};
|
||||
const buttons=execute(menu.workspaces),forge=buttons.find(button=>button.text==='DuneForge');
|
||||
assert(forge);assert(!buttons.some(button=>button.text==='Development'));forge.onclick();assert.deepEqual(calls,['forge']);
|
||||
assert(!execute(menu.workspaces.filter(workspace=>workspace.id!=='forge')).some(button=>button.text==='DuneForge'));
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff