Spaces:
Runtime error
Runtime error
File size: 7,969 Bytes
5450e32 f1475a6 5450e32 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>FriendlyBot — Profile Cards</title>
<link rel="icon" href="/logo.png" />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet" />
<style>
:root {
--bg: #0a0a1a; --surface: #12122a; --surface2: #1a1a3a; --border: rgba(255,255,255,0.08);
--text: #fff; --text-dim: rgba(255,255,255,0.6); --gold: #FFD700;
--accent: #5865F2; --radius: 16px; --red: #ED4245;
}
* { box-sizing: border-box; margin:0; padding:0; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; padding: 40px 20px; }
header { max-width: 800px; margin: 0 auto 40px; display: flex; justify-content: space-between; align-items: center; }
h1 { font-size: 28px; font-weight: 700; }
.btn {
display: inline-block; padding: 10px 20px; background: var(--accent);
color: #fff; text-decoration: none; border-radius: 8px; font-weight: 600; font-size: 14px; border: none; cursor: pointer;
}
.btn-secondary { background: var(--surface2); border: 1px solid var(--border); }
.container { max-width: 800px; margin: 0 auto; }
.card {
background: rgba(18,18,42,0.85); backdrop-filter: blur(8px);
border: 1px solid var(--border); border-radius: var(--radius);
padding: 32px; margin-bottom: 30px;
}
.card h2 { font-size: 20px; margin-bottom: 12px; }
.card p { color: var(--text-dim); font-size: 14px; margin-bottom: 24px; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-top: 16px; }
.theme-card {
background: var(--surface2); border: 2px solid transparent; border-radius: 12px; padding: 16px; cursor: pointer; transition: 0.2s;
}
.theme-card:hover { border-color: var(--accent); }
.theme-card.active { border-color: var(--gold); background: rgba(255,215,0,0.05); }
.theme-preview { height: 100px; background: #000; border-radius: 8px; margin-bottom: 12px; background-size: cover; background-position: center; }
#guild-selector { margin-bottom: 30px; }
.server-select { width: 100%; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: #fff; font-size: 16px; font-weight: 600; cursor: pointer; }
.save-bar { position: sticky; bottom: 20px; background: var(--surface); border: 1px solid var(--border); padding: 16px 24px; border-radius: 100px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 10px 30px rgba(0,0,0,0.5); z-index: 100; }
</style>
</head>
<body>
<header>
<div style="display:flex; align-items:center; gap:16px">
<div style="font-size:32px">🎴</div>
<h1>Player Profiles</h1>
</div>
<div style="display:flex; gap:10px">
<a href="/premium" class="btn btn-secondary">Back to Premium</a>
<a href="/dashboard" class="btn btn-secondary">Dashboard</a>
</div>
</header>
<div class="container">
<div id="guild-selector">
<label style="display:block; font-size:13px; color:var(--text-dim); margin-bottom:10px">Select a Server to Configure</label>
<select id="server-list" class="server-select" onchange="loadConfig(this.value)">
<option value="">Loading your servers...</option>
</select>
</div>
<div class="card" id="config-card" style="display:none">
<h2>Profile Card Themes</h2>
<p>Choose the default theme for player profile cards generated in your server.</p>
<div class="theme-grid">
<div class="theme-card active" onclick="selectTheme('dark', this)">
<div class="theme-preview" style="background-image: linear-gradient(45deg, #0f0c29, #302b63, #24243e);"></div>
<div style="font-weight:700">Midnight (Default)</div>
</div>
<div class="theme-card" onclick="selectTheme('gold', this)">
<div class="theme-preview" style="background-image: linear-gradient(45deg, #bf953f, #fcf6ba, #b38728, #fbf5b7, #aa771c);"></div>
<div style="font-weight:700">Royal Gold</div>
</div>
<div class="theme-card" onclick="selectTheme('neon', this)">
<div class="theme-preview" style="background-image: linear-gradient(45deg, #ec008c, #fc6767);"></div>
<div style="font-weight:700">Neon Pulse</div>
</div>
</div>
<div style="margin-top:32px">
<label style="display:block; font-size:13px; color:var(--text-dim); margin-bottom:12px">Server Custom Background URL (Optional)</label>
<input type="text" id="config-profile-bg" placeholder="https://..." style="width:100%; padding:14px; background:var(--surface2); border:1px solid var(--border); border-radius:10px; color:white; outline:none" oninput="checkChanges()">
</div>
</div>
</div>
<div class="save-bar" id="save-bar" style="display:none; max-width:800px; margin: 0 auto;">
<span style="font-size:14px; font-weight:500">You have unsaved changes!</span>
<button class="btn" onclick="saveConfig()">Save Profile Settings</button>
</div>
<script>
let currentGuildId = null;
let selectedTheme = 'dark';
async function init() {
try {
const serversR = await fetch('/api/servers');
const serversData = await serversR.json();
const serverSelect = document.getElementById('server-list');
const servers = serversData.servers || [];
if (servers.length === 0) {
serverSelect.innerHTML = '<option value="">No manageable servers found</option>';
return;
}
serverSelect.innerHTML = '<option value="">-- Choose a Server --</option>' +
servers.map(s => `<option value="${s.id}">${s.name}</option>`).join('');
} catch (e) { console.error(e); }
}
async function loadConfig(guildId) {
if (!guildId) {
document.getElementById('config-card').style.display = 'none';
document.getElementById('save-bar').style.display = 'none';
return;
}
currentGuildId = guildId;
document.getElementById('config-card').style.display = 'block';
try {
const r = await fetch(`/api/config/${guildId}`);
const data = await r.json();
document.getElementById('config-profile-bg').value = data.profileBg || '';
selectedTheme = data.profileTheme || 'dark';
updateThemeUI();
document.getElementById('save-bar').style.display = 'none';
} catch (e) { alert('Failed to load configuration'); }
}
function selectTheme(theme, el) {
selectedTheme = theme;
updateThemeUI();
checkChanges();
}
function updateThemeUI() {
document.querySelectorAll('.theme-card').forEach(c => {
c.classList.remove('active');
if (c.textContent.toLowerCase().includes(selectedTheme)) c.classList.add('active');
});
}
function checkChanges() {
if (!currentGuildId) return;
document.getElementById('save-bar').style.display = 'flex';
}
async function saveConfig() {
const profileBg = document.getElementById('config-profile-bg').value;
const profileTheme = selectedTheme;
try {
const r = await fetch(`/api/config/${currentGuildId}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ profileBg, profileTheme })
});
const data = await r.json();
if (data.success) {
alert('✅ Profile settings saved!');
document.getElementById('save-bar').style.display = 'none';
} else {
alert('❌ Error: ' + data.error);
}
} catch (e) { alert('❌ Failed to save'); }
}
init();
</script>
</body>
</html>
|