What Do You Want?

I Want My Own _________.

SOMETHING WENT WRONG. TRY AGAIN.
const SUPABASE_URL = 'https://dvgrawagdqbucdezdmsa.supabase.co/rest/v1/'; const SUPABASE_KEY = 'sb_publishable_485DEPFQhcbPuRSSczN9TQ_1HGDCpYn'; const iwmoForm = document.getElementById("iwmo-form"); const iwmoSubmit = document.getElementById("iwmo-submit"); const iwmoSuccess = document.getElementById("iwmo-success"); const iwmoError = document.getElementById("iwmo-error"); iwmoForm.addEventListener("submit", async function(event) { event.preventDefault(); iwmoError.style.display = "none"; iwmoSubmit.disabled = true; iwmoSubmit.textContent = "..."; const formData = new FormData(iwmoForm); const answer = formData.get("answer"); try { const supabaseResponse = await fetch( SUPABASE_URL + 'Submissions', { method: 'POST', headers: { 'apikey': SUPABASE_KEY, 'Authorization': 'Bearer ' + SUPABASE_KEY, 'Content-Type': 'application/json' }, body: JSON.stringify({ answer: answer, approved: false }) } ); if (!supabaseResponse.ok) { throw new Error("Supabase submission failed"); } iwmoForm.reset(); iwmoForm.style.display = "none"; iwmoSuccess.style.display = "flex"; } catch (error) { console.error(error); iwmoSubmit.disabled = false; iwmoSubmit.textContent = "SUBMIT"; iwmoError.style.display = "block"; } });

Maybe We're Here To Decide What We Want

What The People Want:

