Spaces:
Running
Running
π³ 14/04 - 17:11 - Increase creator uploads.Add onboarding flow:When a creator signs up:- Show:Β Β βUpload your first beat and start earning todayβAdd incentives:- βTop creators this weekβ- βEarn your
de20df8 verified Download upload.html from Onttraders/BeatFridge: direct link, hf CLI and curl.
- Browser
- Download file 81.3 kB
-
https://huggingface.co/spaces/Onttraders/BeatFridge/resolve/main/upload.html
- Command line
-
hf download hf://spaces/Onttraders/BeatFridge/upload.html
-
curl -L -o upload.html https://huggingface.co/spaces/Onttraders/BeatFridge/resolve/main/upload.html
81.3 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Upload Studio - 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; }
.glow-cyan { box-shadow: 0 0 20px rgba(0,212,255,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); }
.upload-zone {
border: 2px dashed rgba(255,255,255,0.15);
transition: all 0.3s ease;
position: relative;
overflow: hidden;
}
.upload-zone::before {
content: '';
position: absolute; inset: 0;
background: radial-gradient(circle at 50% 50%, rgba(0,212,255,0.03), transparent 70%);
opacity: 0; transition: opacity 0.3s;
}
.upload-zone:hover::before, .upload-zone.dragover::before { opacity: 1; }
.upload-zone:hover, .upload-zone.dragover {
border-color: rgba(0,212,255,0.5);
background: rgba(0,212,255,0.03);
}
.upload-zone.uploaded {
border-color: rgba(34,197,94,0.4);
border-style: solid;
background: rgba(34,197,94,0.03);
}
.step-dot { transition: all 0.4s cubic-bezier(0.4,0,0.2,1); }
.step-line { transition: background 0.4s ease; }
.mood-tag {
transition: all 0.2s ease;
cursor: pointer;
user-select: none;
}
.mood-tag:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.2); }
.mood-tag.selected {
background: rgba(0,212,255,0.15);
border-color: rgba(0,212,255,0.5);
color: #00d4ff;
}
.waveform-bar {
transition: height 0.15s ease;
}
.toggle-track {
transition: background 0.2s ease;
}
.toggle-thumb {
transition: transform 0.2s ease;
}
.preview-option {
transition: all 0.2s ease;
}
.preview-option.selected {
background: rgba(0,212,255,0.1);
border-color: rgba(0,212,255,0.5);
}
@keyframes pulse-ring {
0% { box-shadow: 0 0 0 0 rgba(0,212,255,0.3); }
70% { box-shadow: 0 0 0 8px rgba(0,212,255,0); }
100% { box-shadow: 0 0 0 0 rgba(0,212,255,0); }
}
.step-active-ring { animation: pulse-ring 2s ease infinite; }
.bf-input {
width: 100%; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
border-radius: 0.75rem; padding: 0.75rem 1rem; font-size: 0.875rem;
color: white; outline: none; transition: border-color 0.2s, background 0.2s;
}
.bf-input:focus { border-color: rgba(0,212,255,0.5); background: rgba(255,255,255,0.07); }
.bf-input::placeholder { color: #4b5563; }
.bf-input.error { border-color: rgba(239,68,68,0.5); }
.bf-select {
width: 100%; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
border-radius: 0.75rem; padding: 0.75rem 1rem; font-size: 0.875rem;
color: white; outline: none; transition: border-color 0.2s;
-webkit-appearance: none; appearance: none;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: right 0.75rem center;
}
.bf-select:focus { border-color: rgba(0,212,255,0.5); }
.bf-select option { background: #1a1a1a; color: white; }
</style>
</head>
<body class="bg-black text-white overflow-x-hidden pb-24">
<!-- 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="text-cyan-400 flex items-center gap-1"><i data-lucide="upload-cloud" class="w-4 h-4"></i>Upload</a>
<a href="library.html" class="hover:text-cyan-400 transition">Library</a>
</div>
</div>
<div class="flex items-center gap-3">
<div id="topNavAvatarWrap" class="w-9 h-9 rounded-full bg-gradient-to-br from-cyan-400 to-purple-600 cursor-pointer hover:scale-105 transition avatar-ring overflow-hidden" onclick="BF.isLoggedIn() ? window.location.href='profile.html' : BF.showSignInModal()">
<img id="topNavAvatar" src="http://static.photos/people/200x200/42" alt="Profile" class="w-full h-full rounded-full object-cover">
</div>
</div>
</div>
</nav>
<!-- Fan Access Block (hidden by default) -->
<div id="fanBlock" class="hidden">
<div class="max-w-xl mx-auto text-center py-20 px-4 pt-28">
<div class="w-20 h-20 rounded-full bg-white/5 flex items-center justify-center mx-auto mb-6">
<i data-lucide="lock" class="w-10 h-10 text-gray-500"></i>
</div>
<h2 class="text-2xl font-bold text-white mb-3">Uploads are for Creators</h2>
<p class="text-gray-400 mb-6 max-w-md mx-auto">Fan accounts are for listening. Upgrade to a Producer account to start sharing your tracks and earning.</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">Upgrade to Producer</button>
<p class="text-sm text-gray-500 mt-4">or <a href="index.html" class="text-cyan-400 hover:underline">go back home</a></p>
</div>
</div>
<!-- Onboarding Overlay for New Creators -->
<div id="onboardingOverlay" class="hidden fixed inset-0 z-[60] flex items-center justify-center">
<div class="absolute inset-0 bg-black/90 backdrop-blur-md"></div>
<div class="relative z-10 w-full max-w-lg mx-4 text-center">
<div class="w-20 h-20 rounded-full bg-gradient-to-br from-cyan-500/20 to-orange-500/20 border border-cyan-500/30 flex items-center justify-center mx-auto mb-6">
<i data-lucide="rocket" class="w-10 h-10 text-cyan-400"></i>
</div>
<h2 class="text-3xl sm:text-4xl font-bold text-white mb-3">Upload your first beat<br>and start earning today</h2>
<p class="text-gray-400 mb-2 max-w-md mx-auto">You're all set as a Producer. Your next track could be someone's favorite beat.</p>
<p class="text-cyan-400 font-semibold text-sm mb-8" id="onboardingPrompt">π΅ Your beat could be someone's next hit</p>
<!-- Onboarding Steps Preview -->
<div class="glass-panel rounded-2xl p-5 mb-6 text-left">
<h3 class="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-4 flex items-center gap-2">
<i data-lucide="list-checks" class="w-4 h-4 text-orange-400"></i>
Your Creator Journey
</h3>
<div class="space-y-3" id="onboardingSteps"></div>
</div>
<!-- Quick Upload CTA -->
<button onclick="dismissOnboardingAndStart()" class="w-full py-4 bg-gradient-to-r from-cyan-500 to-purple-500 hover:from-cyan-400 hover:to-purple-400 text-white font-bold text-lg rounded-xl transition flex items-center justify-center gap-3 mb-3" style="box-shadow: 0 0 30px rgba(0,212,255,0.2)">
<i data-lucide="upload-cloud" class="w-6 h-6"></i>
Upload Your First Beat β Under 30 Seconds
</button>
<p class="text-xs text-gray-600 mb-4">Quick mode: just pick a file + title β publish</p>
<!-- Incentives -->
<div class="flex items-center justify-center gap-4 text-xs text-gray-500">
<span class="flex items-center gap-1.5"><i data-lucide="trophy" class="w-3.5 h-3.5 text-orange-400"></i>Top Creator leaderboard</span>
<span class="flex items-center gap-1.5"><i data-lucide="award" class="w-3.5 h-3.5 text-cyan-400"></i>Earn badges</span>
<span class="flex items-center gap-1.5"><i data-lucide="dollar-sign" class="w-3.5 h-3.5 text-green-400"></i>85% revenue</span>
</div>
<button onclick="BF.dismissOnboarding(); document.getElementById('onboardingOverlay').classList.add('hidden')" class="mt-4 text-sm text-gray-600 hover:text-gray-400 transition">I'll do this later</button>
</div>
</div>
<!-- Main Creator Interface -->
<main id="creatorStudio" class="max-w-3xl mx-auto pt-20 pb-32 px-4 sm:px-6">
<!-- Motivational Prompt Bar -->
<div id="motivationalBar" class="hidden mb-6 p-4 rounded-2xl bg-gradient-to-r from-cyan-500/10 to-orange-500/10 border border-cyan-500/20 flex items-center gap-4">
<div class="w-10 h-10 rounded-xl bg-cyan-500/20 flex items-center justify-center flex-shrink-0">
<i data-lucide="sparkles" class="w-5 h-5 text-cyan-400"></i>
</div>
<p class="text-sm text-gray-300 flex-1" id="motivationalText">Your beat could be someone's next hit π΅</p>
<button onclick="refreshMotivation()" class="text-xs text-gray-500 hover:text-cyan-400 transition flex items-center gap-1 flex-shrink-0">
<i data-lucide="refresh-cw" class="w-3 h-3"></i>
</button>
</div>
<!-- Page Header -->
<div class="mb-8">
<div class="flex items-center justify-between">
<div>
<h1 class="text-2xl sm:text-3xl font-bold mb-1">Upload Studio</h1>
<p class="text-gray-500 text-sm">Share your music and start earning</p>
</div>
<button id="quickUploadBtn" onclick="startQuickUpload()" class="hidden px-4 py-2 bg-orange-500/20 hover:bg-orange-500/30 text-orange-400 border border-orange-500/30 rounded-xl text-sm font-semibold transition flex items-center gap-2">
<i data-lucide="zap" class="w-4 h-4"></i>
<span class="hidden sm:inline">Quick Upload</span>
<span class="sm:hidden">Quick</span>
</button>
</div>
</div>
<!-- Step Progress Indicator -->
<div class="flex items-center gap-0 mb-10 px-2" id="stepIndicator">
<div class="flex flex-col items-center flex-1" data-step-ind="1">
<div class="step-dot w-9 h-9 rounded-full bg-cyan-500 text-black flex items-center justify-center text-sm font-bold step-active-ring">1</div>
<span class="text-[11px] mt-2 text-cyan-400 font-medium text-center">Upload</span>
</div>
<div class="step-line h-0.5 flex-1 bg-white/10 -mt-5 mx-1 rounded-full" data-line="1"></div>
<div class="flex flex-col items-center flex-1" data-step-ind="2">
<div class="step-dot w-9 h-9 rounded-full bg-white/10 text-gray-500 flex items-center justify-center text-sm font-bold">2</div>
<span class="text-[11px] mt-2 text-gray-600 font-medium text-center">Details</span>
</div>
<div class="step-line h-0.5 flex-1 bg-white/10 -mt-5 mx-1 rounded-full" data-line="2"></div>
<div class="flex flex-col items-center flex-1" data-step-ind="3">
<div class="step-dot w-9 h-9 rounded-full bg-white/10 text-gray-500 flex items-center justify-center text-sm font-bold">3</div>
<span class="text-[11px] mt-2 text-gray-600 font-medium text-center">Monetize</span>
</div>
<div class="step-line h-0.5 flex-1 bg-white/10 -mt-5 mx-1 rounded-full" data-line="3"></div>
<div class="flex flex-col items-center flex-1" data-step-ind="4">
<div class="step-dot w-9 h-9 rounded-full bg-white/10 text-gray-500 flex items-center justify-center text-sm font-bold">4</div>
<span class="text-[11px] mt-2 text-gray-600 font-medium text-center">Preview</span>
</div>
<div class="step-line h-0.5 flex-1 bg-white/10 -mt-5 mx-1 rounded-full" data-line="4"></div>
<div class="flex flex-col items-center flex-1" data-step-ind="5">
<div class="step-dot w-9 h-9 rounded-full bg-white/10 text-gray-500 flex items-center justify-center text-sm font-bold">5</div>
<span class="text-[11px] mt-2 text-gray-600 font-medium text-center">Publish</span>
</div>
</div>
<!-- ====== STEP 1: Upload ====== -->
<section id="step1" class="step-section">
<div class="glass-panel rounded-2xl p-6 sm:p-8">
<div class="flex items-center gap-3 mb-6">
<div class="w-10 h-10 rounded-xl bg-cyan-500/20 flex items-center justify-center">
<i data-lucide="music" class="w-5 h-5 text-cyan-400"></i>
</div>
<div>
<h2 class="text-lg font-bold text-white">Upload Your Track</h2>
<p class="text-xs text-gray-500">Drag & drop or browse β MP3, WAV, FLAC up to 500MB</p>
</div>
</div>
<div class="upload-zone rounded-xl p-8 text-center cursor-pointer" id="audioUpload" onclick="document.getElementById('audioInput').click()">
<input type="file" id="audioInput" accept="audio/*" class="hidden" onchange="handleAudioUpload(this)">
<!-- Empty State -->
<div id="uploadPrompt">
<div class="w-16 h-16 rounded-2xl bg-white/5 flex items-center justify-center mx-auto mb-4">
<i data-lucide="upload-cloud" class="w-8 h-8 text-cyan-400"></i>
</div>
<p class="text-white font-medium mb-1">Drop your audio file here</p>
<p class="text-sm text-gray-500 mb-4">or click to browse</p>
<span class="inline-flex items-center gap-1.5 text-xs text-gray-600">
<i data-lucide="shield-check" class="w-3.5 h-3.5"></i>
Secure upload Β· Lossless quality preserved
</span>
</div>
<!-- Upload Progress -->
<div id="uploadProgress" class="hidden">
<div class="flex items-center gap-3 mb-4 text-left">
<div class="w-10 h-10 rounded-lg bg-cyan-500/20 flex items-center justify-center flex-shrink-0">
<i data-lucide="file-audio" class="w-5 h-5 text-cyan-400"></i>
</div>
<div class="flex-1 min-w-0">
<p class="text-sm font-medium text-white truncate" id="fileName">track.wav</p>
<p class="text-xs text-gray-500" id="fileSize">48.5 MB</p>
</div>
</div>
<div class="h-1.5 bg-white/10 rounded-full overflow-hidden">
<div class="h-full bg-gradient-to-r from-cyan-400 to-purple-500 rounded-full transition-all duration-300" id="progressBar" style="width:0%"></div>
</div>
<p class="text-xs text-gray-500 mt-2 text-left" id="progressText">Uploading... 0%</p>
</div>
<!-- Upload Complete -->
<div id="uploadComplete" class="hidden">
<div class="flex items-center gap-3 mb-4 text-left">
<div class="w-10 h-10 rounded-lg bg-green-500/20 flex items-center justify-center flex-shrink-0">
<i data-lucide="check-circle" class="w-5 h-5 text-green-400"></i>
</div>
<div class="flex-1 min-w-0">
<p class="text-sm font-medium text-white truncate" id="completeFileName">track.wav</p>
<p class="text-xs text-green-400 flex items-center gap-1"><i data-lucide="check" class="w-3 h-3"></i>Ready to go</p>
</div>
<button class="text-gray-500 hover:text-white transition p-1" onclick="event.stopPropagation(); resetUpload()">
<i data-lucide="x" class="w-4 h-4"></i>
</button>
</div>
<!-- Waveform Preview -->
<div class="mt-3 h-20 bg-white/5 rounded-lg overflow-hidden relative">
<div class="absolute inset-0 flex items-center justify-center gap-[2px] px-3" id="uploadWaveform"></div>
<div class="absolute left-0 top-0 bottom-0 w-[35%] bg-gradient-to-r from-cyan-500/10 to-transparent pointer-events-none"></div>
</div>
</div>
</div>
<p id="audioError" class="text-red-400 text-xs mt-2 hidden">Please upload an audio file</p>
</div>
<div class="flex justify-end mt-6">
<button onclick="goToStep(2)" class="px-6 py-3 bg-cyan-500 hover:bg-cyan-400 text-black font-semibold rounded-xl transition flex items-center gap-2 glow-cyan" id="step1Next">
Continue <i data-lucide="arrow-right" class="w-4 h-4"></i>
</button>
</div>
</section>
<!-- ====== STEP 2: Track Info ====== -->
<section id="step2" class="step-section hidden">
<div class="glass-panel rounded-2xl p-6 sm:p-8">
<div class="flex items-center gap-3 mb-6">
<div class="w-10 h-10 rounded-xl bg-purple-500/20 flex items-center justify-center">
<i data-lucide="edit-3" class="w-5 h-5 text-purple-400"></i>
</div>
<div>
<h2 class="text-lg font-bold text-white">Track Details</h2>
<p class="text-xs text-gray-500">Tell listeners what this track is about</p>
</div>
</div>
<div class="space-y-5">
<!-- Title -->
<div>
<label class="block text-xs font-medium text-gray-400 uppercase tracking-wider mb-2">Title <span class="text-red-400">*</span></label>
<input type="text" id="trackTitle" placeholder="e.g. Midnight Synthesis" class="bf-input" onblur="validateField(this, 'titleError')">
<p id="titleError" class="text-red-400 text-xs mt-1.5 hidden">Track title is required</p>
</div>
<!-- Genre + BPM Row -->
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div>
<label class="block text-xs font-medium text-gray-400 uppercase tracking-wider mb-2">Genre <span class="text-red-400">*</span></label>
<select id="trackGenre" class="bf-select" onchange="validateField(this, 'genreError')">
<option value="">Select genre</option>
<option value="techno">Techno</option>
<option value="house">House</option>
<option value="deep-house">Deep House</option>
<option value="amapiano">Amapiano</option>
<option value="trap">Trap</option>
<option value="ambient">Ambient</option>
<option value="synthwave">Synthwave</option>
<option value="drum-bass">Drum & Bass</option>
<option value="lo-fi">Lo-Fi</option>
<option value="experimental">Experimental</option>
<option value="hip-hop">Hip-Hop</option>
<option value="rnb">R&B</option>
</select>
<p id="genreError" class="text-red-400 text-xs mt-1.5 hidden">Please select a genre</p>
</div>
<div>
<label class="block text-xs font-medium text-gray-400 uppercase tracking-wider mb-2">BPM <span class="text-gray-600">(optional)</span></label>
<input type="number" id="trackBpm" placeholder="128" min="20" max="300" class="bf-input">
</div>
</div>
<!-- Mood Tags -->
<div>
<label class="block text-xs font-medium text-gray-400 uppercase tracking-wider mb-3">Mood <span class="text-gray-600">(select up to 5)</span></label>
<div class="flex flex-wrap gap-2" id="moodTags">
<button type="button" class="mood-tag px-3 py-1.5 rounded-lg border border-white/10 text-sm text-gray-400" data-mood="Dark">Dark</button>
<button type="button" class="mood-tag px-3 py-1.5 rounded-lg border border-white/10 text-sm text-gray-400" data-mood="Energetic">Energetic</button>
<button type="button" class="mood-tag px-3 py-1.5 rounded-lg border border-white/10 text-sm text-gray-400" data-mood="Chill">Chill</button>
<button type="button" class="mood-tag px-3 py-1.5 rounded-lg border border-white/10 text-sm text-gray-400" data-mood="Uplifting">Uplifting</button>
<button type="button" class="mood-tag px-3 py-1.5 rounded-lg border border-white/10 text-sm text-gray-400" data-mood="Melancholic">Melancholic</button>
<button type="button" class="mood-tag px-3 py-1.5 rounded-lg border border-white/10 text-sm text-gray-400" data-mood="Aggressive">Aggressive</button>
<button type="button" class="mood-tag px-3 py-1.5 rounded-lg border border-white/10 text-sm text-gray-400" data-mood="Dreamy">Dreamy</button>
<button type="button" class="mood-tag px-3 py-1.5 rounded-lg border border-white/10 text-sm text-gray-400" data-mood="Hypnotic">Hypnotic</button>
<button type="button" class="mood-tag px-3 py-1.5 rounded-lg border border-white/10 text-sm text-gray-400" data-mood="Groovy">Groovy</button>
<button type="button" class="mood-tag px-3 py-1.5 rounded-lg border border-white/10 text-sm text-gray-400" data-mood="Atmospheric">Atmospheric</button>
<button type="button" class="mood-tag px-3 py-1.5 rounded-lg border border-white/10 text-sm text-gray-400" data-mood="Ethereal">Ethereal</button>
<button type="button" class="mood-tag px-3 py-1.5 rounded-lg border border-white/10 text-sm text-gray-400" data-mood="Raw">Raw</button>
</div>
</div>
<!-- Description -->
<div>
<label class="block text-xs font-medium text-gray-400 uppercase tracking-wider mb-2">Description <span class="text-gray-600">(optional)</span></label>
<textarea id="trackDescription" placeholder="Tell the story behind this track, gear used, inspiration..." class="bf-input h-20 resize-none"></textarea>
</div>
<!-- Cover Art -->
<div>
<label class="block text-xs font-medium text-gray-400 uppercase tracking-wider mb-2">Cover Art <span class="text-gray-600">(optional)</span></label>
<div class="flex items-center gap-4">
<div class="w-20 h-20 rounded-xl bg-white/5 border border-white/10 border-dashed flex items-center justify-center flex-shrink-0 overflow-hidden relative group cursor-pointer" onclick="document.getElementById('artworkInput').click()">
<input type="file" id="artworkInput" accept="image/*" class="hidden" onchange="handleArtworkUpload(this)">
<div id="artworkPlaceholder" class="text-center">
<i data-lucide="image-plus" class="w-5 h-5 text-gray-600 mx-auto"></i>
</div>
<img id="artworkPreview" class="w-full h-full object-cover hidden">
</div>
<div>
<p class="text-sm text-gray-400">1400Γ1400px recommended</p>
<p class="text-xs text-gray-600">JPG or PNG</p>
</div>
</div>
</div>
</div>
</div>
<div class="flex justify-between mt-6">
<button onclick="goToStep(1)" class="px-5 py-3 bg-white/5 hover:bg-white/10 border border-white/10 rounded-xl text-sm font-medium text-gray-400 transition flex items-center gap-2">
<i data-lucide="arrow-left" class="w-4 h-4"></i> Back
</button>
<button onclick="goToStep(3)" class="px-6 py-3 bg-cyan-500 hover:bg-cyan-400 text-black font-semibold rounded-xl transition flex items-center gap-2 glow-cyan">
Continue <i data-lucide="arrow-right" class="w-4 h-4"></i>
</button>
</div>
</section>
<!-- ====== STEP 3: Monetization ====== -->
<section id="step3" class="step-section hidden">
<div class="glass-panel rounded-2xl p-6 sm:p-8">
<div class="flex items-center gap-3 mb-6">
<div class="w-10 h-10 rounded-xl bg-orange-500/20 flex items-center justify-center">
<i data-lucide="dollar-sign" class="w-5 h-5 text-orange-400"></i>
</div>
<div>
<h2 class="text-lg font-bold text-white">Monetization</h2>
<p class="text-xs text-gray-500">Earn from every download</p>
</div>
</div>
<!-- Paid Unlock Toggle -->
<div class="p-4 rounded-xl bg-white/5 border border-white/10 mb-6">
<div class="flex items-center justify-between">
<div class="flex items-center gap-3">
<div class="w-9 h-9 rounded-lg bg-orange-500/20 flex items-center justify-center">
<i data-lucide="lock" class="w-4 h-4 text-orange-400"></i>
</div>
<div>
<p class="text-sm font-medium text-white">Enable Paid Unlock</p>
<p class="text-xs text-gray-500">Listeners pay to download Β· Super Fans get it free</p>
</div>
</div>
<button id="paidUnlockToggle" onclick="togglePaidUnlock()" class="relative w-12 h-7 rounded-full toggle-track bg-white/10 flex-shrink-0" role="switch" aria-checked="false">
<div class="toggle-thumb w-5 h-5 rounded-full bg-gray-400 absolute top-1 left-1"></div>
</button>
</div>
</div>
<!-- Pricing Options (hidden by default) -->
<div id="pricingSection" class="hidden space-y-5">
<!-- Default Price -->
<div>
<label class="block text-xs font-medium text-gray-400 uppercase tracking-wider mb-2">Minimum Price</label>
<div class="relative">
<span class="absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 text-sm font-medium">$</span>
<input type="number" id="trackPrice" value="0.50" min="0.50" step="0.01" class="bf-input pl-8">
</div>
<p class="text-xs text-gray-600 mt-1.5">Minimum $0.50 Β· Listeners can pay more to support you</p>
</div>
<!-- Quick Price Buttons -->
<div>
<label class="block text-xs font-medium text-gray-400 uppercase tracking-wider mb-2">Quick Set</label>
<div class="flex gap-2">
<button type="button" onclick="setPrice(0.50)" class="price-btn flex-1 py-2.5 rounded-lg border border-orange-500/30 bg-orange-500/10 text-orange-400 text-sm font-semibold transition hover:bg-orange-500/20">$0.50</button>
<button type="button" onclick="setPrice(0.99)" class="price-btn flex-1 py-2.5 rounded-lg border border-white/10 bg-white/5 text-gray-400 text-sm font-medium transition hover:bg-white/10">$0.99</button>
<button type="button" onclick="setPrice(1.99)" class="price-btn flex-1 py-2.5 rounded-lg border border-white/10 bg-white/5 text-gray-400 text-sm font-medium transition hover:bg-white/10">$1.99</button>
<button type="button" onclick="setPrice(4.99)" class="price-btn flex-1 py-2.5 rounded-lg border border-white/10 bg-white/5 text-gray-400 text-sm font-medium transition hover:bg-white/10">$4.99</button>
</div>
</div>
<!-- Revenue Preview -->
<div class="p-4 rounded-xl bg-gradient-to-r from-orange-500/10 to-cyan-500/10 border border-orange-500/20">
<div class="flex items-center gap-2 mb-3">
<i data-lucide="trending-up" class="w-4 h-4 text-orange-400"></i>
<span class="text-sm font-medium text-white">Revenue Preview</span>
</div>
<div class="grid grid-cols-3 gap-3 text-center">
<div>
<p class="text-lg font-bold text-white" id="revPerSale">$0.43</p>
<p class="text-[10px] text-gray-500 uppercase tracking-wider">Per Sale</p>
</div>
<div>
<p class="text-lg font-bold text-orange-400">85%</p>
<p class="text-[10px] text-gray-500 uppercase tracking-wider">Your Cut</p>
</div>
<div>
<p class="text-lg font-bold text-gray-400" id="revPlatform">$0.08</p>
<p class="text-[10px] text-gray-500 uppercase tracking-wider">Platform Fee</p>
</div>
</div>
</div>
<!-- Super Fan Info -->
<div class="flex items-start gap-3 p-3 rounded-lg bg-white/5">
<i data-lucide="zap" class="w-4 h-4 text-orange-400 mt-0.5 flex-shrink-0"></i>
<p class="text-xs text-gray-400"><span class="text-orange-400 font-medium">Super Fans</span> bypass payment and download for free β included in their subscription</p>
</div>
</div>
<!-- Free Download Info (shown when toggle is off) -->
<div id="freeInfo" class="">
<div class="flex items-start gap-3 p-4 rounded-xl bg-white/5 border border-white/10">
<i data-lucide="info" class="w-4 h-4 text-gray-500 mt-0.5 flex-shrink-0"></i>
<div>
<p class="text-sm text-gray-400">Downloads are <span class="text-white font-medium">free</span> for everyone</p>
<p class="text-xs text-gray-600 mt-1">Enable paid unlock to earn from each download</p>
</div>
</div>
</div>
</div>
<div class="flex justify-between mt-6">
<button onclick="goToStep(2)" class="px-5 py-3 bg-white/5 hover:bg-white/10 border border-white/10 rounded-xl text-sm font-medium text-gray-400 transition flex items-center gap-2">
<i data-lucide="arrow-left" class="w-4 h-4"></i> Back
</button>
<button onclick="goToStep(4)" class="px-6 py-3 bg-cyan-500 hover:bg-cyan-400 text-black font-semibold rounded-xl transition flex items-center gap-2 glow-cyan">
Continue <i data-lucide="arrow-right" class="w-4 h-4"></i>
</button>
</div>
</section>
<!-- ====== STEP 4: Preview Settings ====== -->
<section id="step4" class="step-section hidden">
<div class="glass-panel rounded-2xl p-6 sm:p-8">
<div class="flex items-center gap-3 mb-6">
<div class="w-10 h-10 rounded-xl bg-green-500/20 flex items-center justify-center">
<i data-lucide="play-circle" class="w-5 h-5 text-green-400"></i>
</div>
<div>
<h2 class="text-lg font-bold text-white">Preview Settings</h2>
<p class="text-xs text-gray-500">Control what listeners hear before unlocking</p>
</div>
</div>
<!-- Preview Length -->
<div class="space-y-3 mb-6">
<label class="block text-xs font-medium text-gray-400 uppercase tracking-wider mb-2">Preview Length</label>
<div class="grid grid-cols-2 sm:grid-cols-4 gap-3">
<div class="preview-option p-4 rounded-xl border border-white/10 cursor-pointer text-center hover:bg-white/5 transition" onclick="selectPreview(this, '15')" data-length="15">
<p class="text-xl font-bold text-white">0:15</p>
<p class="text-[10px] text-gray-500 mt-1">Teaser</p>
</div>
<div class="preview-option selected p-4 rounded-xl border border-cyan-500/50 cursor-pointer text-center bg-cyan-500/10" onclick="selectPreview(this, '30')" data-length="30">
<p class="text-xl font-bold text-white">0:30</p>
<p class="text-[10px] text-gray-500 mt-1">Standard</p>
</div>
<div class="preview-option p-4 rounded-xl border border-white/10 cursor-pointer text-center hover:bg-white/5 transition" onclick="selectPreview(this, '60')" data-length="60">
<p class="text-xl font-bold text-white">1:00</p>
<p class="text-[10px] text-gray-500 mt-1">Extended</p>
</div>
<div class="preview-option p-4 rounded-xl border border-white/10 cursor-pointer text-center hover:bg-white/5 transition" onclick="selectPreview(this, 'full')" data-length="full">
<p class="text-xl font-bold text-white">Full</p>
<p class="text-[10px] text-gray-500 mt-1">No lock</p>
</div>
</div>
</div>
<!-- Auto-Snippet Toggle -->
<div class="p-4 rounded-xl bg-white/5 border border-white/10">
<div class="flex items-center justify-between">
<div class="flex items-center gap-3">
<div class="w-9 h-9 rounded-lg bg-green-500/20 flex items-center justify-center">
<i data-lucide="wand-2" class="w-4 h-4 text-green-400"></i>
</div>
<div>
<p class="text-sm font-medium text-white">Auto-generate snippet</p>
<p class="text-xs text-gray-500">AI picks the best part of your track</p>
</div>
</div>
<button id="autoSnippetToggle" onclick="toggleAutoSnippet()" class="relative w-12 h-7 rounded-full toggle-track bg-cyan-500 flex-shrink-0" role="switch" aria-checked="true">
<div class="toggle-thumb w-5 h-5 rounded-full bg-white absolute top-1 left-1 transform translate-x-5"></div>
</button>
</div>
</div>
<!-- Visual Preview -->
<div class="mt-6">
<label class="block text-xs font-medium text-gray-400 uppercase tracking-wider mb-2">Preview Range</label>
<div class="h-16 bg-white/5 rounded-lg overflow-hidden relative">
<div class="absolute inset-0 flex items-center justify-center gap-[2px] px-3" id="previewWaveform"></div>
<div id="previewLockedZone" class="absolute right-0 top-0 bottom-0 bg-black/60 flex items-center justify-center" style="width:65%">
<div class="flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-orange-500/20 border border-orange-500/30">
<i data-lucide="lock" class="w-3 h-3 text-orange-400"></i>
<span class="text-[10px] text-orange-400 font-medium">Locked</span>
</div>
</div>
<div id="previewUnlockedZone" class="absolute left-0 top-0 bottom-0 bg-gradient-to-r from-cyan-500/10 to-transparent" style="width:35%"></div>
</div>
<div class="flex items-center justify-between mt-2 text-[10px] text-gray-600">
<span>0:00</span>
<span class="text-cyan-400">β Preview β</span>
<span id="previewEndLabel">0:30</span>
</div>
</div>
</div>
<div class="flex justify-between mt-6">
<button onclick="goToStep(3)" class="px-5 py-3 bg-white/5 hover:bg-white/10 border border-white/10 rounded-xl text-sm font-medium text-gray-400 transition flex items-center gap-2">
<i data-lucide="arrow-left" class="w-4 h-4"></i> Back
</button>
<button onclick="goToStep(5)" class="px-6 py-3 bg-cyan-500 hover:bg-cyan-400 text-black font-semibold rounded-xl transition flex items-center gap-2 glow-cyan">
Continue <i data-lucide="arrow-right" class="w-4 h-4"></i>
</button>
</div>
</section>
<!-- ====== STEP 5: Publish ====== -->
<section id="step5" class="step-section hidden">
<div class="glass-panel rounded-2xl p-6 sm:p-8">
<div class="flex items-center gap-3 mb-6">
<div class="w-10 h-10 rounded-xl bg-cyan-500/20 flex items-center justify-center">
<i data-lucide="rocket" class="w-5 h-5 text-cyan-400"></i>
</div>
<div>
<h2 class="text-lg font-bold text-white">Ready to Publish</h2>
<p class="text-xs text-gray-500">Review your settings and go live</p>
</div>
</div>
<!-- Summary Card -->
<div class="space-y-3 mb-6" id="publishSummary">
<!-- Populated by JS -->
</div>
<!-- Account Required (if not logged in) -->
<div id="accountSection" class="mb-6">
<div class="p-4 rounded-xl bg-white/5 border border-white/10">
<div class="flex items-center gap-2 mb-4">
<i data-lucide="user" class="w-4 h-4 text-cyan-400"></i>
<span class="text-sm font-medium text-white">Account Required</span>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
<div>
<input type="text" id="accountUsername" placeholder="Username" class="bf-input" onblur="validateUsername()">
<p id="usernameError" class="text-red-400 text-xs mt-1 hidden"></p>
</div>
<div>
<input type="email" id="accountEmail" placeholder="Email" class="bf-input" onblur="validateEmail()">
<p id="emailError" class="text-red-400 text-xs mt-1 hidden"></p>
</div>
</div>
<div class="mt-3">
<input type="password" id="accountPassword" placeholder="Password (8+ characters)" class="bf-input" oninput="checkPasswordStrength()">
<div class="mt-2 flex gap-1" id="strengthBars" style="display:none">
<div class="h-1 flex-1 rounded-full bg-white/10" id="str1"></div>
<div class="h-1 flex-1 rounded-full bg-white/10" id="str2"></div>
<div class="h-1 flex-1 rounded-full bg-white/10" id="str3"></div>
</div>
<p id="passwordError" class="text-red-400 text-xs mt-1 hidden"></p>
</div>
</div>
</div>
<!-- Publish Error -->
<div id="publishError" class="hidden mb-4 p-4 rounded-xl bg-red-500/20 border border-red-500/30 text-red-400 text-sm"></div>
<!-- Big CTA -->
<button id="publishBtn" onclick="publishTrack()" class="w-full py-4 bg-gradient-to-r from-cyan-500 to-purple-500 hover:from-cyan-400 hover:to-purple-400 text-white font-bold text-lg rounded-xl transition flex items-center justify-center gap-3" style="box-shadow: 0 0 30px rgba(0,212,255,0.2)">
<i data-lucide="rocket" class="w-6 h-6"></i>
Publish & Start Earning
</button>
<p class="text-xs text-gray-600 text-center mt-3">By publishing, you agree to the <a href="#" class="text-gray-500 hover:text-cyan-400 transition">platform terms</a></p>
</div>
<div class="flex justify-start mt-6">
<button onclick="goToStep(4)" class="px-5 py-3 bg-white/5 hover:bg-white/10 border border-white/10 rounded-xl text-sm font-medium text-gray-400 transition flex items-center gap-2">
<i data-lucide="arrow-left" class="w-4 h-4"></i> Back
</button>
</div>
</section>
</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="mobile-nav.js"></script>
<script src="app.js"></script>
<script>
BF.init('upload');
lucide.createIcons();
// ===== STATE =====
let currentStep = 1;
let uploadedTrack = null;
let selectedMoods = [];
let paidUnlockEnabled = false;
let autoSnippetEnabled = true;
let previewLength = '30';
let isPro = localStorage.getItem('isPro') === 'true';
// ===== FAN ACCESS CHECK =====
(function checkAccess() {
try {
const cur = localStorage.getItem('beatfridge_current_user');
if (cur) {
const u = JSON.parse(cur);
if (u.role === 'fan') {
document.getElementById('creatorStudio').classList.add('hidden');
document.getElementById('fanBlock').classList.remove('hidden');
lucide.createIcons();
return;
}
}
} catch(e) {}
})();
// ===== LOGGED-IN CHECK =====
(function checkLoggedIn() {
try {
const cur = localStorage.getItem('beatfridge_current_user');
if (cur) {
const u = JSON.parse(cur);
const sec = document.getElementById('accountSection');
if (sec) {
sec.innerHTML = `
<div class="p-4 rounded-xl bg-green-500/10 border border-green-500/20 flex items-center gap-3">
<div class="w-9 h-9 rounded-full overflow-hidden flex-shrink-0">
<img src="${u.avatar || 'http://static.photos/people/200x200/42'}" class="w-full h-full object-cover">
</div>
<div>
<p class="text-sm font-medium text-white">Publishing as <span class="text-cyan-400">@${u.username}</span></p>
<p class="text-xs text-gray-500">${u.role === 'producer' ? 'Producer' : 'Creator'} account</p>
</div>
</div>
`;
}
}
} catch(e) {}
})();
// ===== STEP NAVIGATION =====
function goToStep(step) {
// Validate current step before advancing
if (step > currentStep) {
if (currentStep === 1 && !uploadedTrack) {
document.getElementById('audioError').classList.remove('hidden');
return;
}
if (currentStep === 2) {
const title = document.getElementById('trackTitle').value.trim();
const genre = document.getElementById('trackGenre').value;
if (!title) { document.getElementById('titleError').classList.remove('hidden'); document.getElementById('trackTitle').classList.add('error'); return; }
if (!genre) { document.getElementById('genreError').classList.remove('hidden'); document.getElementById('trackGenre').classList.add('error'); return; }
}
}
// Hide all sections
document.querySelectorAll('.step-section').forEach(s => s.classList.add('hidden'));
document.getElementById('step' + step).classList.remove('hidden');
// Update progress indicator
for (let i = 1; i <= 5; i++) {
const ind = document.querySelector(`[data-step-ind="${i}"]`);
const dot = ind.querySelector('.step-dot');
const label = ind.querySelector('span');
if (i < step) {
dot.className = 'step-dot w-9 h-9 rounded-full bg-cyan-500 text-black flex items-center justify-center text-sm font-bold';
dot.innerHTML = '<i data-lucide="check" class="w-4 h-4"></i>';
label.className = 'text-[11px] mt-2 text-cyan-400 font-medium text-center';
} else if (i === step) {
dot.className = 'step-dot w-9 h-9 rounded-full bg-cyan-500 text-black flex items-center justify-center text-sm font-bold step-active-ring';
dot.textContent = i;
label.className = 'text-[11px] mt-2 text-cyan-400 font-medium text-center';
} else {
dot.className = 'step-dot w-9 h-9 rounded-full bg-white/10 text-gray-500 flex items-center justify-center text-sm font-bold';
dot.textContent = i;
label.className = 'text-[11px] mt-2 text-gray-600 font-medium text-center';
}
// Step lines
if (i < 5) {
const line = document.querySelector(`[data-line="${i}"]`);
line.className = i < step
? 'step-line h-0.5 flex-1 bg-cyan-500 -mt-5 mx-1 rounded-full'
: 'step-line h-0.5 flex-1 bg-white/10 -mt-5 mx-1 rounded-full';
}
}
currentStep = step;
lucide.createIcons();
window.scrollTo({ top: 0, behavior: 'smooth' });
// Build summary on step 5
if (step === 5) buildSummary();
}
// ===== AUDIO UPLOAD =====
function handleAudioUpload(input) {
if (!input.files || !input.files[0]) return;
const file = input.files[0];
const zone = document.getElementById('audioUpload');
document.getElementById('uploadPrompt').classList.add('hidden');
document.getElementById('uploadProgress').classList.remove('hidden');
document.getElementById('fileName').textContent = file.name;
document.getElementById('fileSize').textContent = (file.size / (1024 * 1024)).toFixed(1) + ' MB Β· ' + file.name.split('.').pop().toUpperCase();
let progress = 0;
const bar = document.getElementById('progressBar');
const text = document.getElementById('progressText');
const interval = setInterval(() => {
progress += Math.random() * 18;
if (progress >= 100) {
progress = 100;
clearInterval(interval);
setTimeout(() => {
document.getElementById('uploadProgress').classList.add('hidden');
document.getElementById('uploadComplete').classList.remove('hidden');
document.getElementById('completeFileName').textContent = file.name;
zone.classList.add('uploaded');
document.getElementById('audioError').classList.add('hidden');
renderWaveform('uploadWaveform', 80);
}, 400);
}
bar.style.width = progress + '%';
text.textContent = 'Uploading... ' + Math.floor(progress) + '%';
}, 180);
uploadedTrack = {
id: Date.now(),
title: file.name.replace(/\.[^/.]+$/, ''),
artist: 'Aurora Void',
artistId: 'aurora-void',
duration: '0:00',
image: 'http://static.photos/technology/400x400/' + Math.floor(Math.random() * 100),
plays: '0',
file: file.name,
uploadedAt: new Date().toISOString()
};
document.getElementById('trackTitle').value = uploadedTrack.title;
}
function resetUpload() {
document.getElementById('uploadPrompt').classList.remove('hidden');
document.getElementById('uploadProgress').classList.add('hidden');
document.getElementById('uploadComplete').classList.add('hidden');
document.getElementById('audioInput').value = '';
document.getElementById('audioUpload').classList.remove('dragover', 'uploaded');
uploadedTrack = null;
}
// Drag & drop
const uploadZone = document.getElementById('audioUpload');
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(e => uploadZone.addEventListener(e, ev => { ev.preventDefault(); ev.stopPropagation(); }, false));
['dragenter', 'dragover'].forEach(e => uploadZone.addEventListener(e, () => uploadZone.classList.add('dragover'), false));
['dragleave', 'drop'].forEach(e => uploadZone.addEventListener(e, () => uploadZone.classList.remove('dragover'), false));
uploadZone.addEventListener('drop', e => {
if (e.dataTransfer.files && e.dataTransfer.files[0]) {
document.getElementById('audioInput').files = e.dataTransfer.files;
handleAudioUpload(document.getElementById('audioInput'));
}
}, false);
// ===== WAVEFORM =====
function renderWaveform(containerId, barCount) {
const c = document.getElementById(containerId);
if (!c) return;
c.innerHTML = '';
for (let i = 0; i < barCount; i++) {
const h = 20 + Math.random() * 80;
const bar = document.createElement('div');
bar.className = 'waveform-bar w-1 bg-cyan-400/40 rounded-full flex-shrink-0';
bar.style.height = h + '%';
c.appendChild(bar);
}
}
renderWaveform('uploadWaveform', 80);
renderWaveform('previewWaveform', 100);
// ===== MOOD TAGS =====
document.querySelectorAll('.mood-tag').forEach(tag => {
tag.addEventListener('click', function() {
const mood = this.dataset.mood;
if (this.classList.contains('selected')) {
this.classList.remove('selected');
selectedMoods = selectedMoods.filter(m => m !== mood);
} else if (selectedMoods.length < 5) {
this.classList.add('selected');
selectedMoods.push(mood);
}
});
});
// ===== MONETIZATION =====
function togglePaidUnlock() {
paidUnlockEnabled = !paidUnlockEnabled;
const toggle = document.getElementById('paidUnlockToggle');
const thumb = toggle.querySelector('.toggle-thumb');
const section = document.getElementById('pricingSection');
const freeInfo = document.getElementById('freeInfo');
if (paidUnlockEnabled) {
toggle.classList.remove('bg-white/10');
toggle.classList.add('bg-orange-500');
thumb.classList.remove('bg-gray-400');
thumb.classList.add('bg-white');
thumb.style.transform = 'translateX(1.25rem)';
toggle.setAttribute('aria-checked', 'true');
section.classList.remove('hidden');
freeInfo.classList.add('hidden');
updateRevenuePreview();
} else {
toggle.classList.add('bg-white/10');
toggle.classList.remove('bg-orange-500');
thumb.classList.add('bg-gray-400');
thumb.classList.remove('bg-white');
thumb.style.transform = 'translateX(0)';
toggle.setAttribute('aria-checked', 'false');
section.classList.add('hidden');
freeInfo.classList.remove('hidden');
}
}
function setPrice(price) {
document.getElementById('trackPrice').value = price.toFixed(2);
document.querySelectorAll('.price-btn').forEach(btn => {
const btnPrice = parseFloat(btn.textContent.replace('$', ''));
if (btnPrice === price) {
btn.className = 'price-btn flex-1 py-2.5 rounded-lg border border-orange-500/30 bg-orange-500/10 text-orange-400 text-sm font-semibold transition hover:bg-orange-500/20';
} else {
btn.className = 'price-btn flex-1 py-2.5 rounded-lg border border-white/10 bg-white/5 text-gray-400 text-sm font-medium transition hover:bg-white/10';
}
});
updateRevenuePreview();
}
document.getElementById('trackPrice')?.addEventListener('input', updateRevenuePreview);
function updateRevenuePreview() {
const price = parseFloat(document.getElementById('trackPrice')?.value || 0.50);
const yourCut = +(price * 0.85).toFixed(2);
const fee = +(price * 0.15).toFixed(2);
const revEl = document.getElementById('revPerSale');
const platEl = document.getElementById('revPlatform');
if (revEl) revEl.textContent = '$' + yourCut.toFixed(2);
if (platEl) platEl.textContent = '$' + fee.toFixed(2);
}
// ===== PREVIEW SETTINGS =====
function selectPreview(el, length) {
previewLength = length;
document.querySelectorAll('.preview-option').forEach(o => {
o.classList.remove('selected', 'bg-cyan-500/10');
o.classList.add('border-white/10');
o.style.borderColor = '';
});
el.classList.add('selected', 'bg-cyan-500/10');
el.style.borderColor = 'rgba(0,212,255,0.5)';
// Update preview visualization
const lockedZone = document.getElementById('previewLockedZone');
const unlockedZone = document.getElementById('previewUnlockedZone');
const endLabel = document.getElementById('previewEndLabel');
if (length === 'full') {
lockedZone.style.width = '0%';
unlockedZone.style.width = '100%';
endLabel.textContent = 'Full';
} else {
const pct = Math.min((parseInt(length) / 240) * 100, 50);
lockedZone.style.width = (100 - pct) + '%';
unlockedZone.style.width = pct + '%';
const mins = Math.floor(parseInt(length) / 60);
const secs = parseInt(length) % 60;
endLabel.textContent = mins + ':' + String(secs).padStart(2, '0');
}
}
function toggleAutoSnippet() {
autoSnippetEnabled = !autoSnippetEnabled;
const toggle = document.getElementById('autoSnippetToggle');
const thumb = toggle.querySelector('.toggle-thumb');
if (autoSnippetEnabled) {
toggle.classList.remove('bg-white/10');
toggle.classList.add('bg-cyan-500');
thumb.classList.add('bg-white');
thumb.classList.remove('bg-gray-400');
thumb.style.transform = 'translateX(1.25rem)';
toggle.setAttribute('aria-checked', 'true');
} else {
toggle.classList.add('bg-white/10');
toggle.classList.remove('bg-cyan-500');
thumb.classList.remove('bg-white');
thumb.classList.add('bg-gray-400');
thumb.style.transform = 'translateX(0)';
toggle.setAttribute('aria-checked', 'false');
}
}
// ===== ARTWORK =====
function handleArtworkUpload(input) {
if (!input.files || !input.files[0]) return;
const reader = new FileReader();
reader.onload = function(e) {
const preview = document.getElementById('artworkPreview');
preview.src = e.target.result;
preview.classList.remove('hidden');
document.getElementById('artworkPlaceholder').classList.add('hidden');
};
reader.readAsDataURL(input.files[0]);
}
// ===== VALIDATION =====
function validateField(field, errorId) {
const err = document.getElementById(errorId);
if (!field.value.trim()) {
err?.classList.remove('hidden');
field.classList.add('error');
return false;
}
err?.classList.add('hidden');
field.classList.remove('error');
return true;
}
function validateUsername() {
const val = document.getElementById('accountUsername')?.value.trim();
const err = document.getElementById('usernameError');
if (!val) { if(err){err.textContent='Username required';err.classList.remove('hidden');} return false; }
if (val.length < 3) { if(err){err.textContent='Min 3 characters';err.classList.remove('hidden');} return false; }
if (!/^[a-zA-Z0-9_]+$/.test(val)) { if(err){err.textContent='Letters, numbers, underscores only';err.classList.remove('hidden');} return false; }
try { const users = JSON.parse(localStorage.getItem('beatfridge_users')||'[]'); if(users.find(u=>u.username.toLowerCase()===val.toLowerCase())){if(err){err.textContent='Username taken';err.classList.remove('hidden');}return false;} } catch(e){}
if(err) err.classList.add('hidden');
return true;
}
function validateEmail() {
const val = document.getElementById('accountEmail')?.value.trim();
const err = document.getElementById('emailError');
if (!val) { if(err){err.textContent='Email required';err.classList.remove('hidden');} return false; }
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(val)) { if(err){err.textContent='Invalid email';err.classList.remove('hidden');} return false; }
try { const users = JSON.parse(localStorage.getItem('beatfridge_users')||'[]'); if(users.find(u=>u.email.toLowerCase()===val.toLowerCase())){if(err){err.textContent='Email already registered';err.classList.remove('hidden');}return false;} } catch(e){}
if(err) err.classList.add('hidden');
return true;
}
function checkPasswordStrength() {
const pw = document.getElementById('accountPassword')?.value || '';
const container = document.getElementById('strengthBars');
if (!container) return;
container.style.display = pw.length ? 'flex' : 'none';
let s = 0;
if (pw.length >= 8) s++;
if (/[a-z]/.test(pw) && /[A-Z]/.test(pw)) s++;
if (/[0-9]/.test(pw) || /[^a-zA-Z0-9]/.test(pw)) s++;
const colors = ['bg-red-500','bg-yellow-500','bg-green-500'];
const labels = ['Weak','Medium','Strong'];
for (let i = 1; i <= 3; i++) {
const bar = document.getElementById('str' + i);
if (bar) bar.className = 'h-1 flex-1 rounded-full ' + (i <= s ? colors[s-1] : 'bg-white/10');
}
}
// ===== BUILD SUMMARY =====
function buildSummary() {
const title = document.getElementById('trackTitle').value.trim() || 'Untitled';
const genre = document.getElementById('trackGenre').value || 'Not set';
const bpm = document.getElementById('trackBpm')?.value;
const price = paidUnlockEnabled ? ('$' + (document.getElementById('trackPrice')?.value || '0.50')) : 'Free';
const preview = previewLength === 'full' ? 'Full track' : previewLength + 's preview';
const artEl = document.getElementById('artworkPreview');
const hasArt = artEl && !artEl.classList.contains('hidden');
const imageSrc = hasArt ? artEl.src : (uploadedTrack?.image || 'http://static.photos/technology/400x400/99');
const moods = selectedMoods.length ? selectedMoods.map(m => `<span class="px-2 py-0.5 rounded bg-cyan-500/20 text-cyan-400 text-[10px] font-medium">${m}</span>`).join(' ') : '<span class="text-gray-600 text-xs">None</span>';
document.getElementById('publishSummary').innerHTML = `
<div class="flex items-center gap-4 p-4 rounded-xl bg-white/5 border border-white/10">
<div class="w-16 h-16 rounded-lg overflow-hidden flex-shrink-0">
<img src="${imageSrc}" class="w-full h-full object-cover">
</div>
<div class="flex-1 min-w-0">
<p class="font-semibold text-white truncate">${title}</p>
<p class="text-sm text-gray-500 capitalize">${genre}${bpm ? ' Β· ' + bpm + ' BPM' : ''}</p>
<div class="mt-1.5 flex flex-wrap gap-1">${moods}</div>
</div>
</div>
<div class="grid grid-cols-2 gap-3">
<div class="p-3 rounded-lg bg-white/5 border border-white/10 flex items-center gap-2.5">
<i data-lucide="${paidUnlockEnabled ? 'lock' : 'unlock'}" class="w-4 h-4 ${paidUnlockEnabled ? 'text-orange-400' : 'text-gray-500'}"></i>
<div>
<p class="text-xs text-gray-500">Price</p>
<p class="text-sm font-medium ${paidUnlockEnabled ? 'text-orange-400' : 'text-gray-400'}">${price}</p>
</div>
</div>
<div class="p-3 rounded-lg bg-white/5 border border-white/10 flex items-center gap-2.5">
<i data-lucide="play-circle" class="w-4 h-4 text-cyan-400"></i>
<div>
<p class="text-xs text-gray-500">Preview</p>
<p class="text-sm font-medium text-white">${preview}</p>
</div>
</div>
</div>
`;
lucide.createIcons();
}
// ===== PUBLISH =====
function publishTrack() {
// Validate
if (!uploadedTrack) { BF.showToast('Please upload an audio file'); return; }
if (!document.getElementById('trackTitle').value.trim()) { BF.showToast('Track title is required'); goToStep(2); return; }
if (!document.getElementById('trackGenre').value) { BF.showToast('Please select a genre'); goToStep(2); return; }
// Check if logged in
const isLoggedIn = BF.isLoggedIn();
if (!isLoggedIn) {
if (!validateUsername() || !validateEmail()) return;
const pw = document.getElementById('accountPassword')?.value;
if (!pw || pw.length < 8) {
const err = document.getElementById('passwordError');
if(err){err.textContent='Password must be 8+ characters';err.classList.remove('hidden');}
return;
}
// Create account
const result = BF.signUp({
username: document.getElementById('accountUsername').value.trim(),
email: document.getElementById('accountEmail').value.trim(),
password: pw,
role: 'producer',
displayName: document.getElementById('accountUsername').value.trim()
});
if (!result.success) { BF.showToast(result.error); return; }
}
// Set publish loading
const btn = document.getElementById('publishBtn');
btn.disabled = true;
btn.innerHTML = '<svg class="animate-spin w-5 h-5" viewBox="0 0 24 24" fill="none"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg> Publishing...';
btn.classList.add('opacity-75');
setTimeout(() => {
try {
const user = BF.getCurrentUser();
const price = paidUnlockEnabled ? parseFloat(document.getElementById('trackPrice')?.value || 0.50) : 0;
const trackData = {
id: 'track_' + Date.now(),
title: document.getElementById('trackTitle').value.trim(),
artist: user?.displayName || user?.username || 'Artist',
artistId: user?.id || 'unknown',
genre: document.getElementById('trackGenre').value,
bpm: document.getElementById('trackBpm')?.value || null,
moods: selectedMoods,
description: document.getElementById('trackDescription')?.value.trim() || '',
duration: uploadedTrack.duration || '3:30',
image: (document.getElementById('artworkPreview')?.src && !document.getElementById('artworkPreview').classList.contains('hidden'))
? document.getElementById('artworkPreview').src
: 'http://static.photos/technology/400x400/' + Math.floor(Math.random() * 100),
plays: '0',
date: 'Just now',
file: uploadedTrack.file,
previewLength: previewLength,
autoSnippet: autoSnippetEnabled,
published: true,
publishedAt: new Date().toISOString()
};
// Save track
let allTracks = JSON.parse(localStorage.getItem('beatfridge_tracks') || '[]');
allTracks.push(trackData);
localStorage.setItem('beatfridge_tracks', JSON.stringify(allTracks));
let userTracks = JSON.parse(localStorage.getItem('userTracks') || '[]');
userTracks.push(trackData);
localStorage.setItem('userTracks', JSON.stringify(userTracks));
// Set monetization if enabled
if (paidUnlockEnabled && price >= 0.50) {
BF.setTrackMonetization(trackData.id, {
isMonetized: true,
isLocked: true,
minimumPrice: price,
suggestedPrice: price,
superFanFree: true,
previewLength: previewLength === 'full' ? 0 : parseInt(previewLength)
});
}
// Set current track
localStorage.setItem('currentTrack', JSON.stringify(trackData));
BF.showToast('π Track published successfully!');
setTimeout(() => { window.location.href = 'track.html?id=' + trackData.id; }, 1200);
} catch (e) {
console.error('Publish error:', e);
btn.disabled = false;
btn.innerHTML = '<i data-lucide="rocket" class="w-6 h-6"></i> Publish & Start Earning';
btn.classList.remove('opacity-75');
lucide.createIcons();
const errEl = document.getElementById('publishError');
if(errEl){errEl.textContent=e.message||'Publish failed';errEl.classList.remove('hidden');}
}
}, 800);
}
// ===== UPGRADE =====
function upgradeToProducer() {
const user = BF.getCurrentUser();
if (!user || user.role !== 'fan') { BF.showSignInModal(); return; }
user.role = 'producer'; user.isArtist = true;
localStorage.setItem('beatfridge_current_user', JSON.stringify(user));
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);
}
// ===== ONBOARDING CHECK =====
(function checkOnboarding() {
try {
const user = BF.getCurrentUser();
if (user && (user.role === 'producer' || user.isArtist)) {
// Show motivational bar for all producers
const bar = document.getElementById('motivationalBar');
if (bar) {
bar.classList.remove('hidden');
document.getElementById('motivationalText').textContent = BF.getMotivationalPrompt();
}
// Show quick upload button
const quickBtn = document.getElementById('quickUploadBtn');
if (quickBtn) quickBtn.classList.remove('hidden');
// Show onboarding overlay for first-time creators
if (BF.isFirstTimeCreator() && !BF.isOnboardingDismissed()) {
const overlay = document.getElementById('onboardingOverlay');
if (overlay) {
overlay.classList.remove('hidden');
renderOnboardingSteps();
}
}
}
} catch(e) { console.error('Onboarding check error:', e); }
})();
function renderOnboardingSteps() {
const state = BF.getOnboardingState();
const container = document.getElementById('onboardingSteps');
if (!container) return;
container.innerHTML = state.steps.map(step => `
<div class="flex items-center gap-3 p-3 rounded-xl ${step.completed ? 'bg-green-500/10 border border-green-500/20' : 'bg-white/5 border border-white/10'}">
<div class="w-8 h-8 rounded-lg ${step.completed ? 'bg-green-500/20' : 'bg-white/5'} flex items-center justify-center flex-shrink-0">
${step.completed ? '<i data-lucide="check" class="w-4 h-4 text-green-400"></i>' : '<i data-lucide="' + step.icon + '" class="w-4 h-4 text-gray-500"></i>'}
</div>
<span class="text-sm ${step.completed ? 'text-green-400 line-through' : 'text-white'}">${step.label}</span>
${step.completed ? '<span class="ml-auto text-xs text-green-500 font-medium">Done β</span>' : '<span class="ml-auto text-xs text-gray-600 font-medium">${step.id === 'first_upload' ? 'β Start here' : 'Up next'}</span>'}
</div>
`).join('');
lucide.createIcons();
}
function dismissOnboardingAndStart() {
BF.dismissOnboarding();
document.getElementById('onboardingOverlay').classList.add('hidden');
startQuickUpload();
}
function refreshMotivation() {
const el = document.getElementById('motivationalText');
if (el) el.textContent = BF.getMotivationalPrompt();
}
// ===== QUICK UPLOAD MODE =====
let quickUploadMode = false;
function startQuickUpload() {
quickUploadMode = true;
// Skip to step 1 (upload file)
goToStep(1);
// Auto-focus the upload area
setTimeout(() => {
const zone = document.getElementById('audioUpload');
if (zone) zone.click();
}, 300);
}
// Override goToStep to handle quick upload mode
const _originalGoToStep = goToStep;
goToStep = function(step) {
if (quickUploadMode && step === 2 && uploadedTrack) {
// In quick mode, pre-fill title from filename and skip to publish
const titleInput = document.getElementById('trackTitle');
if (titleInput && !titleInput.value.trim()) {
titleInput.value = uploadedTrack.title || 'My Beat';
}
const genreSelect = document.getElementById('trackGenre');
if (genreSelect && !genreSelect.value) {
genreSelect.value = 'techno';
}
// Skip directly to step 5 (publish)
_originalGoToStep(5);
quickUploadMode = false;
return;
}
_originalGoToStep(step);
};
// Add motivational prompts to step headers
const stepMotivations = {
2: 'π΅ Great track! Add a title and genre to help listeners find it',
3: 'π° Set your price β creators earn 85% of every sale',
4: 'π§ Choose how much listeners can preview β the drop sells the track',
5: 'π Almost there! Hit publish and start earning'
};
const _origGoToStepBase = function(step) {
// Add motivational prompt to current step
document.querySelectorAll('.step-motivation').forEach(el => el.remove());
if (stepMotivations[step]) {
const section = document.getElementById('step' + step);
if (section) {
const prompt = document.createElement('div');
prompt.className = 'step-motivation mb-4 p-3 rounded-xl bg-orange-500/10 border border-orange-500/20 flex items-center gap-3';
prompt.innerHTML = '<i data-lucide="sparkles" class="w-4 h-4 text-orange-400 flex-shrink-0"></i><span class="text-sm text-orange-300">' + stepMotivations[step] + '</span>';
section.querySelector('.glass-panel')?.prepend(prompt);
lucide.createIcons();
}
}
};
// Patch the original goToStep to add motivational prompts
const __realGoToStep = goToStep;
goToStep = function(step) {
__realGoToStep(step);
_origGoToStepBase(step);
};
// Init
BF.syncPlayer();
lucide.createIcons();
</script>
</body>
</html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Upload Studio - 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; }
.glow-cyan { box-shadow: 0 0 20px rgba(0,212,255,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); }
.upload-zone {
border: 2px dashed rgba(255,255,255,0.15);
transition: all 0.3s ease;
position: relative;
overflow: hidden;
}
.upload-zone::before {
content: '';
position: absolute; inset: 0;
background: radial-gradient(circle at 50% 50%, rgba(0,212,255,0.03), transparent 70%);
opacity: 0; transition: opacity 0.3s;
}
.upload-zone:hover::before, .upload-zone.dragover::before { opacity: 1; }
.upload-zone:hover, .upload-zone.dragover {
border-color: rgba(0,212,255,0.5);
background: rgba(0,212,255,0.03);
}
.upload-zone.uploaded {
border-color: rgba(34,197,94,0.4);
border-style: solid;
background: rgba(34,197,94,0.03);
}
.step-dot { transition: all 0.4s cubic-bezier(0.4,0,0.2,1); }
.step-line { transition: background 0.4s ease; }
.mood-tag {
transition: all 0.2s ease;
cursor: pointer;
user-select: none;
}
.mood-tag:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.2); }
.mood-tag.selected {
background: rgba(0,212,255,0.15);
border-color: rgba(0,212,255,0.5);
color: #00d4ff;
}
.waveform-bar {
transition: height 0.15s ease;
}
.toggle-track {
transition: background 0.2s ease;
}
.toggle-thumb {
transition: transform 0.2s ease;
}
.preview-option {
transition: all 0.2s ease;
}
.preview-option.selected {
background: rgba(0,212,255,0.1);
border-color: rgba(0,212,255,0.5);
}
@keyframes pulse-ring {
0% { box-shadow: 0 0 0 0 rgba(0,212,255,0.3); }
70% { box-shadow: 0 0 0 8px rgba(0,212,255,0); }
100% { box-shadow: 0 0 0 0 rgba(0,212,255,0); }
}
.step-active-ring { animation: pulse-ring 2s ease infinite; }
.bf-input {
width: 100%; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
border-radius: 0.75rem; padding: 0.75rem 1rem; font-size: 0.875rem;
color: white; outline: none; transition: border-color 0.2s, background 0.2s;
}
.bf-input:focus { border-color: rgba(0,212,255,0.5); background: rgba(255,255,255,0.07); }
.bf-input::placeholder { color: #4b5563; }
.bf-input.error { border-color: rgba(239,68,68,0.5); }
.bf-select {
width: 100%; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
border-radius: 0.75rem; padding: 0.75rem 1rem; font-size: 0.875rem;