Spaces:
Running
Running
File size: 63,083 Bytes
c887af6 305204b c887af6 32d03a3 c887af6 305204b c887af6 305204b c887af6 9a6a0c8 c887af6 32d03a3 c887af6 32d03a3 f5d33cd 32d03a3 f5d33cd 32d03a3 c887af6 9a6a0c8 32d03a3 9a6a0c8 32d03a3 9a6a0c8 32d03a3 9a6a0c8 119fb69 9a6a0c8 c887af6 32d03a3 631d5ed c887af6 631d5ed c887af6 631d5ed c887af6 631d5ed c887af6 631d5ed 9a6a0c8 119fb69 c887af6 994da7d da7c69a c887af6 da7c69a c887af6 9a6a0c8 c887af6 119fb69 c887af6 9a6a0c8 c887af6 9a6a0c8 119fb69 9a6a0c8 c887af6 119fb69 c887af6 631d5ed c887af6 631d5ed c887af6 119fb69 c887af6 818ce84 14f1f7e 818ce84 c887af6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Library - BeatFridge Music Platform</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;
height: 8px;
}
::-webkit-scrollbar-track {
background: #0a0a0a;
}
::-webkit-scrollbar-thumb {
background: #2d2d2d;
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: #3d3d3d;
}
.glass {
background: rgba(20, 20, 20, 0.6);
backdrop-filter: blur(12px);
-webkit-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);
-webkit-backdrop-filter: blur(16px);
border: 1px solid rgba(255, 255, 255, 0.05);
}
.neon-gradient {
background: linear-gradient(135deg, #00d4ff 0%, #7c3aed 50%, #f97316 100%);
}
.neon-text {
background: linear-gradient(135deg, #00d4ff 0%, #7c3aed 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
@keyframes fade-in {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in {
animation: fade-in 0.3s ease;
}
.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);
}
.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);
}
.tab-active {
border-bottom: 2px solid #00d4ff;
color: #00d4ff;
}
.playlist-card:hover .playlist-overlay {
opacity: 1;
}
</style>
</head>
<body class="bg-black text-white overflow-x-hidden pb-24 page-transition">
<!-- 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-6 h-16 flex items-center justify-between">
<div class="flex items-center gap-8">
<a href="index.html" class="flex items-center gap-2 cursor-pointer hover:opacity-80 transition">
<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-xl font-bold tracking-tight">BeatFridge</span>
</a>
<div class="hidden md:flex items-center gap-6 text-sm font-medium text-gray-400">
<a href="index.html" class="hover:text-cyan-400 transition">Home</a>
<a href="discover.html" class="hover:text-cyan-400 transition">Discover</a>
<a href="library.html" class="text-cyan-400">Library</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="analytics.html" class="hover:text-orange-400 transition flex items-center gap-1 text-gray-400">
<i data-lucide="bar-chart-2" class="w-4 h-4"></i>
Analytics
</a>
</div>
</div>
<div class="flex items-center gap-4">
<div class="relative hidden sm:block">
<input type="text" placeholder="Search your library..."
class="w-64 bg-white/5 border border-white/10 rounded-full px-4 py-2 pl-10 text-sm focus:outline-none focus:border-cyan-500/50 focus:bg-white/10 transition">
<i data-lucide="search" class="w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"></i>
</div>
<button id="mobileMenuBtn" class="md:hidden w-10 h-10 rounded-full bg-white/5 border border-white/10 flex items-center justify-center hover:bg-white/10 transition" onclick="toggleMobileMenu()">
<i data-lucide="menu" class="w-5 h-5 text-gray-300"></i>
</button>
<button class="w-10 h-10 rounded-full bg-white/5 border border-white/10 flex items-center justify-center hover:bg-white/10 transition relative">
<i data-lucide="bell" class="w-5 h-5 text-gray-300"></i>
<span class="absolute top-2 right-2 w-2 h-2 bg-orange-500 rounded-full"></span>
</button>
<div class="w-10 h-10 rounded-full bg-gradient-to-br from-cyan-400 to-purple-600 cursor-pointer hover:scale-105 transition avatar-ring">
<img src="http://static.photos/people/200x200/42" alt="Profile" class="w-full h-full rounded-full object-cover">
</div>
</div>
</div>
</nav>
<!-- Mobile Nav Overlay -->
<div id="mobileNavOverlay" class="mobile-nav-overlay" onclick="closeMobileMenu()"></div>
<div id="mobileNavPanel" class="mobile-nav-panel">
<div class="flex items-center justify-between mb-8">
<a href="index.html" class="flex items-center gap-2 hover:opacity-80 transition">
<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-xl font-bold">BeatFridge</span>
</a>
<button onclick="closeMobileMenu()" class="w-10 h-10 rounded-full bg-white/5 border border-white/10 flex items-center justify-center hover:bg-white/10 transition">
<i data-lucide="x" class="w-5 h-5"></i>
</button>
</div>
<nav class="space-y-1">
<a href="index.html" class="flex items-center gap-3 px-4 py-3 rounded-xl hover:bg-white/5 transition text-gray-300 hover:text-white">
<i data-lucide="home" class="w-5 h-5"></i> Home
</a>
<a href="discover.html" class="flex items-center gap-3 px-4 py-3 rounded-xl hover:bg-white/5 transition text-gray-300 hover:text-white">
<i data-lucide="compass" class="w-5 h-5"></i> Discover
</a>
<a href="library.html" class="flex items-center gap-3 px-4 py-3 rounded-xl bg-white/5 text-cyan-400 font-medium">
<i data-lucide="library" class="w-5 h-5"></i> Library
</a>
<a href="upload.html" class="flex items-center gap-3 px-4 py-3 rounded-xl hover:bg-white/5 transition text-gray-300 hover:text-white">
<i data-lucide="upload-cloud" class="w-5 h-5"></i> Upload
</a>
<a href="analytics.html" class="flex items-center gap-3 px-4 py-3 rounded-xl hover:bg-white/5 transition text-gray-300 hover:text-white">
<i data-lucide="bar-chart-2" class="w-5 h-5"></i> Analytics
</a>
</nav>
</div>
<!-- Main Layout -->
<div class="max-w-[1600px] mx-auto pt-20 pb-12 px-6 min-h-screen">
<!-- Header -->
<div class="mb-8">
<h1 class="text-3xl font-bold mb-2 neon-text">Your Library</h1>
<p class="text-gray-400">All your favorite tracks, playlists, and history</p>
</div>
<!-- Wallet Summary -->
<div class="glass-panel rounded-2xl p-4 mb-6 flex flex-wrap items-center justify-between gap-3">
<div class="flex items-center gap-4">
<div class="w-10 h-10 rounded-full bg-green-500/20 flex items-center justify-center">
<i data-lucide="wallet" class="w-5 h-5 text-green-400"></i>
</div>
<div>
<p class="text-sm text-gray-400">Wallet Balance</p>
<p class="text-xl font-bold text-white" id="walletBalance">€50.00</p>
</div>
</div>
<div class="flex flex-wrap items-center gap-3 md:gap-4">
<div class="text-right">
<p class="text-sm text-gray-400">Total Supported</p>
<p class="text-sm font-semibold text-cyan-400" id="totalSupported">€0.00</p>
</div>
<div class="text-right border-l border-white/10 pl-3 md:pl-4">
<p class="text-sm text-gray-400">Membership</p>
<p class="text-sm font-semibold text-orange-400" id="membershipStatus">Free</p>
</div>
<div id="sfWalletBadge" class="hidden text-right border-l border-white/10 pl-3 md:pl-4">
<p class="text-sm text-gray-400">Super Fan</p>
<p class="text-sm font-semibold text-green-400 flex items-center gap-1 justify-end"><i data-lucide="zap" class="w-3.5 h-3.5"></i><span id="sfWalletCount">0</span> active</p>
</div>
<button class="px-4 py-2 bg-green-500/20 hover:bg-green-500/30 text-green-400 rounded-lg text-sm font-medium transition" onclick="topUpWallet()">
Top Up
</button>
</div>
</div>
<!-- Pro Banner -->
<div id="proBanner" class="glass-panel rounded-2xl p-6 mb-6 bg-gradient-to-r from-orange-500/20 to-purple-500/20 border border-orange-500/30 hidden">
<div class="flex items-center justify-between">
<div>
<h3 class="font-semibold text-white mb-1">Upgrade to Pro</h3>
<p class="text-sm text-gray-400">Unlock unlimited uploads and monetization features</p>
</div>
<button class="px-6 py-2 bg-orange-500 hover:bg-orange-400 text-black font-semibold rounded-lg transition glow-orange" onclick="showProUpgrade()">
Upgrade Now
</button>
</div>
</div>
<!-- Tabs -->
<div class="flex items-center gap-4 md:gap-8 border-b border-white/10 mb-8 mobile-tabs-scroll">
<button class="px-4 py-3 text-sm font-medium tab-active" onclick="switchTab('liked', event)">
<i data-lucide="heart" class="w-4 h-4 inline mr-2"></i>
Liked Tracks
<span class="ml-2 text-xs bg-white/10 px-2 py-0.5 rounded-full" id="likedCount">0</span>
</button>
<button class="px-4 py-3 text-sm font-medium text-gray-400 hover:text-white transition" onclick="switchTab('playlists', event)">
<i data-lucide="list-music" class="w-4 h-4 inline mr-2"></i>
Playlists
<span class="ml-2 text-xs bg-white/10 px-2 py-0.5 rounded-full" id="playlistCount">0</span>
</button>
<button class="px-4 py-3 text-sm font-medium text-gray-400 hover:text-white transition" onclick="switchTab('recent', event)">
<i data-lucide="clock" class="w-4 h-4 inline mr-2"></i>
Recently Played
<span class="ml-2 text-xs bg-white/10 px-2 py-0.5 rounded-full" id="recentCount">0</span>
</button>
<button class="px-4 py-3 text-sm font-medium text-gray-400 hover:text-white transition" onclick="switchTab('following', event)">
<i data-lucide="users" class="w-4 h-4 inline mr-2"></i>
Following
<span class="ml-2 text-xs bg-white/10 px-2 py-0.5 rounded-full" id="followingCount">0</span>
</button>
<button class="px-4 py-3 text-sm font-medium text-gray-400 hover:text-white transition" onclick="switchTab('transactions', event)">
<i data-lucide="receipt" class="w-4 h-4 inline mr-2"></i>
Transactions
<span class="ml-2 text-xs bg-white/10 px-2 py-0.5 rounded-full" id="transactionCount">0</span>
</button>
<button class="px-4 py-3 text-sm font-medium text-gray-400 hover:text-white transition" onclick="switchTab('superfan', event)" id="sfTabBtn">
<i data-lucide="zap" class="w-4 h-4 inline mr-2"></i>
Super Fan
<span class="ml-2 text-xs bg-orange-500/20 text-orange-400 px-2 py-0.5 rounded-full" id="sfCount">0</span>
</button>
</div>
<!-- Content Area -->
<div id="contentArea">
<!-- Dynamic content loaded here -->
</div>
</div>
<!-- Create Playlist Modal -->
<div id="createPlaylistModal" class="fixed inset-0 z-50 hidden">
<div class="absolute inset-0 bg-black/80 backdrop-blur-sm" onclick="closeModal()"></div>
<div class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-full max-w-md">
<div class="glass-panel rounded-2xl p-6">
<h3 class="text-xl font-bold mb-4">Create Playlist</h3>
<div class="space-y-4">
<div>
<label class="block text-xs font-medium text-gray-500 uppercase tracking-wider mb-2">Name</label>
<input type="text" id="playlistName" placeholder="My Awesome Playlist"
class="w-full bg-white/5 border border-white/10 rounded-xl px-4 py-3 text-sm focus:outline-none focus:border-cyan-500/50 transition text-white">
</div>
<div>
<label class="block text-xs font-medium text-gray-500 uppercase tracking-wider mb-2">Description (optional)</label>
<textarea id="playlistDesc" placeholder="What's this playlist about?"
class="w-full bg-white/5 border border-white/10 rounded-xl px-4 py-3 text-sm focus:outline-none focus:border-cyan-500/50 transition text-white h-24 resize-none"></textarea>
</div>
<div class="flex gap-3 pt-4">
<button class="flex-1 px-4 py-3 bg-white/10 hover:bg-white/20 border border-white/20 rounded-xl text-sm font-medium transition" onclick="closeModal()">
Cancel
</button>
<button class="flex-1 px-4 py-3 bg-cyan-500 hover:bg-cyan-400 text-black font-semibold rounded-xl transition glow-cyan" onclick="createPlaylist()">
Create
</button>
</div>
</div>
</div>
</div>
</div>
<!-- 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-64 flex-shrink-0">
<div class="w-14 h-14 rounded-lg overflow-hidden relative group cursor-pointer">
<img id="playerArt" src="http://static.photos/technology/200x200/1" class="w-full h-full object-cover">
<div class="absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition flex items-center justify-center">
<i data-lucide="maximize-2" class="w-5 h-5"></i>
</div>
</div>
<div class="min-w-0 flex-1">
<p id="playerTitle" class="text-sm font-medium text-white truncate cursor-pointer hover:text-cyan-400 transition" onclick="window.location.href='track.html'">Midnight Synthesis</p>
<p id="playerArtist" class="text-xs text-gray-400 truncate cursor-pointer hover:text-cyan-400 transition" onclick="window.location.href='artist.html'">Aurora Void</p>
</div>
<button class="text-gray-400 hover:text-cyan-400 transition" onclick="toggleLikeCurrent()">
<i data-lucide="heart" class="w-5 h-5" id="playerLike"></i>
</button>
</div>
<div class="flex-1 flex flex-col items-center max-w-2xl mx-auto">
<div class="flex items-center gap-6 mb-2">
<button class="text-gray-400 hover:text-white transition" onclick="toggleShuffle(this)">
<i data-lucide="shuffle" class="w-4 h-4"></i>
</button>
<button class="text-gray-300 hover:text-white transition" onclick="previousTrack()">
<i data-lucide="skip-back" class="w-5 h-5 fill-current"></i>
</button>
<button class="w-10 h-10 rounded-full bg-white text-black flex items-center justify-center hover:scale-105 transition" onclick="togglePlay()" id="playPauseBtn">
<i data-lucide="play" class="w-5 h-5 fill-current ml-0.5" id="playIcon"></i>
</button>
<button class="text-gray-300 hover:text-white transition" onclick="nextTrack()">
<i data-lucide="skip-forward" class="w-5 h-5 fill-current"></i>
</button>
<button class="text-gray-400 hover:text-white transition" onclick="toggleRepeat(this)">
<i data-lucide="repeat" class="w-4 h-4"></i>
</button>
</div>
<div class="w-full flex items-center gap-3">
<span class="text-xs text-gray-400 w-10 text-right" id="currentTime">1:24</span>
<div class="flex-1 h-8 flex items-center cursor-pointer group" id="progressContainer">
<div class="w-full h-1.5 bg-white/10 rounded-full overflow-hidden relative">
<div class="absolute inset-y-0 left-0 bg-gradient-to-r from-cyan-400 to-purple-500 w-[30%] rounded-full group-hover:h-2 transition-all" id="progressBar"></div>
<div class="absolute top-1/2 -translate-y-1/2 left-[30%] w-3 h-3 bg-white rounded-full opacity-0 group-hover:opacity-100 transition shadow-lg" id="progressKnob"></div>
</div>
</div>
<span class="text-xs text-gray-400 w-10" id="duration">4:32</span>
</div>
</div>
<div class="flex items-center gap-3 w-64 justify-end">
<button class="text-gray-400 hover:text-white transition">
<i data-lucide="mic-2" class="w-4 h-4"></i>
</button>
<button class="text-gray-400 hover:text-white transition">
<i data-lucide="list-music" class="w-4 h-4"></i>
</button>
<div class="flex items-center gap-2 group">
<button class="text-gray-400 hover:text-white transition" onclick="toggleMute()">
<i data-lucide="volume-2" class="w-5 h-5" id="volumeIcon"></i>
</button>
<div class="w-24 h-1 bg-white/10 rounded-full overflow-hidden cursor-pointer">
<div class="h-full bg-cyan-400 w-[70%] rounded-full"></div>
</div>
</div>
<button class="text-gray-400 hover:text-white transition ml-2">
<i data-lucide="cast" class="w-4 h-4"></i>
</button>
</div>
</div>
</div>
<script src="mobile-nav.js"></script>
<script src="app.js"></script>
<script>
BF.init('home');
lucide.createIcons();
let currentTab = 'liked';
let isPlaying = false;
let currentTrack = {id: 5, title: "Midnight Synthesis", artist: "Aurora Void", duration: "4:08", image: "http://static.photos/technology/200x200/5"};
// Data from localStorage with error handling
let likedTracks = [], playlists = [], recentlyPlayed = [], following = [];
try {
likedTracks = JSON.parse(localStorage.getItem('likedTracks') || '[]');
playlists = JSON.parse(localStorage.getItem('playlists') || '[]');
recentlyPlayed = JSON.parse(localStorage.getItem('recentlyPlayed') || '[]');
following = JSON.parse(localStorage.getItem('following') || '[]');
} catch (e) {
console.error('Error loading library data:', e);
}
function renderSuperFanTab(container) {
const subs = BF.getSuperFanSubscriptions();
const sfCountEl = document.getElementById('sfCount');
if (sfCountEl) sfCountEl.textContent = subs.length;
if (!subs.length) {
container.innerHTML = `
<div class="text-center py-16">
<div class="w-16 h-16 rounded-full bg-orange-500/10 flex items-center justify-center mx-auto mb-4">
<i data-lucide="zap" class="w-8 h-8 text-orange-400/50"></i>
</div>
<h3 class="text-xl font-semibold text-gray-300 mb-2">No Super Fan subscriptions</h3>
<p class="text-gray-500 mb-4 max-w-md mx-auto">Become a Super Fan to download unlimited beats, bypass paywalls, and unlock exclusive content</p>
<div class="p-4 rounded-xl bg-orange-500/5 border border-orange-500/15 max-w-sm mx-auto mb-6">
<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>
<a href="artist.html" 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 inline-flex items-center gap-2" style="box-shadow: 0 0 20px rgba(249,115,22,0.3)">
<i data-lucide="zap" class="w-4 h-4"></i>
Become a Super Fan
</a>
</div>
`;
lucide.createIcons();
return;
}
container.innerHTML = `
<div class="mb-6 p-4 rounded-xl bg-green-500/5 border border-green-500/15 flex items-center gap-4">
<div class="w-12 h-12 rounded-xl bg-green-500/15 flex items-center justify-center flex-shrink-0">
<i data-lucide="badge-check" class="w-6 h-6 text-green-400"></i>
</div>
<div>
<p class="text-lg font-semibold text-green-400">Super Fan Active ✓</p>
<p class="text-sm text-gray-400">All paywalls bypassed · Download unlimited beats · Exclusive content unlocked</p>
</div>
</div>
<h3 class="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-4">Your Super Fan Subscriptions</h3>
<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="cancelSubFromLib('${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">
<i data-lucide="x-circle" class="w-3.5 h-3.5"></i>
<span class="hidden sm:inline">Cancel</span>
</button>
</div>
`).join('')}
</div>
<div class="mt-6 p-4 rounded-xl bg-orange-500/5 border border-orange-500/15">
<h4 class="text-sm font-semibold text-white mb-3 flex items-center gap-2"><i data-lucide="sparkles" class="w-4 h-4 text-orange-400"></i>Super Fan Benefits</h4>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
<div class="flex items-center gap-3 p-3 rounded-lg bg-white/[0.03]">
<div class="w-8 h-8 rounded-lg bg-orange-500/15 flex items-center justify-center flex-shrink-0"><i data-lucide="download" class="w-4 h-4 text-orange-400"></i></div>
<div><p class="text-sm font-medium text-white">Free Downloads</p><p class="text-[11px] text-gray-500">On every track, forever</p></div>
</div>
<div class="flex items-center gap-3 p-3 rounded-lg bg-white/[0.03]">
<div class="w-8 h-8 rounded-lg bg-cyan-500/15 flex items-center justify-center flex-shrink-0"><i data-lucide="unlock" class="w-4 h-4 text-cyan-400"></i></div>
<div><p class="text-sm font-medium text-white">No Paywalls</p><p class="text-[11px] text-gray-500">Bypass every lock instantly</p></div>
</div>
<div class="flex items-center gap-3 p-3 rounded-lg bg-white/[0.03]">
<div class="w-8 h-8 rounded-lg bg-purple-500/15 flex items-center justify-center flex-shrink-0"><i data-lucide="music" class="w-4 h-4 text-purple-400"></i></div>
<div><p class="text-sm font-medium text-white">Exclusive Content</p><p class="text-[11px] text-gray-500">Tracks & updates only for Super Fans</p></div>
</div>
<div class="flex items-center gap-3 p-3 rounded-lg bg-white/[0.03]">
<div class="w-8 h-8 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 font-medium text-white">Profile Badge</p><p class="text-[11px] text-gray-500">SUPERFAN badge on your profile</p></div>
</div>
</div>
</div>
`;
lucide.createIcons();
}
function cancelSubFromLib(slug) {
if (!confirm('Cancel your Super Fan subscription? You will lose access to exclusive content and free downloads.')) return;
const result = BF.cancelSuperFanSubscription(slug);
if (result) {
renderContent();
updateCounts();
updateWalletDisplay();
BF.updateSuperFanButtons();
}
}
function init() {
try {
loadGlobalState();
updateCounts();
renderContent();
updateWalletDisplay();
// Hide pro banner if already pro
const isPro = localStorage.getItem('isPro') === 'true';
const proBanner = document.getElementById('proBanner');
if (isPro && proBanner) {
proBanner.style.display = 'none';
} else if (proBanner) {
proBanner.classList.remove('hidden');
}
} catch (e) {
console.error('Initialization error:', e);
}
}
function updateWalletDisplay() {
try {
const balance = parseFloat(localStorage.getItem('walletBalance') || '50');
const walletEl = document.getElementById('walletBalance');
if (walletEl) walletEl.textContent = '€' + balance.toFixed(2);
const transactions = JSON.parse(localStorage.getItem('transactions') || '[]');
const totalSpent = transactions.reduce((sum, t) => sum + (t.amount || 0), 0);
const supportedEl = document.getElementById('totalSupported');
if (supportedEl) supportedEl.textContent = '€' + totalSpent.toFixed(2);
const tier = localStorage.getItem('userTier') || 'Free';
const tierEl = document.getElementById('membershipStatus');
if (tierEl) tierEl.textContent = tier;
// Show Super Fan wallet badge
const sfSubs = BF.getSuperFanSubscriptions();
const sfBadge = document.getElementById('sfWalletBadge');
const sfCount = document.getElementById('sfWalletCount');
if (sfBadge && sfSubs.length > 0) {
sfBadge.classList.remove('hidden');
if (sfCount) sfCount.textContent = sfSubs.length;
}
// Update transaction count
const transCount = document.getElementById('transactionCount');
if (transCount) transCount.textContent = transactions.length;
} catch (e) {
console.error('Wallet display error:', e);
}
}
function topUpWallet() {
const amount = prompt('Enter amount to add (€):', '20');
if (amount && parseFloat(amount) > 0) {
const current = parseFloat(localStorage.getItem('walletBalance') || '50');
localStorage.setItem('walletBalance', (current + parseFloat(amount)).toString());
updateWalletDisplay();
showToast(`💰 Added €${amount} to wallet`);
}
}
function showProUpgrade() {
// Implementation in previous updates
}
function loadGlobalState() {
const savedTrack = localStorage.getItem('currentTrack');
const savedIsPlaying = localStorage.getItem('isPlaying');
const savedProgress = localStorage.getItem('progress');
if (savedTrack) {
currentTrack = JSON.parse(savedTrack);
document.getElementById('playerTitle').textContent = currentTrack.title;
document.getElementById('playerArtist').textContent = currentTrack.artist;
document.getElementById('playerArt').src = currentTrack.image;
}
if (savedIsPlaying) isPlaying = savedIsPlaying === 'true';
if (savedProgress) {
document.getElementById('progressBar').style.width = savedProgress + '%';
document.getElementById('progressKnob').style.left = savedProgress + '%';
}
const playIcon = document.getElementById('playIcon');
if (isPlaying) {
playIcon.setAttribute('data-lucide', 'pause');
} else {
playIcon.setAttribute('data-lucide', 'play');
}
lucide.createIcons();
// Update player like button
updatePlayerLike();
}
function updatePlayerLike() {
const isLiked = likedTracks.find(t => t.id === currentTrack.id);
const likeBtn = document.getElementById('playerLike');
if (isLiked) {
likeBtn.classList.add('text-cyan-400', 'fill-current');
} else {
likeBtn.classList.remove('text-cyan-400', 'fill-current');
}
}
function toggleLikeCurrent() {
const index = likedTracks.findIndex(t => t.id === currentTrack.id);
if (index > -1) {
likedTracks.splice(index, 1);
showToast('Removed from liked tracks');
} else {
likedTracks.push({...currentTrack, likedAt: new Date().toISOString()});
showToast('Added to liked tracks');
}
localStorage.setItem('likedTracks', JSON.stringify(likedTracks));
updatePlayerLike();
if (currentTab === 'liked') renderContent();
updateCounts();
}
function updateCounts() {
document.getElementById('likedCount').textContent = likedTracks.length;
document.getElementById('playlistCount').textContent = playlists.length;
document.getElementById('recentCount').textContent = recentlyPlayed.length;
document.getElementById('followingCount').textContent = following.length;
// Update Super Fan count
const sfSubs = BF.getSuperFanSubscriptions();
const sfCountEl = document.getElementById('sfCount');
if (sfCountEl) sfCountEl.textContent = sfSubs.length;
}
function switchTab(tab, evt) {
currentTab = tab;
// Update tab styling
document.querySelectorAll('.tab-active').forEach(el => {
el.classList.remove('tab-active');
el.classList.add('text-gray-400');
});
if (evt && evt.target) {
evt.target.closest('button').classList.add('tab-active');
evt.target.closest('button').classList.remove('text-gray-400');
}
renderContent();
}
function renderContent() {
const container = document.getElementById('contentArea');
if (currentTab === 'liked') {
renderLikedTracks(container);
} else if (currentTab === 'playlists') {
renderPlaylists(container);
} else if (currentTab === 'recent') {
renderRecentlyPlayed(container);
} else if (currentTab === 'following') {
renderFollowing(container);
} else if (currentTab === 'transactions') {
renderTransactions(container);
} else if (currentTab === 'superfan') {
renderSuperFanTab(container);
}
}
function renderTransactions(container) {
const transactions = JSON.parse(localStorage.getItem('transactions') || '[]');
if (!transactions.length) {
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="receipt" class="w-8 h-8 text-gray-500"></i>
</div>
<h3 class="text-xl font-semibold text-gray-300 mb-2">No transactions yet</h3>
<p class="text-gray-500">Support artists to see your transactions here</p>
</div>
`;
lucide.createIcons();
return;
}
container.innerHTML = `
<div class="space-y-2">
${transactions.slice().reverse().map((t, i) => `
<div class="flex items-center gap-4 p-4 rounded-xl bg-white/5 hover:bg-white/10 transition animate-fade-in" style="animation-delay: ${i * 0.05}s">
<div class="w-10 h-10 rounded-full ${t.type === 'tip' ? 'bg-orange-500/20' : t.type === 'subscription' ? 'bg-cyan-500/20' : 'bg-purple-500/20'} flex items-center justify-center flex-shrink-0">
<i data-lucide="${t.type === 'tip' ? 'heart-handshake' : t.type === 'subscription' ? 'repeat' : 'trending-up'}" class="w-5 h-5 ${t.type === 'tip' ? 'text-orange-400' : t.type === 'subscription' ? 'text-cyan-400' : 'text-purple-400'}"></i>
</div>
<div class="flex-1 min-w-0">
<div class="flex items-center justify-between">
<p class="font-medium text-white capitalize">${t.type === 'sale_potential' ? 'Potential Earnings' : t.type.replace('_', ' ')}</p>
<p class="font-bold ${t.type === 'sale_potential' ? 'text-green-400' : 'text-white'}">
${t.type === 'sale_potential' ? '+' : '-'}€${t.amount || t.projected}
</p>
</div>
<p class="text-sm text-gray-500 mt-1">
${t.artist ? `To ${t.artist}` : t.track ? `Track: ${t.track}` : 'Platform fee: ' + ((t.fee || t.platformFee || 0).toFixed(2))}
${t.tier ? ` (${t.tier})` : ''}
</p>
<p class="text-xs text-gray-600 mt-1">${new Date(t.date).toLocaleDateString()}</p>
</div>
</div>
`).join('')}
</div>
<div class="mt-6 p-4 rounded-xl bg-white/5 border border-white/10">
<h4 class="font-semibold text-white mb-3">Financial Summary</h4>
<div class="grid grid-cols-3 gap-4 text-center">
<div>
<p class="text-2xl font-bold text-orange-400" id="totalTips">€${transactions.filter(t => t.type === 'tip').reduce((s, t) => s + t.amount, 0).toFixed(2)}</p>
<p class="text-xs text-gray-500 mt-1">Tips Given</p>
</div>
<div>
<p class="text-2xl font-bold text-cyan-400" id="totalSubs">€${transactions.filter(t => t.type === 'subscription').reduce((s, t) => s + t.amount, 0).toFixed(2)}</p>
<p class="text-xs text-gray-500 mt-1">Subscriptions</p>
</div>
<div>
<p class="text-2xl font-bold text-purple-400" id="totalFees">€${transactions.reduce((s, t) => s + (t.fee || t.platformFee || 0), 0).toFixed(2)}</p>
<p class="text-xs text-gray-500 mt-1">Platform Fees</p>
</div>
</div>
</div>
`;
lucide.createIcons();
}
function renderLikedTracks(container) {
if (!likedTracks.length) {
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="heart" class="w-8 h-8 text-gray-500"></i>
</div>
<h3 class="text-xl font-semibold text-gray-300 mb-2">No liked tracks yet</h3>
<p class="text-gray-500 mb-4">Start exploring and like tracks you love</p>
<a href="discover.html" class="px-6 py-3 bg-cyan-500 hover:bg-cyan-400 text-black font-semibold rounded-full transition glow-cyan inline-block">
Discover Music
</a>
</div>
`;
lucide.createIcons();
return;
}
container.innerHTML = `
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
${likedTracks.map((track, index) => `
<div class="track-card glass-panel rounded-2xl p-4 group cursor-pointer animate-fade-in" style="animation-delay: ${index * 0.05}s">
<div class="relative aspect-square rounded-xl overflow-hidden mb-4" onclick="playTrack(${track.id})">
<img src="${track.image}" class="w-full h-full object-cover transition duration-500 group-hover:scale-110">
<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 transform scale-90 group-hover:scale-100 transition">
<i data-lucide="${currentTrack.id === track.id && isPlaying ? 'pause' : 'play'}" class="w-6 h-6 fill-current ml-1"></i>
</div>
</div>
<div class="absolute bottom-2 right-2 px-2 py-1 rounded bg-black/70 backdrop-blur text-xs font-medium">
${track.duration || '4:32'}
</div>
<button class="absolute top-2 right-2 w-8 h-8 rounded-full bg-black/50 flex items-center justify-center text-cyan-400 hover:scale-110 transition" onclick="event.stopPropagation(); removeLike(${track.id})">
<i data-lucide="heart" class="w-4 h-4 fill-current"></i>
</button>
</div>
<div class="flex items-start justify-between gap-2" onclick="window.location.href='track.html?id=${track.id}'">
<div class="flex-1 min-w-0">
<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.artist}</p>
</div>
</div>
<div class="mt-3 flex items-center justify-between 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 || '10K'}
</span>
<div class="flex items-center gap-2">
<span class="opacity-0 group-hover:opacity-100 transition">${BF.renderDL(track.id, track.title, track.artist)}</span>
<button class="opacity-0 group-hover:opacity-100 transition hover:text-cyan-400" onclick="event.stopPropagation(); addToPlaylist(${track.id})">
<i data-lucide="list-plus" class="w-4 h-4"></i>
</button>
</div>
</div>
</div>
`).join('')}
</div>
`;
lucide.createIcons();
}
function renderPlaylists(container) {
container.innerHTML = `
<div class="flex justify-between items-center mb-6">
<p class="text-gray-400">${playlists.length} playlist${playlists.length !== 1 ? 's' : ''}</p>
<button class="px-4 py-2 bg-cyan-500 hover:bg-cyan-400 text-black font-semibold rounded-full transition glow-cyan flex items-center gap-2" onclick="openModal()">
<i data-lucide="plus" class="w-4 h-4"></i>
New Playlist
</button>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
${playlists.length ? playlists.map((playlist, index) => `
<div class="playlist-card glass-panel rounded-2xl p-4 group cursor-pointer animate-fade-in relative overflow-hidden" style="animation-delay: ${index * 0.05}s" onclick="viewPlaylist(${playlist.id})">
<div class="relative aspect-square rounded-xl overflow-hidden mb-4 bg-gradient-to-br from-cyan-900/50 to-purple-900/50 flex items-center justify-center">
${playlist.tracks && playlist.tracks[0] ? `
<img src="${playlist.tracks[0].image}" class="w-full h-full object-cover absolute inset-0 opacity-50">
` : ''}
<div class="relative z-10">
<i data-lucide="list-music" class="w-12 h-12 text-cyan-400/50"></i>
</div>
<div class="playlist-overlay absolute inset-0 bg-black/60 flex items-center justify-center opacity-0 transition">
<div class="w-12 h-12 rounded-full bg-cyan-500 text-black flex items-center justify-center">
<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">${playlist.name}</h3>
<p class="text-sm text-gray-400 mt-1">${playlist.tracks ? playlist.tracks.length : 0} tracks</p>
<button class="absolute top-6 right-6 w-8 h-8 rounded-full bg-black/50 flex items-center justify-center opacity-0 group-hover:opacity-100 transition hover:text-red-400" onclick="event.stopPropagation(); deletePlaylist(${playlist.id})">
<i data-lucide="trash-2" class="w-4 h-4"></i>
</button>
</div>
`).join('') : `
<div class="col-span-full 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="list-music" class="w-8 h-8 text-gray-500"></i>
</div>
<h3 class="text-xl font-semibold text-gray-300 mb-2">No playlists yet</h3>
<p class="text-gray-500 mb-4">Create your first playlist to organize your music</p>
</div>
`}
</div>
`;
lucide.createIcons();
}
function renderRecentlyPlayed(container) {
if (!recentlyPlayed.length) {
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="clock" class="w-8 h-8 text-gray-500"></i>
</div>
<h3 class="text-xl font-semibold text-gray-300 mb-2">No history yet</h3>
<p class="text-gray-500 mb-4">Tracks you play will appear here</p>
</div>
`;
lucide.createIcons();
return;
}
container.innerHTML = `
<div class="space-y-2">
${recentlyPlayed.map((track, index) => `
<div class="track-row flex items-center gap-4 p-3 rounded-lg hover:bg-white/5 cursor-pointer group animate-fade-in" style="animation-delay: ${index * 0.03}s" onclick="playTrackById(${track.id})">
<div class="w-14 h-14 rounded-lg overflow-hidden flex-shrink-0">
<img src="${track.image}" class="w-full h-full object-cover">
</div>
<div class="flex-1 min-w-0 flex items-center gap-4">
<div class="flex-1 min-w-0">
<h4 class="font-medium text-white truncate group-hover:text-cyan-400 transition">${track.title}</h4>
<p class="text-xs text-gray-500 truncate">${track.artist} • ${formatTime(track.playedAt)}</p>
</div>
<div class="hidden sm:flex items-center gap-6 text-sm text-gray-500">
<span>${track.duration || '4:32'}</span>
</div>
<button class="opacity-0 group-hover:opacity-100 transition text-gray-400 hover:text-cyan-400" onclick="event.stopPropagation(); window.location.href='track.html?id=${track.id}'">
<i data-lucide="more-horizontal" class="w-5 h-5"></i>
</button>
</div>
</div>
`).join('')}
</div>
`;
lucide.createIcons();
}
function renderFollowing(container) {
const artists = [
{id: 'aurora-void', name: 'Aurora Void', followers: '128.5K', image: 'http://static.photos/people/200x200/77', following: true},
{id: 'neon-prophet', name: 'Neon Prophet', followers: '45.2K', image: 'http://static.photos/people/200x200/10', following: following.includes('neon-prophet')},
{id: 'cyber-dreamer', name: 'Cyber Dreamer', followers: '32.8K', image: 'http://static.photos/people/200x200/11', following: following.includes('cyber-dreamer')},
{id: 'synth-wanderer', name: 'Synth Wanderer', followers: '28.1K', image: 'http://static.photos/people/200x200/12', following: following.includes('synth-wanderer')}
];
container.innerHTML = `
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
${artists.map((artist, index) => `
<div class="glass-panel rounded-2xl p-4 group animate-fade-in" style="animation-delay: ${index * 0.05}s">
<div class="flex items-center gap-4">
<div class="w-16 h-16 rounded-full overflow-hidden avatar-ring">
<img src="${artist.image}" class="w-full h-full object-cover cursor-pointer" onclick="window.location.href='artist.html'">
</div>
<div class="flex-1 min-w-0">
<h3 class="font-semibold text-white truncate cursor-pointer hover:text-cyan-400 transition" onclick="window.location.href='artist.html'">${artist.name}</h3>
<p class="text-sm text-gray-500">${artist.followers} followers</p>
</div>
</div>
<button class="w-full mt-4 py-2 rounded-xl text-sm font-medium transition ${artist.following ? 'bg-cyan-500 text-black' : 'bg-white/10 text-white hover:bg-white/20 border border-white/20'}" onclick="toggleFollowArtist('${artist.id}', this)">
${artist.following ? 'Following' : 'Follow'}
</button>
</div>
`).join('')}
</div>
`;
lucide.createIcons();
}
function toggleFollowArtist(artistId, btn) {
const isFollowing = btn.textContent === 'Following';
if (isFollowing) {
following = following.filter(id => id !== artistId);
btn.textContent = 'Follow';
btn.classList.remove('bg-cyan-500', 'text-black');
btn.classList.add('bg-white/10', 'text-white', 'hover:bg-white/20', 'border', 'border-white/20');
showToast('Unfollowed artist');
} else {
if (!following.includes(artistId)) following.push(artistId);
btn.textContent = 'Following';
btn.classList.add('bg-cyan-500', 'text-black');
btn.classList.remove('bg-white/10', 'text-white', 'hover:bg-white/20', 'border', 'border-white/20');
showToast('Following artist');
}
localStorage.setItem('following', JSON.stringify(following));
updateCounts();
}
function removeLike(trackId) {
likedTracks = likedTracks.filter(t => t.id !== trackId);
localStorage.setItem('likedTracks', JSON.stringify(likedTracks));
renderContent();
updateCounts();
showToast('Removed from liked tracks');
}
function openModal() {
document.getElementById('createPlaylistModal').classList.remove('hidden');
document.getElementById('playlistName').focus();
}
function closeModal() {
document.getElementById('createPlaylistModal').classList.add('hidden');
document.getElementById('playlistName').value = '';
document.getElementById('playlistDesc').value = '';
}
function createPlaylist() {
const name = document.getElementById('playlistName').value;
if (!name) return;
const playlist = {
id: Date.now(),
name: name,
description: document.getElementById('playlistDesc').value,
tracks: [],
createdAt: new Date().toISOString()
};
playlists.push(playlist);
localStorage.setItem('playlists', JSON.stringify(playlists));
closeModal();
updateCounts();
renderContent();
showToast(`Created playlist "${name}"`);
}
function deletePlaylist(id) {
if (!confirm('Delete this playlist?')) return;
playlists = playlists.filter(p => p.id !== id);
localStorage.setItem('playlists', JSON.stringify(playlists));
updateCounts();
renderContent();
showToast('Playlist deleted');
}
function viewPlaylist(id) {
const playlist = playlists.find(p => p.id === id);
if (playlist && playlist.tracks && playlist.tracks.length) {
// Play first track
playTrackById(playlist.tracks[0].id);
} else {
showToast('Playlist is empty');
}
}
function addToPlaylist(trackId) {
const track = [...likedTracks, ...recentlyPlayed].find(t => t.id === trackId);
if (!track) return;
if (!playlists.length) {
openModal();
return;
}
const options = playlists.map((p, i) => `${i + 1}. ${p.name}`).join('\n');
const choice = prompt(`Add to playlist:\n${options}`);
if (choice && parseInt(choice) > 0 && parseInt(choice) <= playlists.length) {
const playlist = playlists[parseInt(choice) - 1];
if (!playlist.tracks) playlist.tracks = [];
if (!playlist.tracks.find(t => t.id === trackId)) {
playlist.tracks.push(track);
localStorage.setItem('playlists', JSON.stringify(playlists));
showToast(`Added to "${playlist.name}"`);
} else {
showToast('Already in playlist');
}
}
}
function formatTime(isoString) {
const date = new Date(isoString);
const now = new Date();
const diff = Math.floor((now - date) / 1000);
if (diff < 60) return 'Just now';
if (diff < 3600) return Math.floor(diff / 60) + 'm ago';
if (diff < 86400) return Math.floor(diff / 3600) + 'h ago';
return Math.floor(diff / 86400) + 'd ago';
}
function showToast(message) {
const toast = document.createElement('div');
toast.className = 'fixed bottom-24 left-1/2 -translate-x-1/2 bg-cyan-500 text-black px-4 py-2 rounded-full text-sm font-medium z-50 animate-fade-in glow-cyan';
toast.textContent = message;
document.body.appendChild(toast);
setTimeout(() => {
toast.style.opacity = '0';
toast.style.transition = 'opacity 0.3s';
setTimeout(() => toast.remove(), 300);
}, 2000);
}
function playTrack(trackId) {
const track = likedTracks.find(t => t.id === trackId);
if (track) {
currentTrack = track;
isPlaying = true;
updatePlayer();
saveGlobalState();
addToRecentlyPlayed(track);
}
}
function playTrackById(trackId) {
const allTracks = [...likedTracks, ...recentlyPlayed];
const track = allTracks.find(t => t.id === trackId);
if (track) {
currentTrack = track;
isPlaying = true;
updatePlayer();
saveGlobalState();
addToRecentlyPlayed(track);
}
}
function updatePlayer() {
document.getElementById('playerTitle').textContent = currentTrack.title;
document.getElementById('playerArtist').textContent = currentTrack.artist;
document.getElementById('playerArt').src = currentTrack.image;
const playIcon = document.getElementById('playIcon');
if (isPlaying) {
playIcon.setAttribute('data-lucide', 'pause');
} else {
playIcon.setAttribute('data-lucide', 'play');
}
lucide.createIcons();
updatePlayerLike();
}
function togglePlay() {
isPlaying = !isPlaying;
updatePlayer();
saveGlobalState();
}
function saveGlobalState() {
localStorage.setItem('currentTrack', JSON.stringify(currentTrack));
localStorage.setItem('isPlaying', isPlaying);
}
function addToRecentlyPlayed(track) {
recentlyPlayed = recentlyPlayed.filter(t => t.id !== track.id);
recentlyPlayed.unshift({...track, playedAt: new Date().toISOString()});
if (recentlyPlayed.length > 50) recentlyPlayed.pop();
localStorage.setItem('recentlyPlayed', JSON.stringify(recentlyPlayed));
if (currentTab === 'recent') renderContent();
}
function previousTrack() {
// Previous track logic
}
function nextTrack() {
// Next track logic
}
function toggleShuffle(btn) {
btn.classList.toggle('text-cyan-400');
}
function toggleRepeat(btn) {
btn.classList.toggle('text-cyan-400');
}
let isMuted = false;
function toggleMute() {
isMuted = !isMuted;
const icon = document.getElementById('volumeIcon');
if (isMuted) {
icon.setAttribute('data-lucide', 'volume-x');
} else {
icon.setAttribute('data-lucide', 'volume-2');
}
lucide.createIcons();
}
// Initialize
init();
// Simulate progress
setInterval(() => {
if (isPlaying) {
const progress = parseFloat(localStorage.getItem('progress') || 30);
const newProgress = (progress + 0.5) % 100;
localStorage.setItem('progress', newProgress);
document.getElementById('progressBar').style.width = newProgress + '%';
document.getElementById('progressKnob').style.left = newProgress + '%';
}
}, 1000);
</script>
</body>
</html> |