forked from unimatrix/web
Brand the Imperial code desk and register as SPost
This commit is contained in:
parent
d8eea23814
commit
66c25d91e1
2 changed files with 2 additions and 2 deletions
|
|
@ -17,7 +17,7 @@ export function describeRedemption(value){
|
|||
|
||||
export function createCodeRedemption(){
|
||||
let reviewed=null,locked=false;
|
||||
const root=el('section',undefined,'code-redemption'),hero=el('header',undefined,'reward-code-banner'),art=el('img');art.src='https://www.dunerealms.com/assets/imperial-seal-128.png';art.alt='';const heading=el('div');heading.append(el('small','THE IMPERIAL CODE OFFICE'),el('h4','Present your code. Open your next chapter.'),el('p','One counter for rewards, founding rights and political appointments.'));hero.append(art,heading);
|
||||
const root=el('section',undefined,'code-redemption'),hero=el('header',undefined,'reward-code-banner'),art=el('img');art.src='https://www.dunerealms.com/assets/imperial-seal-128.png';art.alt='';const heading=el('div');heading.append(el('small','SPOST · IMPERIAL CODE OFFICE'),el('h4','Present your code. Open your next chapter.'),el('p','Your SPost counter for rewards, founding rights and political appointments.'));hero.append(art,heading);
|
||||
const layout=el('div',undefined,'code-redemption-layout'),form=el('form',undefined,'code-redemption-card'),entry=el('fieldset'),legend=el('legend','1 · Enter your private code'),label=el('label','Code'),input=el('input');input.type='text';input.autocomplete='off';input.spellcheck=false;input.autocapitalize='characters';input.required=true;input.maxLength=80;input.placeholder='Paste your complete code';input.setAttribute('aria-describedby','redemption-code-help');const help=el('p','Keep your code private. Checking its format does not use it.','code-redemption-muted');help.id='redemption-code-help';label.append(input);const inspect=el('button','Review code');inspect.type='button';entry.append(legend,label,help,inspect);
|
||||
const preview=el('fieldset',undefined,'code-redemption-preview');preview.hidden=true;preview.append(el('legend','2 · Review & confirm'));const badge=el('span',undefined,'reward-kind'),title=el('h5'),effect=el('p'),verification=el('p','Format recognised. Ownership and eligibility are checked when you submit.','code-redemption-muted'),check=el('input');check.type='checkbox';const consent=el('label',undefined,'code-redemption-consent');consent.append(check,el('span','I understand this action and want to use my code.'));const submit=el('button','Confirm redemption');submit.type='submit';submit.disabled=true;const destination=el('a');destination.hidden=true;preview.append(badge,title,effect,verification,consent,submit,destination);const result=el('p',undefined,'code-redemption-result');result.setAttribute('role','status');result.setAttribute('aria-live','polite');form.append(entry,preview,result);
|
||||
const guide=el('aside',undefined,'code-redemption-card code-redemption-guide');guide.append(el('small','WHAT CAN YOU PRESENT?'),el('h5','Your code chooses the route.'));
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ function table(target,head,rows){const wrap=el('div',undefined,'cp-v2-company-ta
|
|||
export function mountRewards(host,{fetcher=fetch,initialTab}={}){
|
||||
let active=true,busy=false,uncertain=false,orders=[];const controller=new AbortController(),{request}=createUserAPI(fetcher,controller.signal);
|
||||
const codes=el('section'),community=el('section'),tokens=el('section'),refresh=el('button','Refresh codes'),status=el('p','Opening your private rewards register…');status.setAttribute('role','status');refresh.type='button';codes.append(refresh);
|
||||
const directory=el('section',undefined,'reward-code-directory'),filter=el('input'),typeFilter=el('select'),listing=el('div'),groups=new Map();filter.type='search';filter.placeholder='Search codes, rewards or references';filter.setAttribute('aria-label','Search your codes');typeFilter.setAttribute('aria-label','Filter code type');for(const [value,label] of [['all','All code types'],['kit','Kits'],['token','Upgrade Tokens'],['clan','Clan founding'],['company','Company founding'],['community','Community rewards']]){const option=el('option',label);option.value=value;typeFilter.append(option);}const controls=el('div',undefined,'reward-code-controls');controls.append(filter,typeFilter);const banner=el('header',undefined,'reward-code-banner'),crest=el('img');crest.src='https://www.dunerealms.com/assets/imperial-seal-128.png';crest.alt='';const copy=el('div');copy.append(el('small','THE PRIVATE ENTITLEMENT REGISTER'),el('h4','Your codes. Your next chapter.'),el('p','Kits KIT-… · Upgrades UP-… · Clans CLAN-… · Companies COM-…'));banner.append(crest,copy);directory.append(banner,controls,listing);codes.append(status,directory);
|
||||
const directory=el('section',undefined,'reward-code-directory'),filter=el('input'),typeFilter=el('select'),listing=el('div'),groups=new Map();filter.type='search';filter.placeholder='Search codes, rewards or references';filter.setAttribute('aria-label','Search your codes');typeFilter.setAttribute('aria-label','Filter code type');for(const [value,label] of [['all','All code types'],['kit','Kits'],['token','Upgrade Tokens'],['clan','Clan founding'],['company','Company founding'],['community','Community rewards']]){const option=el('option',label);option.value=value;typeFilter.append(option);}const controls=el('div',undefined,'reward-code-controls');controls.append(filter,typeFilter);const banner=el('header',undefined,'reward-code-banner'),crest=el('img');crest.src='https://www.dunerealms.com/assets/imperial-seal-128.png';crest.alt='';const copy=el('div');copy.append(el('small','SPOST · PRIVATE ENTITLEMENT REGISTER'),el('h4','Your codes. Your next chapter.'),el('p','Kits KIT-… · Upgrades UP-… · Clans CLAN-… · Companies COM-…'));banner.append(crest,copy);directory.append(banner,controls,listing);codes.append(status,directory);
|
||||
function paintCodes(){const q=filter.value.trim().toLowerCase(),rows=[];for(const [kind,group] of groups){if(typeFilter.value!=='all'&&typeFilter.value!==kind)continue;for(const row of group.rows){if(q&&!([group.title,...row.map(v=>typeof v==='object'?v.textContent:v)].join(' ').toLowerCase().includes(q)))continue;rows.push([el('span',group.title,'reward-kind reward-kind-'+kind),...row]);}}table(listing,['Type','Reward / entitlement','Reference / amount','Status','Private code / action'],rows);}
|
||||
function setCodes(kind,title,rows){groups.set(kind,{title,rows:rows.length?rows:[[title+' register','—','No records','—']]});paintCodes();}
|
||||
for(const [kind,title] of [['clan','Clan founding'],['company','Company founding']]){const action=el('button','Use founding code — coming soon');action.type='button';action.disabled=true;setCodes(kind,title,[[title+' code · '+(kind==='clan'?'CLAN-…':'COM-…'),'Once per account','Not issued — preview',action]]);}for(const [kind,title] of [['kit','Kit'],['token','Upgrade Token'],['community','Community reward']])setCodes(kind,title,[[title+' register','—','Loading…','—']]);filter.oninput=typeFilter.onchange=paintCodes;const tailor=el('a','Apply Upgrade Tokens in Imperial Tailor →');tailor.href='#realm/kits-exchange';directory.append(tailor);directory.append(el('p','Founding codes are coming soon. New formats: KIT-…, UP-…, CLAN-… and COM-…. Existing DRK/DRU codes remain valid.','reward-code-note'));
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff