Onttraders commited on
Commit
747b5b2
·
verified ·
1 Parent(s): 15bf25b

🐳 13/04 - 19:07 - Add a new feature called Super Fan button UI.Do NOT add payments or subscriptions yet.1. BUTTONSOn artist profile pages:Add button: Become Super FanOn track pages:Add small button:

Browse files
Files changed (4) hide show
  1. app.js +123 -1
  2. artist.html +9 -1
  3. index.html +23 -13
  4. track.html +8 -0
app.js CHANGED
@@ -215,6 +215,10 @@ const BF = (() => {
215
  .sticky-player { bottom: 56px !important; }
216
  body { padding-bottom: 120px !important; }
217
  }
 
 
 
 
218
  `;
219
  document.head.appendChild(style);
220
  };
@@ -510,6 +514,123 @@ const BF = (() => {
510
  }
511
  };
512
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
513
  // ===== INIT =====
514
  const init = (activeTab) => {
515
  injectStyles();
@@ -529,6 +650,7 @@ const BF = (() => {
529
  searchTracks, searchArtists,
530
  init, showSignInModal, closeSignInModal, handleSignIn,
531
  showSignUpForm, showSignInForm, showChooseType, handleSignUp,
532
- adjustTopNav, showToast, syncPlayer, playTrack, togglePlay
 
533
  };
534
  })();
 
215
  .sticky-player { bottom: 56px !important; }
216
  body { padding-bottom: 120px !important; }
217
  }
218
+ .bf-locked-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(3px); display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: inherit; z-index: 10; pointer-events: none; }
219
+ .bf-superfan-badge { background: linear-gradient(135deg, #f97316, #ef4444); color: white; font-size: 10px; font-weight: 600; padding: 3px 10px; border-radius: 9999px; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
220
+ .bf-superfan-btn { transition: all 0.2s ease; }
221
+ .bf-superfan-btn:hover { transform: scale(1.02); }
222
  `;
223
  document.head.appendChild(style);
224
  };
 
514
  }
515
  };
516
 
