BeatFridge / profile.html
Onttraders's picture
🐳 14/04 - 07:46 - Implement a Superfan subscription system.Features:- Monthly subscription- Benefits:   - Free downloads on all tracks   - Exclusive content (future-ready)   - Badge on profileUI:- “B
119fb69 verified
Raw History Blame Contribute Delete
26.5 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Profile - BeatFridge</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/lucide@latest"></script>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="responsive.css">
<style>
* { font-family: 'Inter', sans-serif; }
body { background-color: #0a0a0a; color: #ffffff; }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #0a0a0a; }
::-webkit-scrollbar-thumb { background: #2d2d2d; border-radius: 4px; }
.glass { background: rgba(20,20,20,0.6); backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,0.08); }
.glass-panel { background: rgba(30,30,30,0.4); backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,0.05); }
.neon-text { background: linear-gradient(135deg, #00d4ff 0%, #7c3aed 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.track-card { transition: all 0.3s cubic-bezier(0.4,0,0.2,1); }
.track-card:hover { transform: translateY(-4px); box-shadow: 0 20px 40px -10px rgba(0,212,255,0.15); }
.play-btn-overlay { opacity: 0; transition: all 0.3s ease; }
.track-card:hover .play-btn-overlay { opacity: 1; }
.glow-cyan { box-shadow: 0 0 20px rgba(0,212,255,0.3); }
.glow-orange { box-shadow: 0 0 20px rgba(249,115,22,0.3); }
.sticky-player { position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; }
.avatar-ring { box-shadow: 0 0 0 4px #0a0a0a, 0 0 0 6px rgba(0,212,255,0.5); }
.banner-gradient { background: linear-gradient(135deg, rgba(0,212,255,0.8), rgba(124,58,237,0.8), rgba(249,115,22,0.6)); mix-blend-mode: multiply; }
</style>
</head>
<body class="bg-black text-white overflow-x-hidden">
<!-- Top Navigation -->
<nav class="fixed top-0 left-0 right-0 z-40 glass border-b border-white/5">
<div class="max-w-[1600px] mx-auto px-4 sm:px-6 h-14 flex items-center justify-between">
<div class="flex items-center gap-6">
<a href="index.html" class="flex items-center gap-2">
<div class="w-8 h-8 rounded-lg flex items-center justify-center bg-white/10 border border-white/20">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="w-5 h-5 text-white"><rect x="4" y="2" width="16" height="20" rx="2"/><line x1="4" y1="9" x2="20" y2="9"/><line x1="15" y1="5" x2="15" y2="7"/><line x1="15" y1="12" x2="15" y2="18"/></svg>
</div>
<span class="text-lg font-bold tracking-tight hidden sm:inline">BeatFridge</span>
</a>
<div class="hidden md:flex items-center gap-5 text-sm font-medium text-gray-400">
<a href="index.html" class="hover:text-cyan-400 transition">Home</a>
<a href="search.html" class="hover:text-cyan-400 transition">Search</a>
<a href="upload.html" class="hover:text-cyan-400 transition flex items-center gap-1"><i data-lucide="upload-cloud" class="w-4 h-4"></i>Upload</a>
<a href="profile.html" class="text-cyan-400">Profile</a>
</div>
</div>
<div class="flex items-center gap-3">
<a href="library.html" class="w-9 h-9 rounded-full bg-white/5 border border-white/10 flex items-center justify-center hover:bg-white/10 transition">
<i data-lucide="library" class="w-4 h-4 text-gray-300"></i>
</a>
<a href="analytics.html" class="w-9 h-9 rounded-full bg-white/5 border border-white/10 flex items-center justify-center hover:bg-white/10 transition">
<i data-lucide="bar-chart-2" class="w-4 h-4 text-gray-300"></i>
</a>
</div>
</div>
</nav>
<!-- Main Content -->
<main class="max-w-[1600px] mx-auto pt-14 pb-32 md:pb-24">
<!-- Not Logged In State -->
<div id="notLoggedIn" class="hidden">
<div class="flex flex-col items-center justify-center min-h-[60vh] px-4 text-center">
<div class="w-20 h-20 rounded-full bg-white/5 flex items-center justify-center mb-6">
<i data-lucide="user-x" class="w-10 h-10 text-gray-500"></i>
</div>
<h2 class="text-2xl font-bold text-white mb-3">Sign in to view your profile</h2>
<p class="text-gray-400 mb-6 max-w-sm">Your uploaded tracks, stats, and profile info will appear here once you're signed in.</p>
<button onclick="BF.showSignInModal()" class="px-8 py-3 bg-cyan-500 hover:bg-cyan-400 text-black font-semibold rounded-full transition glow-cyan">Sign In</button>
<p class="text-sm text-gray-500 mt-4">No account? <a href="#" onclick="BF.showSignInModal(); return false;" class="text-cyan-400 hover:underline">Create an account</a></p>
</div>
</div>
<!-- Logged In State -->
<div id="loggedIn" class="hidden">
<!-- Banner -->
<div class="relative h-40 sm:h-56">
<img src="http://static.photos/technology/1200x630/88" alt="Banner" class="w-full h-full object-cover">
<div class="absolute inset-0 banner-gradient"></div>
<div class="absolute inset-0 bg-gradient-to-t from-[#0a0a0a] via-transparent to-transparent"></div>
</div>
<!-- Profile Info -->
<div class="relative px-4 sm:px-6 -mt-16 sm:-mt-20 mb-6">
<div class="flex flex-col sm:flex-row items-start sm:items-end gap-4">
<div class="w-24 h-24 sm:w-32 sm:h-32 rounded-full overflow-hidden avatar-ring bg-black flex-shrink-0">
<img id="profileAvatar" src="http://static.photos/people/200x200/42" alt="Avatar" class="w-full h-full object-cover">
</div>
<div class="flex-1 min-w-0">
<div class="flex items-center gap-2 flex-wrap">
<h1 class="text-2xl sm:text-3xl font-bold" id="profileName">Username</h1>
<span id="profileSfBadge" class="hidden px-2.5 py-0.5 rounded-full text-[11px] font-bold inline-flex items-center gap-1" style="background:linear-gradient(135deg,rgba(249,115,22,0.2),rgba(239,68,68,0.15));border:1px solid rgba(249,115,22,0.4);color:#f97316">
<i data-lucide="zap" class="w-3 h-3"></i>SUPERFAN
</span>
</div>
<p class="text-gray-400 text-sm" id="profileHandle">@username</p>
</div>
<div class="flex items-center gap-2">
<a href="upload.html" class="px-5 py-2 bg-cyan-500 hover:bg-cyan-400 text-black font-semibold rounded-full transition glow-cyan flex items-center gap-2 text-sm">
<i data-lucide="upload-cloud" class="w-4 h-4"></i>
Upload
</a>
<button onclick="BF.signOut()" class="px-4 py-2 bg-white/5 hover:bg-white/10 border border-white/10 rounded-full text-sm text-gray-400 transition flex items-center gap-2">
<i data-lucide="log-out" class="w-4 h-4"></i>
<span class="hidden sm:inline">Sign Out</span>
</button>
</div>
</div>
<!-- Stats -->
<div class="flex flex-wrap items-center gap-4 sm:gap-8 mt-5 pt-5 border-t border-white/10">
<div>
<p class="text-xl sm:text-2xl font-bold neon-text" id="statTracks">0</p>
<p class="text-xs text-gray-500 uppercase tracking-wider">Tracks</p>
</div>
<div>
<p class="text-xl sm:text-2xl font-bold text-white" id="statFollowers">0</p>
<p class="text-xs text-gray-500 uppercase tracking-wider">Followers</p>
</div>
<div>
<p class="text-xl sm:text-2xl font-bold text-white" id="statFollowing">0</p>
<p class="text-xs text-gray-500 uppercase tracking-wider">Following</p>
</div>
<div>
<p class="text-xl sm:text-2xl font-bold text-white" id="statPlays">0</p>
<p class="text-xs text-gray-500 uppercase tracking-wider">Plays</p>
</div>
</div>
</div>
<!-- Quick Actions -->
<div class="px-4 sm:px-6 mb-6">
<div class="flex flex-wrap gap-2">
<a href="library.html" class="px-4 py-2 rounded-full bg-white/5 border border-white/10 text-sm text-gray-300 hover:bg-white/10 transition flex items-center gap-2">
<i data-lucide="library" class="w-4 h-4"></i> Library
</a>
<a href="analytics.html" class="px-4 py-2 rounded-full bg-white/5 border border-white/10 text-sm text-gray-300 hover:bg-white/10 transition flex items-center gap-2">
<i data-lucide="bar-chart-2" class="w-4 h-4"></i> Analytics
</a>
<a href="artist.html" class="px-4 py-2 rounded-full bg-white/5 border border-white/10 text-sm text-gray-300 hover:bg-white/10 transition flex items-center gap-2">
<i data-lucide="external-link" class="w-4 h-4"></i> Public Profile
</a>
</div>
</div>
<!-- Uploaded Tracks -->
<div class="px-4 sm:px-6">
<div class="flex items-center justify-between mb-5">
<h2 class="text-lg font-bold flex items-center gap-2">
<i data-lucide="disc" class="w-5 h-5 text-cyan-400"></i>
Your Tracks
</h2>
</div>
<div id="userTracksContent">
<!-- Populated by JS -->
</div>
</div>
<!-- My Super Fan Subscriptions -->
<div class="px-4 sm:px-6 mt-8" id="superFanSection">
<div class="flex items-center justify-between mb-4">
<h2 class="text-lg font-bold flex items-center gap-2">
<i data-lucide="zap" class="w-5 h-5 text-orange-400"></i>
My Super Fan Subscriptions
</h2>
</div>
<div id="superFanList">
<!-- Populated by JS -->
</div>
</div>
</div>
</main>
<!-- Sticky Bottom Player -->
<div class="sticky-player glass border-t border-white/10 px-4 py-3">
<div class="max-w-[1600px] mx-auto flex items-center gap-4">
<div class="flex items-center gap-3 w-48 sm:w-64 flex-shrink-0">
<div class="w-12 h-12 sm:w-14 sm:h-14 rounded-lg overflow-hidden flex-shrink-0">
<img id="playerArt" src="http://static.photos/technology/200x200/5" class="w-full h-full object-cover">
</div>
<div class="min-w-0 flex-1">
<p id="playerTitle" class="text-sm font-medium text-white truncate">Midnight Synthesis</p>
<p id="playerArtist" class="text-xs text-gray-400 truncate">Aurora Void</p>
</div>
</div>
<div class="flex-1 flex items-center justify-center max-w-2xl mx-auto">
<button class="w-10 h-10 rounded-full bg-white text-black flex items-center justify-center hover:scale-105 transition" onclick="BF.togglePlay()">
<i data-lucide="play" class="w-5 h-5 fill-current ml-0.5" id="playIcon"></i>
</button>
</div>
<div class="hidden sm:flex items-center gap-3 w-48 sm:w-64 justify-end">
<div class="flex items-center gap-2"><i data-lucide="volume-2" class="w-5 h-5 text-gray-400"></i><div class="w-20 h-1 bg-white/10 rounded-full overflow-hidden"><div class="h-full bg-cyan-400 w-[70%] rounded-full"></div></div></div>
</div>
</div>
</div>
<script src="app.js"></script>
<script>
BF.init('profile');
const user = BF.getCurrentUser();
if (user) {
document.getElementById('notLoggedIn').classList.add('hidden');
document.getElementById('loggedIn').classList.remove('hidden');
// Fill profile info
document.getElementById('profileAvatar').src = user.avatar || 'http://static.photos/people/200x200/42';
document.getElementById('profileName').textContent = user.displayName || user.username;
document.getElementById('profileHandle').textContent = '@' + user.username;
// Show Super Fan badge if user has active subscriptions
const sfSubs = BF.getSuperFanSubscriptions();
const sfBadge = document.getElementById('profileSfBadge');
if (sfBadge && sfSubs.length > 0) {
sfBadge.classList.remove('hidden');
lucide.createIcons();
}
// Fan accounts — show simplified profile
if (user.role === 'fan') {
// Hide producer-specific elements
const uploadBtn = document.querySelector('a[href="upload.html"]');
if (uploadBtn) uploadBtn.style.display = 'none';
// Hide stats that don't apply to fans
document.getElementById('statTracks').parentElement.style.display = 'none';
document.getElementById('statPlays').parentElement.style.display = 'none';
// Hide quick actions for producers
const quickActions = document.querySelector('.flex.flex-wrap.gap-2');
if (quickActions) {
quickActions.innerHTML = `
<a href="library.html" class="px-4 py-2 rounded-full bg-white/5 border border-white/10 text-sm text-gray-300 hover:bg-white/10 transition flex items-center gap-2">
<i data-lucide="library" class="w-4 h-4"></i> Library
</a>
`;
}
// Show fan badge and upgrade CTA
const statFollowers = document.getElementById('statFollowers');
statFollowers.parentElement.querySelector('p:last-child').textContent = 'Following';
const following = JSON.parse(localStorage.getItem('following') || '[]');
statFollowers.textContent = following.length;
document.getElementById('statFollowing').textContent = '—';
// Replace tracks section with upgrade CTA
const container = document.getElementById('userTracksContent');
container.innerHTML = `
<div class="text-center py-16">
<div class="w-16 h-16 rounded-full bg-purple-500/10 flex items-center justify-center mx-auto mb-4">
<i data-lucide="headphones" class="w-8 h-8 text-purple-400"></i>
</div>
<h3 class="text-xl font-semibold text-gray-300 mb-2">Fan Account</h3>
<p class="text-gray-500 mb-4">You're here to listen! Upgrade to a Producer account to upload tracks and create an artist profile.</p>
<button onclick="upgradeToProducer()" class="px-6 py-3 bg-cyan-500 hover:bg-cyan-400 text-black font-semibold rounded-full transition glow-cyan inline-flex items-center gap-2">
<i data-lucide="music" class="w-5 h-5"></i>
Upgrade to Producer
</button>
</div>
`;
lucide.createIcons();
} else {
// Producer account — show full profile
// Stats
const following = JSON.parse(localStorage.getItem('following') || '[]');
document.getElementById('statFollowing').textContent = following.length;
document.getElementById('statFollowers').textContent = user.followers || '0';
// Get user's tracks
const allTracks = BF.getAllTracks();
const userTracks = allTracks.filter(t => t.artistId === user.id || t.artist === (user.displayName || user.username));
document.getElementById('statTracks').textContent = userTracks.length;
const totalPlays = userTracks.reduce((sum, t) => {
const p = parseFloat(t.plays);
return sum + (t.plays.includes('K') ? p * 1000 : p);
}, 0);
document.getElementById('statPlays').textContent = totalPlays > 1000 ? (totalPlays / 1000).toFixed(1) + 'K' : totalPlays;
// Render user tracks
const container = document.getElementById('userTracksContent');
if (userTracks.length === 0) {
container.innerHTML = `
<div class="text-center py-16">
<div class="w-16 h-16 rounded-full bg-white/5 flex items-center justify-center mx-auto mb-4">
<i data-lucide="music" class="w-8 h-8 text-gray-500"></i>
</div>
<h3 class="text-xl font-semibold text-gray-300 mb-2">No tracks yet</h3>
<p class="text-gray-500 mb-4">Upload your first track to get started</p>
<a href="upload.html" class="px-6 py-3 bg-cyan-500 hover:bg-cyan-400 text-black font-semibold rounded-full transition glow-cyan inline-flex items-center gap-2">
<i data-lucide="upload-cloud" class="w-5 h-5"></i>
Upload Track
</a>
</div>
`;
} else {
container.innerHTML = `
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
${userTracks.map(track => `
<div class="track-card glass-panel rounded-2xl p-4 group cursor-pointer" onclick="BF.playTrack(${JSON.stringify(track).replace(/"/g, '&quot;')})">
<div class="relative aspect-square rounded-xl overflow-hidden mb-3">
<img src="${track.image}" class="w-full h-full object-cover transition duration-500 group-hover:scale-110" loading="lazy">
<div class="play-btn-overlay absolute inset-0 bg-black/50 flex items-center justify-center backdrop-blur-[2px]">
<div class="w-12 h-12 rounded-full bg-cyan-500 text-black flex items-center justify-center glow-cyan"><i data-lucide="play" class="w-6 h-6 fill-current ml-1"></i></div>
</div>
</div>
<h3 class="font-semibold text-white truncate group-hover:text-cyan-400 transition">${track.title}</h3>
<p class="text-sm text-gray-400 truncate">${track.genre || 'Electronic'}</p>
<div class="mt-2 flex items-center gap-3 text-xs text-gray-500">
<span class="flex items-center gap-1"><i data-lucide="play-circle" class="w-3 h-3"></i>${track.plays}</span>
<span>${track.duration}</span>
</div>
</div>
`).join('')}
</div>
`;
}
}
// Render Super Fan Subscriptions
renderSuperFanList();
} else {
document.getElementById('notLoggedIn').classList.remove('hidden');
document.getElementById('loggedIn').classList.add('hidden');
}
// Upgrade to Producer function
function upgradeToProducer() {
const user = BF.getCurrentUser();
if (!user || user.role !== 'fan') return;
// Update user role
user.role = 'producer';
user.isArtist = true;
localStorage.setItem('beatfridge_current_user', JSON.stringify(user));
// Update in users list
try {
const users = JSON.parse(localStorage.getItem('beatfridge_users') || '[]');
const idx = users.findIndex(u => u.id === user.id);
if (idx > -1) {
users[idx].role = 'producer';
users[idx].isArtist = true;
localStorage.setItem('beatfridge_users', JSON.stringify(users));
}
} catch(e) {}
BF.showToast('Upgraded to Producer! 🎵');
setTimeout(() => window.location.reload(), 500);
}
// Render Super Fan Subscriptions
function renderSuperFanList() {
const subs = BF.getSuperFanSubscriptions();
const container = document.getElementById('superFanList');
if (!container) return;
if (!subs.length) {
container.innerHTML = `
<div class="text-center py-8">
<div class="w-14 h-14 rounded-full bg-orange-500/10 flex items-center justify-center mx-auto mb-3">
<i data-lucide="zap" class="w-7 h-7 text-orange-400/50"></i>
</div>
<p class="text-gray-400 text-sm mb-1">No Super Fan subscriptions yet</p>
<p class="text-gray-600 text-xs mb-4">Subscribe to artists to unlock exclusive content</p>
<div class="p-3 rounded-xl bg-orange-500/5 border border-orange-500/15 max-w-sm mx-auto">
<p class="text-sm text-orange-400 font-semibold flex items-center justify-center gap-1.5"><i data-lucide="download" class="w-4 h-4"></i>Download unlimited beats for one price</p>
<p class="text-[11px] text-gray-500 mt-1">Free downloads on all tracks · Exclusive content · $25/mo</p>
</div>
</div>
`;
lucide.createIcons();
return;
}
// Show savings callout when user has active subscriptions
const savingsHtml = `
<div class="p-3 rounded-xl bg-green-500/5 border border-green-500/15 mb-4 flex items-center gap-3">
<div class="w-9 h-9 rounded-lg bg-green-500/15 flex items-center justify-center flex-shrink-0">
<i data-lucide="badge-check" class="w-4 h-4 text-green-400"></i>
</div>
<div>
<p class="text-sm text-green-400 font-semibold">All paywalls bypassed</p>
<p class="text-[11px] text-gray-500">Download unlimited beats · Exclusive content unlocked</p>
</div>
</div>
`;
container.insertAdjacentHTML('beforeend', savingsHtml);
lucide.createIcons();
container.innerHTML = `
<div class="space-y-3">
${subs.map(sub => `
<div class="flex items-center gap-4 p-4 rounded-xl bg-white/5 border border-white/10 hover:bg-white/[0.07] transition">
<div class="w-12 h-12 rounded-full overflow-hidden flex-shrink-0 border-2 border-orange-500/30">
${sub.image ? `<img src="${sub.image}" class="w-full h-full object-cover">` : `<div class="w-full h-full bg-orange-500/20 flex items-center justify-center"><i data-lucide="user" class="w-5 h-5 text-orange-400"></i></div>`}
</div>
<div class="flex-1 min-w-0">
<div class="flex items-center gap-2">
<a href="artist.html" class="font-semibold text-white truncate hover:text-cyan-400 transition">${sub.name}</a>
<span class="px-2 py-0.5 rounded text-[10px] bg-green-500/20 text-green-400 font-medium flex items-center gap-1"><i data-lucide="check-circle" class="w-3 h-3"></i>Active</span>
</div>
<p class="text-xs text-gray-500 mt-0.5">Subscribed ${new Date(sub.date).toLocaleDateString()} • $25/mo</p>
</div>
<button onclick="cancelSubscription('${sub.slug}')" class="px-3 py-1.5 rounded-lg bg-red-500/10 hover:bg-red-500/20 text-red-400 text-xs font-medium transition flex items-center gap-1.5" title="Cancel subscription">
<i data-lucide="x-circle" class="w-3.5 h-3.5"></i>
<span class="hidden sm:inline">Cancel</span>
</button>
</div>
`).join('')}
</div>
`;
lucide.createIcons();
}
function cancelSubscription(artistSlug) {
if (!confirm('Cancel your Super Fan subscription? You will lose access to exclusive content.')) return;
const result = BF.cancelSuperFanSubscription(artistSlug);
if (result) {
renderSuperFanList();
BF.updateSuperFanButtons();
}
}
lucide.createIcons();
</script>
</body>