From 7bc4121c9f2f424584813ecca68597b1292ae2d6 Mon Sep 17 00:00:00 2001 From: unimatrixgit <95320811+unimatrixgit@users.noreply.github.com> Date: Sat, 14 Nov 2026 23:50:24 +0100 Subject: [PATCH] Route legacy citizen clan and political banking views to Postbank --- website/control-panel/public/clan-shop.mjs | 2 +- website/control-panel/public/cp-v2/cp-v2-bureau-pages.mjs | 4 ++-- website/control-panel/public/cp-v2/cp-v2-user-pages.mjs | 5 +++-- website/control-panel/public/politics.mjs | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/website/control-panel/public/clan-shop.mjs b/website/control-panel/public/clan-shop.mjs index a7146283..ec6f4548 100644 --- a/website/control-panel/public/clan-shop.mjs +++ b/website/control-panel/public/clan-shop.mjs @@ -17,7 +17,7 @@ function refresh(view){const b=el('button','Refresh');b.type='button';b.onclick= function priceEditor(view){if(!data.canSetPrice)return;const form=el('form');form.className='clan-form';const label=el('label','Full clan kit price · Dunemarks'),price=el('input');price.type='number';price.min=1;price.max=1000000;price.required=true;price.value=data.priceDunemarks;label.append(price);const save=el('button','Set kit price');save.type='submit';save.dataset.duneAction='admin';form.append(label,save);form.onsubmit=async e=>{e.preventDefault();const g=generation;save.disabled=true;try{const r=await fetch('/api/clans/shop/price',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({priceDunemarks:Number(price.value)})});const d=await r.json();if(!r.ok)throw Error(d.message);if(g===generation)await load();}catch(e){if(g===generation)view.status.textContent=e.message;}finally{if(g===generation)save.disabled=false;}};view.body.append(form);} function renderShop(v){header(v,'shops','Clan shops','Equipment commissioned under your clan banner.','nav-exchange-full-v2.webp');const card=el('article');card.className='clan-shop-card';const image=el('img');image.src='https://www.dunerealms.com/assets/clan-atelier-v1.webp';image.alt='Illustrated desert stillsuit armour display';const copy=el('div');copy.append(el('span','UNCOMMON · FOUR-PIECE SET'),el('h3',data.blueprint?.name||'Clan stillsuit'),el('strong',data.priceDunemarks+' Dunemarks'),el('p','Paid from the buyer’s Dunemarks wallet. Physical spice is not used.'));if(data.blueprint){for(const line of data.blueprint.lore)copy.append(el('p',line));const swatch=el('span',data.blueprint.color);swatch.className='clan-kit-swatch';swatch.style.backgroundColor=data.blueprint.color;copy.append(swatch,el('p','Open the Clan Shop in game to confirm payment and receive your four armour pieces.'));}else copy.append(el('p','Your clan owner or an officer must save a kit design before members can purchase it.'));card.append(image,copy);v.body.append(card);priceEditor(v);} function renderKits(v){header(v,'kits','House Tailor','Commission your clan’s colours and write the lore carried into the desert.','items/office_water.png');const g=generation,mount=createHouseTailor({data,save:api,isCurrent:()=>g===generation&&mount.element.isConnected});v.body.append(mount.element);} -function renderBank(v){header(v,'bank','Clan Treasury','Your clan’s Dunemarks treasury and recorded transactions.','dunemark-icon-64.png');v.body.classList.add('imperial-bank-view');const brand=el('img');brand.src='/assets/imperial-postbank-v2.png';brand.alt='Imperial Postbank · Part of Corrino Group';brand.className='imperial-bank-brand';brand.width=480;v.body.append(brand);refresh(v);if(!data.bankAvailable){v.body.append(el('p','The Dunemarks bank connection is temporarily unavailable.'));return;}const stats=el('div');stats.className='clan-stat-grid';const total=el('article');total.append(el('small','CLAN BALANCE · DUNEMARKS'),el('strong',data.bank.balanceDunemarks+' DM'));const access=el('article');access.append(el('small','YOUR BANK ACCESS'),el('strong',['owner','officer'].includes(data.clan.role)?'Officer':'Member'));stats.append(total,access);const account=el('article');account.className='imperial-account-card';account.append(el('small','CLAN ACCOUNT NUMBER'),el('strong',data.bank.accountNumber),el('p',data.clan.name));v.body.append(account,stats,el('p','Deposit and withdraw Dunemarks in game. Bank withdrawals require the clan owner or an officer. No physical spice is used.'),el('h3','Transaction ledger'));const scroll=el('div');scroll.className='clan-table-scroll';const table=el('table');table.className='clan-table';const head=el('tr');for(const t of ['Date','Entry','From account','To account','Dunemarks','Balance after'])head.append(el('th',t));table.append(head);for(const row of data.bank.ledger){const tr=el('tr');tr.append(el('td',new Date(Number(row.createdAt)).toLocaleString()),el('td',row.kind),el('td',row.amountDunemarks.startsWith('-')?data.bank.accountNumber:'Not recorded'),el('td',row.amountDunemarks.startsWith('-')?'Not recorded':data.bank.accountNumber),el('td',row.amountDunemarks),el('td',row.balanceDunemarks));table.append(tr);}scroll.append(table);v.body.append(scroll);if(!data.bank.ledger.length)v.body.append(el('p','No bank transactions recorded yet.'));} +function renderBank(v){header(v,'bank','Clan Banking','Manage your authorised clan accounts in Imperial Postbank.','imperial-postbank-v2.png');const link=el('a','Open Imperial Postbank');link.href='https://cp.dunerealms.com/#bank/bank-overview';link.target='_top';v.body.append(link);} function questMenu(v,current){const nav=el('nav');nav.className='quest-submenu';nav.setAttribute('aria-label','Quest categories');for(const[id,label]of [['player','Player Quests'],['clan','Clan Quests'],['guild','Spacing Guild Quests']]){const a=el('a',label);if(data.member||id==='player')a.href='#clan-quests-'+id;else{a.setAttribute('aria-disabled','true');a.title='Join a clan to unlock this section.';}if(current===id)a.setAttribute('aria-current','page');nav.append(a);}v.body.append(nav);} function placeholders(v,kind){const labels={player:['Personal quest journal','Track your own objectives and plan your next crossing.'],clan:['Clan expedition ledger','Coordinate shared objectives and clan contributions.'],guild:['Spacing Guild contracts','Personal assignments and contracts undertaken by your clan.']};header(v,'quests',...labels[kind],'nav-manual-full-v2.webp');questMenu(v,kind);if(kind==='player'){const host=el('div');v.body.append(host);mountPersonalKitArc(host);return;}const banner=el('aside');banner.className='quest-preview-notice';banner.append(el('strong','LAYOUT PREVIEW'),el('p','Example planning material only. These entries are not active quests and grant no rewards.'));v.body.append(banner);if(kind==='player'){const live=el('a','Open your live quest journal');live.href='#quests';v.body.append(live);}const stats=el('div');stats.className='clan-stat-grid';for(const label of ['Active objectives','Completed journeys','Rewards ready']){const c=el('article');c.append(el('small',label),el('strong','—'));stats.append(c);}v.body.append(stats);const tools=el('nav');tools.className='quest-preview-filters';for(const label of ['Overview','In progress','Completed','Archived']){const b=el('button',label);b.type='button';b.disabled=true;tools.append(b);}v.body.append(tools);const cards=el('div');cards.className='quest-plan-grid';const examples=kind==='player'?[['Desert field training','Prepare a stillsuit, learn the safe routes and record a first expedition.','Personal objectives'],['A traveller’s provisions','Organise supplies before your next planetary crossing.','Personal checklist']]:kind==='clan'?[['Raise the clan banner','Plan a shared expedition and assign contributions to clan members.','Clan objectives'],['Caravan provisions','Review collective supplies and coordinate your clan’s next journey.','Member contributions']]:[['Personal Guild contract','A reserved place for individual travel and courier assignments.','Player contracts'],['Clan Guild charter','A reserved place for coordinated contracts undertaken under your clan banner.','Clan contracts']];for(const[title,description,scope]of examples){const card=el('article'),img=el('img');img.src='https://www.dunerealms.com/assets/'+(kind==='guild'?'guild.webp':'nav-manual-full-v2.webp');img.alt='';card.append(img,el('small','PLANNED · '+scope),el('h3',title),el('p',description),el('p','Objectives · — Progress · — Reward · Not configured'));const button=el('button','Details coming soon');button.type='button';button.disabled=true;card.append(button);cards.append(card);}v.body.append(cards);} async function render(id){const v=views[id];if(!v||!data)return;v.status.textContent='';if(!data.member&&!id.startsWith('clan-quests')){header(v,id.slice(5),'Join a clan','A verified clan membership is required for this page.');v.body.append(el('p','Your personal quest journal is available without a clan.'));const a=el('a','Open Player Quests');a.href='#clan-quests-player';v.body.append(a);return;}if(id==='clan-shops')renderShop(v);else if(id==='clan-kits')renderKits(v);else if(id==='clan-bank')renderBank(v);else if(id==='clan-settings'){header(v,'settings','Clan settings','Manage your banner, membership and leadership.');const mount=el('div');v.body.append(mount);if(!await mountOwnClanManagement(mount))mount.append(el('p','Clan management could not be loaded. Refresh to retry.'));}else if(id==='clan-portal'){header(v,'portal','Clan portal','Your clan’s operations, colours and shared journeys.');const cards=el('div');cards.className='clan-portal-grid';for(const[key,label,art]of entries.filter(x=>x[0]!=='portal')){const a=el('a');a.href='#clan-'+key;const image=el('img');image.src='https://www.dunerealms.com/assets/'+art;image.alt='';a.append(image,el('h3',label),el('p',{shops:'Commission a full clan stillsuit.',kits:'Design your clan colours and lore.',bank:'Inspect the Dunemarks balance and ledger.',settings:'Manage members and your banner.',quests:'Plan personal and clan journeys.'}[key]));cards.append(a);}v.body.append(cards);}else{let kind=id.split('-').at(-1);if(!['player','clan','guild'].includes(kind))kind='player';if(!data.member&&kind!=='player'){header(v,'quests','Clan membership required','Only Player Quests are available without a clan.','nav-manual-full-v2.webp');questMenu(v,'player');return;}placeholders(v,kind);}} diff --git a/website/control-panel/public/cp-v2/cp-v2-bureau-pages.mjs b/website/control-panel/public/cp-v2/cp-v2-bureau-pages.mjs index 8d20c033..cbbeece2 100644 --- a/website/control-panel/public/cp-v2/cp-v2-bureau-pages.mjs +++ b/website/control-panel/public/cp-v2/cp-v2-bureau-pages.mjs @@ -12,7 +12,7 @@ import {createCPV2Page,element as el} from './cp-v2-page-template.mjs'; import {mountReadRegister} from './cp-v2-read-register.mjs'; import {BUREAU_READS} from './cp-v2-bureau-data.mjs'; import {mountCompanyActions} from './cp-v2-company-actions.mjs'; -import {mountImperialRevenue} from './cp-v2-imperial-revenue.mjs'; +import {mountPostbankAdmin} from './cp-v2-postbank-admin.mjs'; // Imperial Bureau pages not yet backed by verified V2 APIs. Never expose fake writes. const PAGES={"company-management":{"title":"Company Directorate","tabs":["Enterprise registry","Corporate governance","Company permissions"]},"company-management-v2":{"title":"Corporate Administration","tabs":["Company administration","Officer assignments","Corporate settings"]},"company-audit":{"title":"Corporate Audit","tabs":["Audit register","Corporate changes","Compliance reports"]},"staff-bank":{"title":"Imperial Revenue","tabs":["Revenue overview","Collections","Allocation controls"]},"server-kits":{"title":"Kit Directorate","tabs":["Kit catalogue","Kit administration","In-game delivery"]},"kit-publishing":{"title":"Kit Publications","tabs":["Publication queue","Published kits","Version history"]},"kit-claims":{"title":"Claim Registry","tabs":["Claim requests","Claim history","Delivery reconciliation"]},"exchange-admin":{"title":"Exchange Authority","tabs":["Exchange operations","Listing moderation","Trade oversight"]},"shop-admin":{"title":"Merchant Directorate","tabs":["Merchant directory","Shop approvals","Sales administration"]},"items":{"title":"Item Registry","tabs":["Item catalogue","Item definitions","Publishing queue"]},"website-posts":{"title":"Imperial Newsroom","tabs":["Newsroom drafts","Publication schedule","Published announcements"]},"staff-tickets":{"title":"Petition Office","tabs":["Incoming petitions","Assigned cases","Resolution history"]},"bans":{"title":"Tribunal","tabs":["Tribunal cases","Sanctions register","Appeal reviews"]},"ban-evidence":{"title":"Evidence Registry","tabs":["Evidence register","Case attachments","Chain of custody"]},"forum-admin":{"title":"Forum Wardens","tabs":["Forum reports","Moderation queue","Community rules"]},"quests-admin":{"title":"Campaign Directorate","tabs":["Campaign catalogue","Quest publishing","Participation reports"]},"community-goals":{"title":"Community Treasury","tabs":["Treasury goals","Contribution records","Funding oversight"]},"support-management":{"title":"Petition Administration","tabs":["Support queue","Staff assignments","Service reports"]},"server-operations":{"title":"Network Command","tabs":["Network overview","Server operations","Incident register"]},"hosting-control":{"title":"Hosting Command","tabs":["Infrastructure status","Hosting controls","Change approvals"]},"dev-approvals":{"title":"Development Approvals","tabs":["Approval queue","Change proposals","Decision history"]}}; const artFor=id=>/kit|item|dev/.test(id)?'nav-manual-v2.webp':/bank|exchange|shop|revenue|treasury/.test(id)?'nav-exchange-v2.webp':'nav-staff-v2.webp'; @@ -101,6 +101,6 @@ export function mountBureauPlaceholder(host,id){ if(id==='website-posts')return mountNewsroom(host); if(SERVICE_PAGES[id])return mountBureauServicePage(host,id); if(id==='company-management')return mountCompanyDirectorate(host); - if(id==='staff-bank')return mountImperialRevenue(host); + if(id==='staff-bank')return mountPostbankAdmin(host,'staff-bank'); if(BUREAU_READS[id]){const spec=PAGES[id];return mountReadRegister(host,{title:spec.title,description:'Imperial Bureau · '+spec.title+' · Read-only preview',artwork:artFor(id),tabs:spec.tabs.map((label,index)=>({id:'area-'+(index+1),label,...BUREAU_READS[id][index]}))});} const spec=PAGES[id];if(!spec)throw Error('Unknown Bureau page');const artwork=artFor(id);const tabs=spec.tabs.map((label,index)=>{const content=el('section',undefined,'cp-v2-bank-placeholder');const image=el('img');image.src='https://www.dunerealms.com/assets/'+artwork;image.alt='';image.width=82;image.height=82;content.append(image,el('h4',label),el('p',label+' will be connected to its verified authorization and data service during V2 integration.'),el('p','V2 · PLANNED — no live data or administrative changes are available here.','cp-v2-bank-status'));return{id:'area-'+(index+1),label,artwork,content}});const {root}=createCPV2Page({title:spec.title,description:'Imperial Bureau · '+spec.title+' workspace.',artwork,tabs});host.replaceChildren(root);return()=>root.remove()} diff --git a/website/control-panel/public/cp-v2/cp-v2-user-pages.mjs b/website/control-panel/public/cp-v2/cp-v2-user-pages.mjs index 721db98f..8b1df7bc 100644 --- a/website/control-panel/public/cp-v2/cp-v2-user-pages.mjs +++ b/website/control-panel/public/cp-v2/cp-v2-user-pages.mjs @@ -12,7 +12,8 @@ export function mountUserPage(host,id,{fetcher=fetch,initialTab,listingId}={}){ async function mount(){ const loaders={game:['./cp-v2-passport.mjs','mountPassport'],'site-profile':['./cp-v2-personal-records.mjs','mountPersonalRecords'],security:['./cp-v2-security.mjs','mountSecurity'],'rewards-codes':['./cp-v2-rewards.mjs','mountRewards']}; if(loaders[id]){const [path,key]=loaders[id],module=await import(path);if(active)dispose=module[key](host,{fetcher,initialTab});return;} - if(['tickets','clans','shared-inbox','kits-exchange','personal-bank'].includes(id)){const {mountNativeService}=await import('./cp-v2-native-services.mjs');if(active)dispose=mountNativeService(host,id,{fetcher,singleHeading:true,initialTab,listingId});return;} + if(['personal-bank','transactions'].includes(id)){const {mountBankPage}=await import('./cp-v2-bank-pages.mjs');if(active)dispose=mountBankPage(host,id==='transactions'?'bank-statements':'personal-bank',{fetcher});return;} + if(['tickets','clans','shared-inbox','kits-exchange'].includes(id)){const {mountNativeService}=await import('./cp-v2-native-services.mjs');if(active)dispose=mountNativeService(host,id,{fetcher,singleHeading:true,initialTab,listingId});return;} if(id==='planetary-inventory'){ const {mountInventory}=await import('/inventory/inventory-view.mjs');if(!active)return; if(!document.querySelector('link[data-v2-inventory]')){const css=el('link');css.rel='stylesheet';css.href='/inventory/inventory.css';css.dataset.v2Inventory='true';document.head.append(css);} @@ -20,7 +21,7 @@ export function mountUserPage(host,id,{fetcher=fetch,initialTab,listingId}={}){ const {root}=createCPV2Page({shellHost:host,title:'My Inventory',description:'Your saved planetary equipment and exchange history, connected to the existing game inventory service.',artwork:'nav-account-v2.webp',tabs:[{id:'inventory-record',label:'Equipment & ledger',content:inventory}]});host.replaceChildren(root); const view=mountInventory(inventory,{request:api.request,visibleTabs:['inventory','history'],title:'Saved inventory'});dispose=()=>{view.clear();root.remove();};return; } - if(['transactions','shop-settings','exchange-settings'].includes(id)){const {mountUserCommerce}=await import('./cp-v2-user-commerce.mjs');if(active)dispose=mountUserCommerce(host,id,{fetcher});return;} + if(['shop-settings','exchange-settings'].includes(id)){const {mountUserCommerce}=await import('./cp-v2-user-commerce.mjs');if(active)dispose=mountUserCommerce(host,id,{fetcher});return;} if(id==='quests'){mountQuests();return;} if(id==='discord-link'){ const box=el('section',undefined,'cp-v2-personal-box'),{root}=createCPV2Page({shellHost:host,title:'Discord Link',description:'Your Discord community presence and account-linking availability.',artwork:'nav-discord-v2.webp',tabs:[{id:'discord-identity',label:'Discord identity',content:box}]});host.replaceChildren(root); diff --git a/website/control-panel/public/politics.mjs b/website/control-panel/public/politics.mjs index 518f8e62..7945127b 100644 --- a/website/control-panel/public/politics.mjs +++ b/website/control-panel/public/politics.mjs @@ -118,8 +118,8 @@ function render(){ const house=views['house-elections'].content; if(context?.faction){const name=context.faction[0].toUpperCase()+context.faction.slice(1);house.append(card(name+' · House chamber','Your faction was confirmed from your linked Minecraft account. The register below contains real candidatures for this chamber.','seals/office-house_leader.png'),renderVoting('house'));} else{const title=context?.linked===false?'Link your Minecraft account':context?'House not confirmed':'Checking your linked House';const box=card(title,context?.linked===false?'Link your Minecraft identity to enter the chamber belonging to the faction you chose in game.':'Your House has not been confirmed. Other House elections remain hidden.','seals/office-house_leader.png');box.append(artLink('Minecraft account','game','nav-clan-v2.webp'));house.append(box);} - const council=views['formal-council'].content;if(context?.factionAccount){const treasury=card('House Treasury',context.factionAccount,'dunemark-icon-64.png');treasury.classList.add('imperial-account-card');const brand=el('img');brand.src='/assets/imperial-postbank-v2.png';brand.alt='Imperial Postbank · Part of Corrino Group';brand.className='imperial-bank-brand';brand.width=480;treasury.prepend(brand);council.append(treasury);}council.append(councilPreview(),rallyPreview(),revoltPreview(),warPreview(),inboxPreview());if(views['shared-inbox'].section.dataset.internalMail!=='true')views['shared-inbox'].content.append(el('p','Loading your private inbox…')); - const councilLink=card('Faction Council','Banking, appointments, rallies, war requests and your shared inbox.','seals/office-house_leader.png');councilLink.append(artLink('Enter the council','formal-council','seals/office-house_leader.png'));landing.append(councilLink); + const council=views['formal-council'].content;{const treasury=card('House Treasury','Manage your authorised House and office accounts in Imperial Postbank.','imperial-postbank-v2.png');const link=el('a','Open Imperial Postbank');link.href='https://cp.dunerealms.com/#bank/bank-overview';link.target='_top';treasury.append(link);council.append(treasury);}council.append(councilPreview(),rallyPreview(),revoltPreview(),warPreview(),inboxPreview());if(views['shared-inbox'].section.dataset.internalMail!=='true')views['shared-inbox'].content.append(el('p','Loading your private inbox…')); + const councilLink=card('Faction Council','Appointments, rallies, war requests, your shared inbox and Imperial Postbank access.','seals/office-house_leader.png');councilLink.append(artLink('Enter the council','formal-council','seals/office-house_leader.png'));landing.append(councilLink); const lore=card('The Veiled Concord · Caitain','In the quiet courts of Caitain, the Concord keeps the promises that crowns forget. Its scholars train in memory, diplomacy and patient observation. Three woven paths surround a guiding star upon their seal: knowledge, restraint and accord. Their elected Reverent Mother speaks with the standing of a House leader, while an appointed Concord Sister tends the treasury. They may counsel another House toward war, but never declare it themselves.','seals/veiled-concord-v1.png');lore.classList.add('politics-concord');landing.append(lore); for(const key of ['house-elections','imperial-elections']){const note=views[key].section.querySelector('.politics-preview-note');if(note)note.textContent='ELECTION CHAMBER · Real candidates and definitive votes. Voting opens at the scheduled time.';} const imperial=views['imperial-elections'].content;imperial.append(renderVoting('imperial'));