517
+ // ===== SUPER FAN UI =====
518
+ const showSuperFanModal = (artistName, artistImage) => {
519
+ if (document.getElementById('bfSuperFanModal')) return;
520
+ const modal = document.createElement('div');
521
+ modal.id = 'bfSuperFanModal';
522
+ modal.innerHTML = `
523
+ <div class="bf-signin-overlay" onclick="BF.closeSuperFanModal()"></div>
524
+ <div class="bf-signin-modal">
525
+ <div class="bf-signin-card" style="max-width:420px">
526
+ <div class="flex items-center justify-between mb-6">
527
+ <h3 class="text-xl font-bold text-white">Become a Super Fan</h3>
528
+ <button onclick="BF.closeSuperFanModal()" class="text-gray-400 hover:text-white transition"><i data-lucide="x" class="w-6 h-6"></i></button>
529
+ </div>
530
+ <div class="flex items-center gap-4 mb-6">
531
+ <div class="w-16 h-16 rounded-full overflow-hidden border-2 border-orange-500/50 flex-shrink-0">
532
+ <img src="${artistImage}" class="w-full h-full object-cover">
533
+ </div>
534
+ <div class="min-w-0">
535
+ <p class="font-semibold text-white text-lg truncate">${artistName}</p>
536
+ <p class="text-sm text-gray-400">Support this artist and unlock exclusive content</p>
537
+ </div>
538
+ </div>
539
+ <div class="p-4 rounded-xl bg-gradient-to-r from-orange-500/10 to-red-500/10 border border-orange-500/20 mb-6">
540
+ <div class="flex items-center justify-between mb-4">
541
+ <span class="text-sm text-gray-300">Monthly subscription</span>
542
+ <span class="text-xl font-bold text-orange-400">$25<span class="text-sm text-gray-500 font-normal">/mo</span></span>
543
+ </div>
544
+ <div class="space-y-2.5">
545
+ <div class="flex items-center gap-2 text-sm text-gray-300">
546
+ <i data-lucide="unlock" class="w-4 h-4 text-orange-400 flex-shrink-0"></i>
547
+ <span>Early access to new music</span>
548
+ </div>
549
+ <div class="flex items-center gap-2 text-sm text-gray-300">
550
+ <i data-lucide="music" class="w-4 h-4 text-orange-400 flex-shrink-0"></i>
551
+ <span>Exclusive tracks & content</span>
552
+ </div>
553
+ <div class="flex items-center gap-2 text-sm text-gray-300">
554
+ <i data-lucide="headphones" class="w-4 h-4 text-orange-400 flex-shrink-0"></i>
555
+ <span>High-quality audio</span>
556
+ </div>
557
+ <div class="flex items-center gap-2 text-sm text-gray-300">
558
+ <i data-lucide="heart" class="w-4 h-4 text-orange-400 flex-shrink-0"></i>
559
+ <span>Direct support for the creator</span>
560
+ </div>
561
+ </div>
562
+ </div>
563
+ <button onclick="BF.toggleSuperFanState('${artistName}')" class="w-full py-3 bg-gradient-to-r from-orange-500 to-red-500 hover:from-orange-400 hover:to-red-400 text-white font-semibold rounded-xl transition flex items-center justify-center gap-2 bf-superfan-btn" style="box-shadow: 0 0 20px rgba(249,115,22,0.3)">
564
+ <i data-lucide="zap" class="w-5 h-5"></i>
565
+ Continue
566
+ </button>
567
+ <p class="text-xs text-gray-600 text-center mt-3">Recurring monthly \u2022 Cancel anytime</p>
568
+ </div>
569
+ </div>
570
+ `;
571
+ document.body.appendChild(modal);
572
+ if (window.lucide) lucide.createIcons();
573
+ };
574
+
575
+ const closeSuperFanModal = () => {
576
+ document.getElementById('bfSuperFanModal')?.remove();
577
+ };
578
+
579
+ const toggleSuperFanState = (artistName) => {
580
+ const key = 'bf_superfan';
581
+ let subs = [];
582
+ try { subs = JSON.parse(localStorage.getItem(key) || '[]'); } catch { subs = []; }
583
+ const slug = artistName.toLowerCase().replace(/\s+/g, '-');
584
+ if (!subs.includes(slug)) {
585
+ subs.push(slug);
586
+ } else {
587
+ subs = subs.filter(s => s !== slug);
588
+ }
589
+ localStorage.setItem(key, JSON.stringify(subs));
590
+ closeSuperFanModal();
591
+ const isActive = subs.includes(slug);
592
+ showToast(isActive ? 'You are now a Super Fan of ' + artistName + ' \ud83c\udfa7' : 'Super Fan deactivated for ' + artistName);
593
+ updateSuperFanButtons();
594
+ if (window.lucide) lucide.createIcons();
595
+ };
596
+
597
+ const isSuperFanOf = (artistName) => {
598
+ try {
599
+ const subs = JSON.parse(localStorage.getItem('bf_superfan') || '[]');
600
+ return subs.includes(artistName.toLowerCase().replace(/\s+/g, '-'));
601
+ } catch { return false; }
602
+ };
603
+
604
+ const updateSuperFanButtons = () => {
605
+ document.querySelectorAll('[data-superfan-artist]').forEach(btn => {
606
+ const artist = btn.getAttribute('data-superfan-artist');
607
+ const isActive = isSuperFanOf(artist);
608
+ const isSmall = btn.getAttribute('data-superfan-size') === 'small';
609
+ if (isActive) {
610
+ if (isSmall) {
611
+ btn.innerHTML = '<i data-lucide="check-circle" class="w-3.5 h-3.5"></i><span>Super Fan Active \u2713</span>';
612
+ } else {
613
+ btn.innerHTML = '<i data-lucide="check-circle" class="w-4 h-4"></i><span>Super Fan Active \u2713</span>';
614
+ }
615
+ btn.className = btn.className.replace(/bg-gradient-to-r from-orange-500 to-red-500 hover:from-orange-400 hover:to-red-400 text-white/g, '');
616
+ btn.classList.remove('bg-gradient-to-r', 'from-orange-500', 'to-red-500', 'hover:from-orange-400', 'hover:to-red-400', 'text-white', 'bf-superfan-btn');
617
+ btn.classList.add('bg-green-500/20', 'text-green-400', 'border', 'border-green-500/30');
618
+ if (!isSmall) btn.style.boxShadow = '0 0 20px rgba(34,197,94,0.2)';
619
+ else btn.style.boxShadow = '';
620
+ } else {
621
+ if (isSmall) {
622
+ btn.innerHTML = '<i data-lucide="zap" class="w-3.5 h-3.5"></i><span>Super Fan</span>';
623
+ } else {
624
+ btn.innerHTML = '<i data-lucide="zap" class="w-4 h-4"></i><span>Become Super Fan</span>';
625
+ }
626
+ btn.classList.remove('bg-green-500/20', 'text-green-400', 'border', 'border-green-500/30');
627
+ btn.classList.add('bg-gradient-to-r', 'from-orange-500', 'to-red-500', 'hover:from-orange-400', 'hover:to-red-400', 'text-white', 'bf-superfan-btn');
628
+ if (!isSmall) btn.style.boxShadow = '0 0 20px rgba(249,115,22,0.3)';
629
+ else btn.style.boxShadow = '';
630
+ }
631
+ });
632
+ };
633
+
634
  // ===== INIT =====
