forked from unimatrix/web
2 lines
1.3 KiB
JavaScript
2 lines
1.3 KiB
JavaScript
const root=document.querySelector('#monthly-goals');
|
|
fetch('/api/community/campaigns',{cache:'no-store'}).then(async response=>{if(!response.ok)throw Error();return response.json();}).then(data=>{root.replaceChildren();if(!data.campaigns.length){root.textContent='No monthly campaign has opened yet. Funding targets and equal currency rewards will appear here before fundraising starts.';return;}for(const row of data.campaigns){const article=document.createElement('article');const title=document.createElement('h3');title.textContent=row.month+' community goal';const progress=document.createElement('p');progress.textContent=new Intl.NumberFormat(undefined,{style:'currency',currency:'EUR'}).format(row.received_cents/100)+' of '+new Intl.NumberFormat(undefined,{style:'currency',currency:'EUR'}).format(row.target_cents/100)+' verified · '+row.reward_amount+' Dunemarks per player';article.append(title,progress);if(row.public_code){const code=document.createElement('code');code.textContent='/communitycode '+row.public_code;article.append(code);}else{const state=document.createElement('p');state.textContent='Goal not reached. No reward code released.';article.append(state);}root.append(article);}}).catch(()=>{root.textContent='Community goals are temporarily unavailable. No payment is required to claim public rewards.';});
|

Staff