Spaces:
Runtime error
Runtime error
Update premium.html
Browse files- premium.html +28 -11
premium.html
CHANGED
|
@@ -29,7 +29,8 @@
|
|
| 29 |
.hero p { font-size: 16px; opacity: 0.8; }
|
| 30 |
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin-bottom: 30px; }
|
| 31 |
.card {
|
| 32 |
-
background:
|
|
|
|
| 33 |
padding: 24px; transition: all 0.25s;
|
| 34 |
}
|
| 35 |
.card:hover { border-color: var(--gold); transform: translateY(-3px); }
|
|
@@ -37,7 +38,8 @@
|
|
| 37 |
.card h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
|
| 38 |
.card p { font-size: 14px; color: var(--text-dim); line-height: 1.6; }
|
| 39 |
.status {
|
| 40 |
-
background:
|
|
|
|
| 41 |
padding: 24px; margin-bottom: 30px; display: flex; align-items: center; gap: 16px;
|
| 42 |
}
|
| 43 |
.status .badge {
|
|
@@ -45,7 +47,10 @@
|
|
| 45 |
}
|
| 46 |
.badge.active { background: rgba(255,215,0,0.2); color: var(--gold); border: 1px solid var(--gold); }
|
| 47 |
.badge.inactive { background: rgba(255,255,255,0.05); color: var(--text-dim); border: 1px solid var(--border); }
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
| 49 |
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--border); }
|
| 50 |
th { color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
|
| 51 |
@media (max-width: 700px) { .features { grid-template-columns: 1fr; } }
|
|
@@ -65,23 +70,23 @@
|
|
| 65 |
<div class="badge inactive" id="premium-badge">Checking...</div>
|
| 66 |
<span id="premium-text">Loading your premium status...</span>
|
| 67 |
</div>
|
| 68 |
-
<div class="features">
|
| 69 |
-
<div class="card">
|
| 70 |
<div class="icon">📊</div>
|
| 71 |
<h3>Advanced Stats & Analytics</h3>
|
| 72 |
<p>Track goals, assists, clean sheets, and weekly leaderboards for every player.</p>
|
| 73 |
</div>
|
| 74 |
-
<div class="card">
|
| 75 |
<div class="icon">📅</div>
|
| 76 |
<h3>Match Scheduling & Reminders</h3>
|
| 77 |
<p>Auto-post scheduled matches with DM reminders 60 minutes before kickoff.</p>
|
| 78 |
</div>
|
| 79 |
-
<div class="card">
|
| 80 |
<div class="icon">🎴</div>
|
| 81 |
<h3>Player Profile Cards</h3>
|
| 82 |
<p>Advanced <code>profileimage</code> with extra stats and custom backgrounds.</p>
|
| 83 |
</div>
|
| 84 |
-
<div class="card">
|
| 85 |
<div class="icon">🔧</div>
|
| 86 |
<h3>Custom Command Aliases</h3>
|
| 87 |
<p>Rename bot commands to fit your server (e.g. <code>!ff</code> for <code>!friendly</code>).</p>
|
|
@@ -90,16 +95,23 @@
|
|
| 90 |
<div class="card" style="padding:24px">
|
| 91 |
<h3>🏆 Premium Users</h3>
|
| 92 |
<table>
|
| 93 |
-
<thead><tr><th>User
|
| 94 |
<tbody id="premium-list"><tr><td colspan="3">Loading...</td></tr></tbody>
|
| 95 |
</table>
|
| 96 |
</div>
|
| 97 |
</div>
|
| 98 |
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
async function load() {
|
| 100 |
const statusEl = document.getElementById('premium-badge');
|
| 101 |
const textEl = document.getElementById('premium-text');
|
| 102 |
const listEl = document.getElementById('premium-list');
|
|
|
|
| 103 |
try {
|
| 104 |
const r = await fetch('/api/premium');
|
| 105 |
const data = await r.json();
|
|
@@ -107,22 +119,27 @@
|
|
| 107 |
statusEl.className = 'badge active';
|
| 108 |
statusEl.textContent = '⭐ ACTIVE';
|
| 109 |
textEl.textContent = 'You have Premium access! Enjoy all features.';
|
|
|
|
| 110 |
} else {
|
| 111 |
statusEl.className = 'badge inactive';
|
| 112 |
statusEl.textContent = '— LOCKED';
|
| 113 |
textEl.textContent = 'Win a league match with !win to unlock Premium.';
|
|
|
|
| 114 |
}
|
| 115 |
if (data.list && data.list.length > 0) {
|
| 116 |
listEl.innerHTML = data.list.map(u => {
|
| 117 |
const date = new Date(u.grantedAt).toLocaleDateString();
|
| 118 |
-
|
|
|
|
|
|
|
| 119 |
}).join('');
|
| 120 |
} else {
|
| 121 |
-
listEl.innerHTML = '<tr><td colspan="3">No premium users yet.</td></tr>';
|
| 122 |
}
|
| 123 |
} catch (e) {
|
| 124 |
statusEl.textContent = '❌ ERROR';
|
| 125 |
textEl.textContent = 'Could not load premium data.';
|
|
|
|
| 126 |
}
|
| 127 |
}
|
| 128 |
load();
|
|
|
|
| 29 |
.hero p { font-size: 16px; opacity: 0.8; }
|
| 30 |
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin-bottom: 30px; }
|
| 31 |
.card {
|
| 32 |
+
background: rgba(18,18,42,0.85); backdrop-filter: blur(8px);
|
| 33 |
+
border: 1px solid var(--border); border-radius: var(--radius);
|
| 34 |
padding: 24px; transition: all 0.25s;
|
| 35 |
}
|
| 36 |
.card:hover { border-color: var(--gold); transform: translateY(-3px); }
|
|
|
|
| 38 |
.card h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
|
| 39 |
.card p { font-size: 14px; color: var(--text-dim); line-height: 1.6; }
|
| 40 |
.status {
|
| 41 |
+
background: rgba(18,18,42,0.85); backdrop-filter: blur(8px);
|
| 42 |
+
border: 1px solid var(--border); border-radius: var(--radius);
|
| 43 |
padding: 24px; margin-bottom: 30px; display: flex; align-items: center; gap: 16px;
|
| 44 |
}
|
| 45 |
.status .badge {
|
|
|
|
| 47 |
}
|
| 48 |
.badge.active { background: rgba(255,215,0,0.2); color: var(--gold); border: 1px solid var(--gold); }
|
| 49 |
.badge.inactive { background: rgba(255,255,255,0.05); color: var(--text-dim); border: 1px solid var(--border); }
|
| 50 |
+
.user-row { display: flex; align-items: center; gap: 12px; }
|
| 51 |
+
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: white; }
|
| 52 |
+
.user-avatar img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
|
| 53 |
+
table { width: 100%; border-collapse: collapse; margin-top: 12px; }
|
| 54 |
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--border); }
|
| 55 |
th { color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
|
| 56 |
@media (max-width: 700px) { .features { grid-template-columns: 1fr; } }
|
|
|
|
| 70 |
<div class="badge inactive" id="premium-badge">Checking...</div>
|
| 71 |
<span id="premium-text">Loading your premium status...</span>
|
| 72 |
</div>
|
| 73 |
+
<div class="features" id="features">
|
| 74 |
+
<div class="card locked" data-feature="0">
|
| 75 |
<div class="icon">📊</div>
|
| 76 |
<h3>Advanced Stats & Analytics</h3>
|
| 77 |
<p>Track goals, assists, clean sheets, and weekly leaderboards for every player.</p>
|
| 78 |
</div>
|
| 79 |
+
<div class="card locked" data-feature="1">
|
| 80 |
<div class="icon">📅</div>
|
| 81 |
<h3>Match Scheduling & Reminders</h3>
|
| 82 |
<p>Auto-post scheduled matches with DM reminders 60 minutes before kickoff.</p>
|
| 83 |
</div>
|
| 84 |
+
<div class="card locked" data-feature="2">
|
| 85 |
<div class="icon">🎴</div>
|
| 86 |
<h3>Player Profile Cards</h3>
|
| 87 |
<p>Advanced <code>profileimage</code> with extra stats and custom backgrounds.</p>
|
| 88 |
</div>
|
| 89 |
+
<div class="card locked" data-feature="3">
|
| 90 |
<div class="icon">🔧</div>
|
| 91 |
<h3>Custom Command Aliases</h3>
|
| 92 |
<p>Rename bot commands to fit your server (e.g. <code>!ff</code> for <code>!friendly</code>).</p>
|
|
|
|
| 95 |
<div class="card" style="padding:24px">
|
| 96 |
<h3>🏆 Premium Users</h3>
|
| 97 |
<table>
|
| 98 |
+
<thead><tr><th>User</th><th>Since</th><th>Reason</th></tr></thead>
|
| 99 |
<tbody id="premium-list"><tr><td colspan="3">Loading...</td></tr></tbody>
|
| 100 |
</table>
|
| 101 |
</div>
|
| 102 |
</div>
|
| 103 |
<script>
|
| 104 |
+
async function fetchUser(userId) {
|
| 105 |
+
try {
|
| 106 |
+
const r = await fetch(`https://cdn.discordapp.com/embed/avatars/0.png`); // placeholder — we use ID
|
| 107 |
+
return null; // We use a fallback below
|
| 108 |
+
} catch(e) { return null; }
|
| 109 |
+
}
|
| 110 |
async function load() {
|
| 111 |
const statusEl = document.getElementById('premium-badge');
|
| 112 |
const textEl = document.getElementById('premium-text');
|
| 113 |
const listEl = document.getElementById('premium-list');
|
| 114 |
+
const cards = document.querySelectorAll('#features .card');
|
| 115 |
try {
|
| 116 |
const r = await fetch('/api/premium');
|
| 117 |
const data = await r.json();
|
|
|
|
| 119 |
statusEl.className = 'badge active';
|
| 120 |
statusEl.textContent = '⭐ ACTIVE';
|
| 121 |
textEl.textContent = 'You have Premium access! Enjoy all features.';
|
| 122 |
+
cards.forEach(c => { c.style.borderColor = 'var(--gold)'; c.style.opacity = '1'; c.classList.remove('locked'); });
|
| 123 |
} else {
|
| 124 |
statusEl.className = 'badge inactive';
|
| 125 |
statusEl.textContent = '— LOCKED';
|
| 126 |
textEl.textContent = 'Win a league match with !win to unlock Premium.';
|
| 127 |
+
cards.forEach(c => { c.style.borderColor = 'var(--border)'; c.style.opacity = '0.55'; c.classList.add('locked'); });
|
| 128 |
}
|
| 129 |
if (data.list && data.list.length > 0) {
|
| 130 |
listEl.innerHTML = data.list.map(u => {
|
| 131 |
const date = new Date(u.grantedAt).toLocaleDateString();
|
| 132 |
+
const avatarUrl = u.avatarUrl || `https://cdn.discordapp.com/embed/avatars/0.png`;
|
| 133 |
+
const displayName = u.userTag || u.userId;
|
| 134 |
+
return `<tr><td><div class="user-row"><div class="user-avatar"><img src="${avatarUrl}" onerror="this.parentElement.textContent='${(displayName||'?')[0].toUpperCase()}'" alt=""></div><span style="font-size:13px;font-weight:500">${displayName}</span></div></td><td style="font-size:13px">${date}</td><td style="font-size:13px;color:var(--text-dim)">${u.reason || 'manual'}</td></tr>`;
|
| 135 |
}).join('');
|
| 136 |
} else {
|
| 137 |
+
listEl.innerHTML = '<tr><td colspan="3" style="text-align:center;color:var(--text-dim);padding:24px">No premium users yet. Win a league match to be the first!</td></tr>';
|
| 138 |
}
|
| 139 |
} catch (e) {
|
| 140 |
statusEl.textContent = '❌ ERROR';
|
| 141 |
textEl.textContent = 'Could not load premium data.';
|
| 142 |
+
listEl.innerHTML = '<tr><td colspan="3" style="text-align:center;color:var(--red)">Failed to load.</td></tr>';
|
| 143 |
}
|
| 144 |
}
|
| 145 |
load();
|