635
  const init = (activeTab) => {
636
  injectStyles();
 
650
  searchTracks, searchArtists,
651
  init, showSignInModal, closeSignInModal, handleSignIn,
652
  showSignUpForm, showSignInForm, showChooseType, handleSignUp,
653
+ adjustTopNav, showToast, syncPlayer, playTrack, togglePlay,
654
+ showSuperFanModal, closeSuperFanModal, toggleSuperFanState, isSuperFanOf, updateSuperFanButtons
655
  };
656
  })();
artist.html CHANGED
@@ -276,6 +276,10 @@
276
  <i data-lucide="heart-handshake" class="w-4 h-4"></i>
277
  <span>Support</span>
278
  </button>
 
 
 
 
279
  <button class="px-4 py-3 bg-white/10 hover:bg-white/20 border border-white/20 font-medium rounded-full transition flex items-center gap-2">
280
  <i data-lucide="message-circle" class="w-4 h-4"></i>
281
  <span class="hidden sm:inline">Message</span>
@@ -689,7 +693,7 @@
689
  ${track.isExclusive ? `
690
  <span class="px-2 py-0.5 rounded text-xs bg-gradient-to-r from-orange-500 to-red-500 text-white font-medium flex items-center gap-1">
691
  <i data-lucide="crown" class="w-3 h-3"></i>
692
- ${isLocked ? 'LOCKED' : 'EXCLUSIVE'}
693
  </span>
694
  ` : ''}
695
  </div>
@@ -1123,6 +1127,10 @@
1123
  renderTrackList();
1124
  renderPopularGrid();
1125
  lucide.createIcons();
 
 
 
 
1126
  </script>
1127
  </body>
1128
  </html>
 
276
  <i data-lucide="heart-handshake" class="w-4 h-4"></i>
277
  <span>Support</span>
278
  </button>
279
+ <button data-superfan-artist="Aurora Void" class="px-6 py-3 bg-gradient-to-r from-orange-500 to-red-500 hover:from-orange-400 hover:to-red-400 text-white font-semibold rounded-full transition glow-orange flex items-center justify-center gap-2 bf-superfan-btn" style="box-shadow: 0 0 20px rgba(249,115,22,0.3)" onclick="BF.showSuperFanModal('Aurora Void', 'http://static.photos/people/200x200/77')">
280
+ <i data-lucide="zap" class="w-4 h-4"></i>
281
+ <span>Become Super Fan</span>
282
+ </button>
283
  <button class="px-4 py-3 bg-white/10 hover:bg-white/20 border border-white/20 font-medium rounded-full transition flex items-center gap-2">
284
  <i data-lucide="message-circle" class="w-4 h-4"></i>
285
  <span class="hidden sm:inline">Message</span>
 
693
  ${track.isExclusive ? `
694
  <span class="px-2 py-0.5 rounded text-xs bg-gradient-to-r from-orange-500 to-red-500 text-white font-medium flex items-center gap-1">
695
  <i data-lucide="crown" class="w-3 h-3"></i>
696
+ ${isLocked ? '\u{1F512} Super Fan Only' : 'EXCLUSIVE'}
697
  </span>
698
  ` : ''}
699
  </div>
 
1127
  renderTrackList();
1128
  renderPopularGrid();
1129
  lucide.createIcons();
1130
+
1131
+ // Check Super Fan state
1132
+ BF.updateSuperFanButtons();
1133
+ if (window.lucide) lucide.createIcons();
1134
  </script>
1135
  </body>
1136
  </html>
index.html CHANGED
@@ -173,32 +173,42 @@
173
 
174
  // Trending Row
175
  const trending = BF.getTrendingTracks().slice(0, 8);
