CLUB / CALENDAR

Mint Calendar

Every auction, raffle and NFT mint — tracked in one place.

Sign in to view your personal calendar

Sign in with Discord
×
·
Add to My Calendar
var _calItem = null; var _dpItems = []; var _isLoggedIn = false; var _isStaff = false; var _srcMeta = { mint: { label:'NFT MINT', color:'#e4c590', glow:'rgba(228,197,144,.4)' }, sub: { label:'NFT MINT', color:'#e4c590', glow:'rgba(228,197,144,.4)' }, auction: { label:'AUCTION', color:'#e4737d', glow:'rgba(228,115,125,.4)' }, raffle: { label:'RAFFLE', color:'#9c9cf0', glow:'rgba(156,156,240,.4)' }, manual: { label:'MY CALENDAR',color:'#fbbf24', glow:'rgba(251,191,36,.3)' }, wl: { label:'WL ENTRY', color:'#9c9cf0', glow:'rgba(156,156,240,.4)' }, }; function esc(s){ return String(s||'').replace(/&/g,'&').replace(//g,'>'); } // ── Cursor spotlight ────────────────────────────────────────────────────── (function() { var f = document.getElementById('calFrame'); var s = document.getElementById('calSpot'); if (!f || !s) return; f.addEventListener('mousemove', function(e) { var r = f.getBoundingClientRect(); s.style.left = (e.clientX - r.left) + 'px'; s.style.top = (e.clientY - r.top) + 'px'; s.style.opacity = '1'; }); f.addEventListener('mouseleave', function(){ s.style.opacity = '0'; }); })(); // ── Day click → updates the SCHEDULE rail in place ────────────────────── function showDayPopup(cell) { var raw = cell.getAttribute('data-dayitems'); var label = cell.getAttribute('data-daylabel') || ''; if (!raw) return; var items; try { items = JSON.parse(raw); } catch(e) { return; } _dpItems = items; var labelEl = document.getElementById('sched-panel-label'); var countEl = document.getElementById('sched-panel-count'); var body = document.getElementById('sched-panel-body'); if (labelEl) labelEl.textContent = label ? label.toUpperCase() : "TODAY'S SCHEDULE"; if (countEl) countEl.textContent = items.length; if (!body) return; if (!items.length) { body.innerHTML = '
Nothing scheduled this day
'; return; } body.innerHTML = items.map(function(it, i) { var m = _srcMeta[it.src] || _srcMeta.mint; return '
' + '
' + '
' + '
'+esc(it.name)+'
' + '
'+esc(it.chain||'')+'
' + '
' + '' + '
'; }).join(''); } function openItemFromDay(i) { showCalModal(_dpItems[i]); } // ── Modal from attr ─────────────────────────────────────────────────────── function showCalModalFromAttr(el) { var raw = el.getAttribute('data-caljson'); if (!raw) return; try { showCalModal(JSON.parse(raw)); } catch(e) { console.error(e); } } // ── Detail modal ────────────────────────────────────────────────────────── function showCalModal(d) { if (typeof d === 'string') { try { d = JSON.parse(d); } catch(e){ return; } } _calItem = d; var m = _srcMeta[d.src] || _srcMeta.mint; // Banner var bg = document.getElementById('cal-modal-banner-bg'); bg.style.background = d.image ? 'url('+JSON.stringify(d.image)+') center/cover' : 'linear-gradient(135deg,#13243a,#5aa9d8 55%,#1f3f6b)'; // Box glow var box = document.getElementById('cal-modal-box'); box.style.boxShadow = '0 40px 90px -30px rgba(0,0,0,.9), 0 0 60px -20px '+m.glow; // Source badge document.getElementById('cal-modal-src-dot').style.background = m.color; document.getElementById('cal-modal-src-label').style.color = m.color; document.getElementById('cal-modal-src-label').textContent = m.label; document.getElementById('cal-modal-src-badge').style.borderColor = m.color+'50'; // Title + meta document.getElementById('cal-modal-title').textContent = d.name || 'Untitled'; var chainSpan = document.getElementById('cal-modal-chain'); var chainColor = d.chain==='Solana'?'#b69cff':d.chain==='Bitcoin'?'#e4c590':'#6fe3ff'; chainSpan.innerHTML = ''+esc(d.chain||'TBA'); document.getElementById('cal-modal-date').textContent = d.date ? new Date(d.date+'T12:00:00').toLocaleDateString('en-US',{month:'short',day:'numeric',year:'numeric'}) : 'Date TBA'; var countEl = document.getElementById('cal-modal-count'); var countSep = document.getElementById('cal-modal-count-sep'); if (d.entry_count != null && (d.src==='auction'||d.src==='raffle')) { countEl.textContent = (d.src==='auction'?d.entry_count+' bids':d.entry_count+' entries'); countEl.style.color = m.color; countEl.style.display=''; countSep.style.display=''; } else { countEl.style.display='none'; countSep.style.display='none'; } // Info grid var dash = function(v){ return (v===undefined||v===null||v===''||v==='nan'||v==='NaN')?null:v; }; var supply = dash(d.supply); if (supply && supply.trim()!=='' && !isNaN(Number(String(supply).replace(/,/g,'').trim())) && String(supply).trim()!=='0') supply = Number(String(supply).replace(/,/g,'')).toLocaleString('en-US'); if (!supply || supply==='0' || supply.trim()==='' || supply==='TBA') supply = null; var infoRows = [ dash(d.chain) ? ['CHAIN', d.chain, '#eef1f8'] : null, (dash(d.price)&&d.price!=='TBA'&&d.price!=='0') ? ['MINT PRICE', d.price, '#eef1f8'] : null, supply ? ['SUPPLY', supply, '#eef1f8'] : null, ['TYPE', dash(d.reward)||(d.src==='mint'?'Public Mint':'GTD WL'), '#bfe9f5'], dash(d.twitter) ? ['PROJECT', '@'+String(d.twitter).replace(/^@/,''), '#bfe9f5'] : null, dash(d.mint_url) ? ['MINT PAGE', (function(u){u=u.replace(/^https?:\/\//,'').replace(/^www\./,'').replace(/\/$/,'');return u.length>24?u.slice(0,24)+'\u2026':u;})(d.mint_url), '#6fe3ff'] : null, ].filter(Boolean); document.getElementById('cal-info-grid').innerHTML = infoRows.map(function(r){ var val = r[2]==='#6fe3ff' && d.mint_url ? ''+esc(r[1])+'' : ''+esc(r[1])+''; return '
'+esc(r[0])+'
'+val+'
'; }).join(''); // Desc var descEl = document.getElementById('cal-modal-desc'); if (d.desc && d.desc.trim()) { descEl.textContent = d.desc.trim(); descEl.style.display='block'; } else descEl.style.display='none'; // Mint link button var mintLink = document.getElementById('cal-mint-link'); if (d.mint_url) { mintLink.href = d.mint_url; mintLink.style.display='flex'; } else mintLink.style.display='none'; // Add button var addBtn = document.getElementById('cal-add-btn'); if (!_isLoggedIn) { addBtn.querySelector('.bs-foil-btn-inner').textContent = 'Sign in to Add'; addBtn.onclick = function(){ window.location.href='/bs-auth/discord.php'; }; } else { addBtn.querySelector('.bs-foil-btn-inner').innerHTML = ' Add to My Calendar'; addBtn.style.background = ''; addBtn.style.cursor = ''; delete addBtn.dataset.added; addBtn.onclick = addToMyCalendar; } // Admin populateAdminEdit(d); populateSuggestDate(d); document.getElementById('cal-modal').classList.add('open'); } // ── Suggest a date (public) ───────────────────────────────────────────── var _suggestPending = null; function populateSuggestDate(d) { var wrap = document.getElementById('cal-suggest-wrap'); if (!wrap) return; // not rendered at all for staff / logged-out users var suggestable = { auction: 'bs_auctions', mint: 'bs_mints', sub: 'bs_mint_submissions', raffle: 'bs_raffles' }; var table = d && d.src ? suggestable[d.src] : null; if (!d || !d.id || !table || d.date) { wrap.style.display = 'none'; return; } wrap.style.display = 'block'; _suggestPending = { record_id: d.id, record_table: table, name: d.name || '' }; closeSuggestForm(); } function openSuggestForm() { document.getElementById('cal-suggest-cta').style.display = 'none'; document.getElementById('cal-suggest-form').style.display = 'block'; document.getElementById('cal-suggest-result').style.display = 'none'; document.getElementById('cal-suggest-hint').style.display = 'block'; } function closeSuggestForm() { document.getElementById('cal-suggest-cta').style.display = 'flex'; document.getElementById('cal-suggest-form').style.display = 'none'; document.getElementById('cal-suggest-result').style.display = 'none'; document.getElementById('cal-suggest-hint').style.display = 'block'; } async function submitSuggestForm() { var dateVal = document.getElementById('cal-suggest-date-input').value; var result = document.getElementById('cal-suggest-result'); if (!dateVal) { result.style.display='block'; result.style.color='#f87171'; result.textContent='Pick a date first.'; return; } if (!_suggestPending) return; document.getElementById('cal-suggest-form').style.display = 'none'; result.style.display='block'; result.style.color='#7a8398'; result.textContent='Submitting…'; try { var res = await fetch('/bs-api/suggest-date.php', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ record_id: _suggestPending.record_id, record_table: _suggestPending.record_table, name: _suggestPending.name, suggested_date: dateVal, }), }); var data = await res.json(); if (data.success) { result.style.color = '#4ade80'; result.innerHTML = '' + esc(data.message || 'Submitted!'); document.getElementById('cal-suggest-hint').style.display = 'none'; } else { result.style.color = '#f87171'; result.textContent = data.message || 'Failed — try again.'; document.getElementById('cal-suggest-form').style.display = 'block'; } } catch (e) { result.style.color = '#f87171'; result.textContent = 'Something went wrong.'; document.getElementById('cal-suggest-form').style.display = 'block'; } } function closeCalModal() { document.getElementById('cal-modal').classList.remove('open'); _calItem=null; } document.getElementById('cal-modal').addEventListener('click', function(e){ if(e.target===this) closeCalModal(); }); // ── Admin populate ──────────────────────────────────────────────────────── function populateAdminEdit(d) { var wrap = document.getElementById('cal-admin-wrap'); if (!wrap) return; if (!d || !d.id) { wrap.style.display='none'; return; } var mintForm = document.getElementById('cal-edit-mint-form'); var linkDiv = document.getElementById('cal-edit-link'); var gotoLink = document.getElementById('cal-edit-goto'); wrap.style.display = 'block'; if (d.src==='mint'||d.src==='sub') { mintForm.style.display='block'; linkDiv.style.display='none'; document.getElementById('edit-mint-id').value = d.id||''; document.getElementById('edit-name').value = d.name||''; document.getElementById('edit-twitter').value = (d.twitter||'').replace(/^@/,''); document.getElementById('edit-chain').value = d.chain||'Ethereum'; document.getElementById('edit-mint-url').value = d.mint_url||''; document.getElementById('edit-price').value = d.price||''; document.getElementById('edit-supply').value = d.supply||''; document.getElementById('edit-mint-date').value = d.date||''; document.getElementById('edit-msg').style.display='none'; } else if (d.src==='auction') { mintForm.style.display='none'; linkDiv.style.display='block'; gotoLink.href='/bs-admin/tba-manager.php'+(d.date?'?view=set':'?view=tba'); gotoLink.querySelector('.bs-foil-btn-inner').textContent='📅 Manage Mint Dates ↗'; } else if (d.src==='raffle') { mintForm.style.display='none'; linkDiv.style.display='block'; gotoLink.href='/bs-admin/tba-manager.php'+(d.date?'?view=set':'?view=tba'); gotoLink.querySelector('.bs-foil-btn-inner').textContent='📅 Manage Mint Dates ↗'; } else { wrap.style.display='none'; } } async function submitCalEdit(e) { e.preventDefault(); var data = Object.fromEntries(new FormData(document.getElementById('cal-edit-form'))); var msg = document.getElementById('edit-msg'); try { var res = await fetch('/bs-api/update_mint.php',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(data)}); var j = await res.json(); msg.style.display='block'; msg.style.color = j.success?'#e4c590':'#f87171'; msg.textContent = j.success?'✓ Saved!':('Error: '+(j.message||'Failed')); if (j.success) setTimeout(()=>location.reload(), 800); } catch(err) { msg.style.display='block'; msg.style.color='#f87171'; msg.textContent='Network error'; } } // ── Add to my calendar ──────────────────────────────────────────────────── async function addToMyCalendar() { if (!_calItem || !_isLoggedIn) return; var btn = document.getElementById('cal-add-btn'); if (btn.dataset.added === '1') return; // already added, do nothing btn.querySelector('.bs-foil-btn-inner').innerHTML = ' Adding…'; btn.style.pointerEvents = 'none'; try { var fd = new FormData(); fd.append('action','add_from_full'); fd.append('name', _calItem.name || _calItem.title || ''); fd.append('chain', _calItem.chain || 'Ethereum'); fd.append('mint_date', _calItem.date || ''); fd.append('image_url', _calItem.image || _calItem.image_url || ''); fd.append('mint_url', _calItem.mint_url || ''); fd.append('price', _calItem.price || ''); fd.append('supply', _calItem.supply || ''); var res = await fetch('?tab=mine', {method:'POST',body:fd}); var text = await res.text(); var data; try { data = JSON.parse(text); } catch(e) { throw new Error('Server error: ' + text.slice(0,100)); } if (data.ok) { btn.dataset.added = '1'; btn.querySelector('.bs-foil-btn-inner').innerHTML = ' Added to My Calendar'; btn.style.background = 'rgba(74,222,128,.12)'; btn.style.cursor = 'default'; } else { throw new Error(data.message||'Failed'); } } catch(e) { btn.querySelector('.bs-foil-btn-inner').textContent = '✗ ' + (e.message||'Failed'); btn.style.pointerEvents = ''; setTimeout(function(){ btn.querySelector('.bs-foil-btn-inner').innerHTML = ' Add to My Calendar'; btn.style.background=''; btn.style.pointerEvents=''; }, 2000); } } // ── Twitter banner auto-fetch ───────────────────────────────────────────── var _bbt = {}; function doBanner(twId, imgId, prevId) { clearTimeout(_bbt[twId]); var h = document.getElementById(twId).value.trim().replace('@',''); if (!h || h.length < 2) { document.getElementById(prevId).style.display='none'; document.getElementById(imgId).value=''; return; } _bbt[twId] = setTimeout(function(){ fetch('/auction-form.php?fetch_banner=1&handle='+encodeURIComponent(h)) .then(function(r){return r.json();}) .then(function(d){ if(d.banner){ document.getElementById(imgId).value=d.banner; var p=document.getElementById(prevId); p.src=d.banner; p.onload=function(){p.style.display='block';}; p.onerror=function(){p.style.display='none';}; } }).catch(function(){ document.getElementById(imgId).value='https://unavatar.io/twitter/'+h; }); }, 800); } document.querySelectorAll('form').forEach(function(f){ f.addEventListener('submit',function(){ [['sub_tw','sub_img'],['mine_tw','mine_img']].forEach(function(p){ var tw=document.getElementById(p[0]),img=document.getElementById(p[1]); if(tw&&img&&tw.value.trim()&&!img.value) img.value='https://unavatar.io/twitter/'+tw.value.trim().replace('@',''); }); }); });