Loading what the people want...
(async function () { const API_URL = 'https://dvgrawagdqbucdezdmsa.supabase.co/rest/v1/Submissions?select=answer&approved=eq.true&order=created_at.desc'; const API_KEY = 'sb_publishable_485DEPFQhcbPuRSSczN9TQ_1HGDCpYn'; const container = document.getElementById('iwmo-wants'); try { const response = await fetch(API_URL, { headers: { 'apikey': API_KEY, 'Authorization': 'Bearer ' + API_KEY } }); if (!response.ok) { throw new Error('Could not load submissions'); } const submissions = await response.json(); container.innerHTML = ''; if (submissions.length === 0) { container.innerHTML = '
Nothing here yet.
'; return; } submissions.forEach(item => { const entry = document.createElement('div'); entry.className = 'iwmo-want'; let answer = item.answer.trim(); /* Remove "I want my own" if they already typed it */ answer = answer.replace(/^i\s+want\s+my\s+own\s*/i, ''); const prefix = document.createElement('div'); prefix.className = 'iwmo-prefix'; prefix.textContent = 'I Want My Own'; const answerText = document.createElement('div'); answerText.className = 'iwmo-answer'; answerText.textContent = answer; entry.appendChild(prefix); entry.appendChild(answerText); container.appendChild(entry); }); } catch (error) { console.error(error); container.innerHTML = ''; } })();
IWMO ADMIN
Sign in to continue
(async function () { const SUPABASE_URL = 'https://dvgrawagdqbucdezdmsa.supabase.co'; const API_KEY = 'sb_publishable_485DEPFQhcbPuRSSczN9TQ_1HGDCpYn'; let accessToken = null; const loginArea = document.getElementById('iwmo-login'); const dashboard = document.getElementById('iwmo-dashboard'); const loginButton = document.getElementById('iwmo-login-button'); const loginMessage = document.getElementById('iwmo-login-message'); const list = document.getElementById('iwmo-admin-list'); /* ---------------- LOGIN ---------------- */ loginButton.addEventListener('click', login); document .getElementById('iwmo-password') .addEventListener('keydown', function(event) { if (event.key === 'Enter') { login(); } }); async function login() { const email = document.getElementById('iwmo-email').value.trim(); const password = document.getElementById('iwmo-password').value; if (!email || !password) { loginMessage.textContent = 'Enter your email and password.'; return; } loginButton.disabled = true; loginMessage.textContent = 'Signing in...'; try { const response = await fetch( SUPABASE_URL + '/auth/v1/token?grant_type=password', { method: 'POST', headers: { 'apikey': API_KEY, 'Content-Type': 'application/json' }, body: JSON.stringify({ email: email, password: password }) } ); const data = await response.json(); if (!response.ok || !data.access_token) { throw new Error( data.error_description || data.msg || 'Login failed' ); } accessToken = data.access_token; sessionStorage.setItem( 'iwmo_admin_token', accessToken ); loginArea.style.display = 'none'; dashboard.style.display = 'block'; await loadSubmissions(); } catch (error) { console.error(error); loginMessage.textContent = 'Could not sign in. Check your email and password.'; } finally { loginButton.disabled = false; } } /* ---------------- LOAD ---------------- */ async function loadSubmissions() { list.innerHTML = '
Loading submissions...
'; try { const response = await fetch( SUPABASE_URL + '/rest/v1/Submissions' + '?select=id,answer,created_at' + '&approved=eq.false' + '&reviewed=eq.false' + '&order=created_at.desc', { headers: { 'apikey': API_KEY, 'Authorization': 'Bearer ' + accessToken } } ); if (!response.ok) { throw new Error('Could not load submissions'); } const submissions = await response.json(); list.innerHTML = ''; if (submissions.length === 0) { list.innerHTML = '
All caught up.
'; return; } submissions.forEach(function(item) { const card = document.createElement('div'); card.className = 'iwmo-admin-card'; const answer = document.createElement('div'); answer.className = 'iwmo-admin-answer'; answer.textContent = item.answer; const date = document.createElement('div'); date.className = 'iwmo-admin-date'; date.textContent = new Date(item.created_at).toLocaleString(); const actions = document.createElement('div'); actions.className = 'iwmo-admin-actions'; const approve = document.createElement('button'); approve.className = 'iwmo-approve'; approve.textContent = 'APPROVE'; const deny = document.createElement('button'); deny.className = 'iwmo-deny'; deny.textContent = 'DENY'; approve.addEventListener( 'click', function() { reviewSubmission( item.id, true, card, approve, deny ); } ); deny.addEventListener( 'click', function() { reviewSubmission( item.id, false, card, approve, deny ); } ); actions.appendChild(approve); actions.appendChild(deny); card.appendChild(answer); card.appendChild(date); card.appendChild(actions); list.appendChild(card); }); } catch (error) { console.error(error); list.innerHTML = '
Could not load submissions.
'; } } /* ---------------- APPROVE / DENY ---------------- */ async function reviewSubmission( id, approved, card, approveButton, denyButton ) { approveButton.disabled = true; denyButton.disabled = true; try { const response = await fetch( SUPABASE_URL + '/rest/v1/Submissions?id=eq.' + encodeURIComponent(id), { method: 'PATCH', headers: { 'apikey': API_KEY, 'Authorization': 'Bearer ' + accessToken, 'Content-Type': 'application/json', 'Prefer': 'return=minimal' }, body: JSON.stringify({ approved: approved, reviewed: true }) } ); if (!response.ok) { throw new Error( 'Could not update submission' ); } card.remove(); if ( list.querySelectorAll( '.iwmo-admin-card' ).length === 0 ) { list.innerHTML = '
All caught up.
'; } } catch (error) { console.error(error); approveButton.disabled = false; denyButton.disabled = false; alert( 'Something went wrong. Try again.' ); } } /* ---------------- LOG OUT ---------------- */ document .getElementById('iwmo-logout') .addEventListener('click', function() { accessToken = null; sessionStorage.removeItem( 'iwmo_admin_token' ); dashboard.style.display = 'none'; loginArea.style.display = 'block'; document.getElementById( 'iwmo-password' ).value = ''; loginMessage.textContent = ''; }); /* ---------------- EXISTING SESSION ---------------- */ const savedToken = sessionStorage.getItem( 'iwmo_admin_token' ); if (savedToken) { accessToken = savedToken; loginArea.style.display = 'none'; dashboard.style.display = 'block'; await loadSubmissions(); } })();