176
- document.getElementById('trendingRow').innerHTML = trending.map(track => `
177
- <div class="track-card flex-shrink-0 w-36 sm:w-44 glass-panel rounded-xl p-3 group cursor-pointer" onclick="BF.playTrack(${JSON.stringify(track).replace(/"/g, '&quot;')})">
 
 
 
 
178
  <div class="relative aspect-square rounded-lg overflow-hidden mb-3">
179
  <img src="${track.image}" class="w-full h-full object-cover transition duration-500 group-hover:scale-110" loading="lazy">
180
  <div class="play-btn-overlay absolute inset-0 bg-black/50 flex items-center justify-center">
181
  <div class="w-10 h-10 rounded-full bg-cyan-500 text-black flex items-center justify-center glow-cyan"><i data-lucide="play" class="w-5 h-5 fill-current ml-0.5"></i></div>
182
  </div>
 
183
  </div>
184
- <h3 class="text-sm font-semibold text-white truncate group-hover:text-cyan-400 transition">${track.title}</h3>
185
- <p class="text-xs text-gray-500 truncate">${track.artist}</p>
186
  </div>
187
- `).join('');
188
 
189
  // Fresh Uploads List
190
  const fresh = BF.getAllTracks().slice(0, 6);
191
- document.getElementById('freshList').innerHTML = fresh.map((track, i) => `
192
- <div class="flex items-center gap-3 p-3 rounded-xl hover:bg-white/5 transition cursor-pointer group" onclick="BF.playTrack(${JSON.stringify(track).replace(/"/g, '&quot;')})">
 
 
 
 
193
  <span class="text-sm text-gray-600 w-5 text-right">${i + 1}</span>
194
  <div class="w-12 h-12 rounded-lg overflow-hidden flex-shrink-0 relative">
195
- <img src="${track.image}" class="w-full h-full object-cover" loading="lazy">
196
- <div class="absolute inset-0 bg-black/50 flex items-center justify-center opacity-0 group-hover:opacity-100 transition">
197
- <i data-lucide="play" class="w-4 h-4 text-cyan-400 fill-current"></i>
198
- </div>
199
  </div>
200
  <div class="flex-1 min-w-0">
201
- <h4 class="text-sm font-medium text-white truncate group-hover:text-cyan-400 transition">${track.title}</h4>
 
 
 
202
  <p class="text-xs text-gray-500 truncate">${track.artist}</p>
203
  </div>
204
  <div class="hidden sm:flex items-center gap-3 text-xs text-gray-500">
@@ -206,7 +216,7 @@
206
  <span>${track.duration}</span>
207
  </div>
208
  </div>
209
- `).join('');
210
 
211
  // Artist Row
212
  document.getElementById('artistRow').innerHTML = BF.getArtists().map(artist => `
 
173
 
174
  // Trending Row
175
  const trending = BF.getTrendingTracks().slice(0, 8);
176
+ document.getElementById('trendingRow').innerHTML = trending.map(track => {
177
+ const isSuperFanLocked = [2, 4, 6].includes(track.id);
178
+ const isFanActive = BF.isSuperFanOf(track.artist);
179
+ const locked = isSuperFanLocked && !isFanActive;
180
+ return `
181
+ <div class="track-card flex-shrink-0 w-36 sm:w-44 glass-panel rounded-xl p-3 group cursor-pointer relative ${locked ? 'opacity-80' : ''}" onclick="${locked ? 'BF.showSuperFanModal(\"'+track.artist+'\", \"'+track.image+'\")' : 'BF.playTrack('+JSON.stringify(track).replace(/"/g, '&quot;')+')'}">
182
  <div class="relative aspect-square rounded-lg overflow-hidden mb-3">
183
  <img src="${track.image}" class="w-full h-full object-cover transition duration-500 group-hover:scale-110" loading="lazy">
184
  <div class="play-btn-overlay absolute inset-0 bg-black/50 flex items-center justify-center">
185
  <div class="w-10 h-10 rounded-full bg-cyan-500 text-black flex items-center justify-center glow-cyan"><i data-lucide="play" class="w-5 h-5 fill-current ml-0.5"></i></div>
186
  </div>
187
+ ${locked ? '<div class="bf-locked-overlay"><span class="bf-superfan-badge"><i data-lucide="lock" class="w-3 h-3"></i> Super Fan Only</span><p class="text-[9px] text-gray-400 mt-1">Unlock</p></div>' : ''}
188
  </div>
189
+ <h3 class="text-sm font-semibold text-white truncate group-hover:text-cyan-400 transition ${locked ? 'opacity-60' : ''}">${track.title}</h3>
190
+ <p class="text-xs text-gray-500 truncate ${locked ? 'opacity-60' : ''}">${track.artist}</p>
191
  </div>
192
+ `}).join('');
193
 
194
  // Fresh Uploads List
195
  const fresh = BF.getAllTracks().slice(0, 6);
196
+ document.getElementById('freshList').innerHTML = fresh.map((track, i) => {
197
+ const isSuperFanLocked = [2, 4].includes(track.id);
198
+ const isFanActive = BF.isSuperFanOf(track.artist);
199
+ const locked = isSuperFanLocked && !isFanActive;
200
+ return `
201
+ <div class="flex items-center gap-3 p-3 rounded-xl hover:bg-white/5 transition cursor-pointer group ${locked ? 'opacity-70' : ''}" onclick="${locked ? 'BF.showSuperFanModal(\"'+track.artist+'\", \"'+track.image+'\")' : 'BF.playTrack('+JSON.stringify(track).replace(/"/g, '&quot;')+')'}">
202
  <span class="text-sm text-gray-600 w-5 text-right">${i + 1}</span>
203
  <div class="w-12 h-12 rounded-lg overflow-hidden flex-shrink-0 relative">
204
+ <img src="${track.image}" class="w-full h-full object-cover ${locked ? 'blur-sm' : ''}" loading="lazy">
205
+ ${locked ? '<div class="absolute inset-0 bg-black/50 flex items-center justify-center"><i data-lucide="lock" class="w-4 h-4 text-orange-400"></i></div>' : '<div class="absolute inset-0 bg-black/50 flex items-center justify-center opacity-0 group-hover:opacity-100 transition"><i data-lucide="play" class="w-4 h-4 text-cyan-400 fill-current"></i></div>'}
 
 
206
  </div>
207
  <div class="flex-1 min-w-0">
208
+ <div class="flex items-center gap-2">
209
+ <h4 class="text-sm font-medium text-white truncate group-hover:text-cyan-400 transition">${track.title}</h4>
210
+ ${locked ? '<span class="bf-superfan-badge text-[9px]"><i data-lucide="lock" class="w-2.5 h-2.5"></i>Super Fan Only</span>' : ''}
211
+ </div>
212
  <p class="text-xs text-gray-500 truncate">${track.artist}</p>
213
  </div>
214
  <div class="hidden sm:flex items-center gap-3 text-xs text-gray-500">
 
216
  <span>${track.duration}</span>
217
  </div>
218
  </div>
219
+ `}).join('');
220
 
221
  // Artist Row
222
  document.getElementById('artistRow').innerHTML = BF.getArtists().map(artist => `
track.html CHANGED
@@ -265,6 +265,10 @@
265
  <i data-lucide="heart-handshake" class="w-4 h-4"></i>
266
  Support
267
  </button>
 
 
 
 
268
  </div>
269
 
270
  <!-- Waveform Player -->
@@ -960,6 +964,10 @@
960
  }
961
  }
962
 
 
 
 
 
963
  function toggleLike(btn) {
964
  const isLiked = likedTracks.find(t => t.id === currentTrack.id);
965
  const icon = btn.querySelector('i');
 
265
  <i data-lucide="heart-handshake" class="w-4 h-4"></i>
266
  Support
267
  </button>
268
+ <button data-superfan-artist="Aurora Void" data-superfan-size="small" class="px-3 py-1.5 bg-gradient-to-r from-orange-500 to-red-500 hover:from-orange-400 hover:to-red-400 text-white rounded-full text-xs font-medium transition flex items-center gap-1 bf-superfan-btn" style="box-shadow: 0 0 15px rgba(249,115,22,0.2)" onclick="BF.showSuperFanModal('Aurora Void', 'http://static.photos/people/200x200/77')">
269
+ <i data-lucide="zap" class="w-3.5 h-3.5"></i>
270
+ Super Fan
271
+ </button>
272
  </div>
273
 
274
  <!-- Waveform Player -->
 
964
  }
965
  }
966
 
967
+ // Check Super Fan state
968
+ BF.updateSuperFanButtons();
969
+ if (window.lucide) lucide.createIcons();
970
+
971
  function toggleLike(btn) {
972
  const isLiked = likedTracks.find(t => t.id === currentTrack.id);
973
  const icon = btn.querySelector('i');