Spaces:
Running
Running
File size: 40,690 Bytes
8802c5d 03eb6de 8802c5d fe9aa86 8802c5d 03eb6de 8802c5d 03eb6de 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d 03eb6de fe9aa86 03eb6de fe9aa86 03eb6de fe9aa86 03eb6de fe9aa86 03eb6de fe9aa86 03eb6de fe9aa86 03eb6de fe9aa86 03eb6de fe9aa86 03eb6de fe9aa86 03eb6de fe9aa86 03eb6de fe9aa86 03eb6de fe9aa86 03eb6de fe9aa86 03eb6de fe9aa86 03eb6de fe9aa86 03eb6de fe9aa86 03eb6de fe9aa86 03eb6de fe9aa86 03eb6de fe9aa86 03eb6de fe9aa86 03eb6de fe9aa86 03eb6de fe9aa86 03eb6de fe9aa86 03eb6de fe9aa86 03eb6de fe9aa86 03eb6de fe9aa86 03eb6de 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d fe9aa86 8802c5d 03eb6de 8802c5d |
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 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>TrendSpot - Hashtag Explorer</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
/* Custom scrollbar */
::-webkit-scrollbar {
width: 4px;
}
::-webkit-scrollbar-track {
background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
background: #1DA1F2;
border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
background: #0c7abf;
}
/* Animation for loading */
@keyframes pulse {
0% { opacity: 0.6; }
50% { opacity: 1; }
100% { opacity: 0.6; }
}
.animate-pulse {
animation: pulse 1.5s infinite;
}
/* Card hover effect */
.trend-card:hover {
transform: translateY(-4px);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}
/* Loading spinner */
.spinner {
width: 24px;
height: 24px;
border: 3px solid rgba(255,255,255,0.3);
border-radius: 50%;
border-top-color: #fff;
animation: spin 1s ease-in-out infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
/* Platform colors */
.twitter-bg { background-color: #1DA1F2; }
.tiktok-bg { background-color: #000000; }
.instagram-bg { background: linear-gradient(45deg, #405DE6, #5851DB, #833AB4, #C13584, #E1306C, #FD1D1D); }
.youtube-bg { background-color: #FF0000; }
/* Floating button */
.floating-btn {
position: fixed;
bottom: 80px;
right: 20px;
width: 60px;
height: 60px;
border-radius: 50%;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
z-index: 50;
}
/* Platform color indicators */
.platform-indicator {
width: 12px;
height: 12px;
border-radius: 50%;
display: inline-block;
margin-right: 4px;
}
/* Prevent text selection */
* {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
/* Tap highlight color */
* {
-webkit-tap-highlight-color: transparent;
}
/* Disable pull-to-refresh */
body {
overscroll-behavior-y: contain;
}
/* DMIM token color */
.dmim-bg { background-color: #4a6fdc; }
</style>
</head>
<body class="bg-gray-50 font-sans text-gray-800">
<!-- App Container -->
<div class="max-w-md mx-auto bg-white min-h-screen flex flex-col">
<!-- Header -->
<header class="bg-primary p-4 shadow-md">
<div class="flex items-center justify-between">
<h1 class="text-white text-xl font-bold">TrendSpot</h1>
<div class="flex space-x-3">
<button class="text-white" id="darkModeToggle">
<i class="fas fa-moon"></i>
</button>
<button class="text-white" id="settingsBtn">
<i class="fas fa-cog"></i>
</button>
</div>
</div>
</header>
<!-- Main Content Area -->
<main class="flex-1 overflow-y-auto p-4" id="mainContent">
<!-- Home Tab Content -->
<div id="homeTab">
<div class="mb-6">
<h2 class="text-lg font-semibold mb-4">Trending Now</h2>
<div class="grid grid-cols-1 gap-4" id="trendingCardsContainer">
<!-- Cards will be dynamically inserted here -->
</div>
</div>
<div class="mt-6">
<h2 class="text-lg font-semibold mb-4">Recently Viewed</h2>
<div class="space-y-4" id="recentCardsContainer">
<!-- Recent cards will be dynamically inserted here -->
</div>
</div>
</div>
<!-- Explore Tab Content (hidden by default) -->
<div id="exploreTab" class="hidden">
<h2 class="text-lg font-semibold mb-4">Search Trends</h2>
<div class="mb-4">
<div class="relative">
<input type="text" id="trendSearchInput" placeholder="Search for trends..."
class="w-full py-3 px-4 rounded-lg bg-gray-100 focus:outline-none focus:ring-2 focus:ring-primary">
<button id="searchTrendBtn" class="absolute right-3 top-3 text-gray-500 hover:text-primary">
<i class="fas fa-search"></i>
</button>
</div>
</div>
<div class="mb-6">
<h3 class="font-medium mb-2">Popular Categories</h3>
<div class="flex flex-wrap gap-2">
<button class="category-btn bg-gray-100 hover:bg-gray-200 px-3 py-1 rounded-full text-sm cursor-pointer transition" data-category="crypto">#Crypto</button>
<button class="category-btn bg-gray-100 hover:bg-gray-200 px-3 py-1 rounded-full text-sm cursor-pointer transition" data-category="tech">#Tech</button>
<button class="category-btn bg-gray-100 hover:bg-gray-200 px-3 py-1 rounded-full text-sm cursor-pointer transition" data-category="gaming">#Gaming</button>
<button class="category-btn bg-gray-100 hover:bg-gray-200 px-3 py-1 rounded-full text-sm cursor-pointer transition" data-category="music">#Music</button>
<button class="category-btn bg-gray-100 hover:bg-gray-200 px-3 py-1 rounded-full text-sm cursor-pointer transition" data-category="finance">#Finance</button>
<button class="category-btn bg-gray-100 hover:bg-gray-200 px-3 py-1 rounded-full text-sm cursor-pointer transition" data-category="news">#News</button>
</div>
</div>
<div class="grid grid-cols-1 gap-4" id="searchResultsContainer">
<!-- Search results will appear here -->
</div>
</div>
<!-- Library Tab Content (hidden by default) -->
<div id="libraryTab" class="hidden">
<h2 class="text-lg font-semibold mb-4">Saved Trends</h2>
<div class="mb-4">
<div class="flex items-center justify-between bg-gray-100 rounded-lg p-3">
<div class="flex items-center">
<div class="w-8 h-8 rounded-full dmim-bg text-white flex items-center justify-center mr-3">
<i class="fas fa-coins"></i>
</div>
<div>
<span class="font-medium">DMIM Token</span>
<span class="text-xs text-gray-500 block">Bitcoin Cash CHIP Protocol</span>
</div>
</div>
<span class="text-sm font-medium">0.3% APY</span>
</div>
</div>
<div class="space-y-3" id="savedTrendsContainer">
<!-- Saved trends will appear here -->
</div>
<div class="mt-6">
<h3 class="font-medium mb-2">Stake DMIM to Trends</h3>
<div class="bg-gray-100 rounded-lg p-4">
<div class="mb-3">
<label class="block text-sm font-medium mb-1">Select Trend</label>
<select id="trendSelect" class="w-full p-2 rounded border border-gray-300">
<option value="">-- Select a saved trend --</option>
</select>
</div>
<div class="mb-3">
<label class="block text-sm font-medium mb-1">DMIM Amount</label>
<input type="number" id="stakeAmount" placeholder="0.00" class="w-full p-2 rounded border border-gray-300">
</div>
<button id="stakeBtn" class="w-full py-2 bg-primary text-white rounded-lg font-medium">
Stake & Farm Yield
</button>
</div>
</div>
</div>
</main>
<!-- Bottom Navigation -->
<nav class="bg-white border-t border-gray-200 p-2">
<div class="flex justify-around">
<button class="tab-button active flex flex-col items-center text-primary" data-tab="homeTab">
<i class="fas fa-home text-lg"></i>
<span class="text-xs mt-1">Home</span>
</button>
<button class="tab-button flex flex-col items-center text-gray-500" data-tab="exploreTab">
<i class="fas fa-search text-lg"></i>
<span class="text-xs mt-1">Explore</span>
</button>
<button class="tab-button flex flex-col items-center text-gray-500" data-tab="libraryTab">
<i class="fas fa-bookmark text-lg"></i>
<span class="text-xs mt-1">Library</span>
</button>
</div>
</nav>
<!-- Floating Hashtag Search Button -->
<button class="floating-btn bg-primary text-white flex items-center justify-center" id="hashtagSearchBtn">
<i class="fas fa-plus text-2xl"></i>
</button>
<!-- Add Trend Modal (hidden by default) -->
<div id="addTrendModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
<div class="bg-white rounded-lg w-full max-w-md mx-4">
<div class="p-4 border-b border-gray-200">
<h3 class="font-semibold text-lg">Add New Trend</h3>
</div>
<div class="p-4">
<div class="mb-4">
<label class="block text-sm font-medium text-gray-700 mb-1">Hashtag</label>
<input type="text" id="newHashtag" placeholder="#trend"
class="w-full py-2 px-4 rounded-lg bg-gray-100 focus:outline-none focus:ring-2 focus:ring-primary">
</div>
<div class="mb-4">
<label class="block text-sm font-medium text-gray-700 mb-1">Platform</label>
<div class="grid grid-cols-2 gap-2">
<button class="platform-btn bg-gray-200 text-gray-700 py-2 px-3 rounded text-sm" data-platform="twitter">
<i class="fab fa-twitter mr-1 text-blue-400"></i> Twitter
</button>
<button class="platform-btn bg-gray-200 text-gray-700 py-2 px-3 rounded text-sm" data-platform="tiktok">
<i class="fab fa-tiktok mr-1"></i> TikTok
</button>
<button class="platform-btn bg-gray-200 text-gray-700 py-2 px-3 rounded text-sm" data-platform="instagram">
<i class="fab fa-instagram mr-1 text-pink-500"></i> Instagram
</button>
<button class="platform-btn bg-gray-200 text-gray-700 py-2 px-3 rounded text-sm" data-platform="youtube">
<i class="fab fa-youtube mr-1 text-red-500"></i> YouTube
</button>
</div>
</div>
<div class="mb-4">
<label class="block text-sm font-medium text-gray-700 mb-1">Link DMIM Token</label>
<div class="flex items-center">
<input type="checkbox" id="linkDmim" class="mr-2">
<label for="linkDmim" class="text-sm">Stake DMIM to this trend</label>
</div>
</div>
</div>
<div class="p-4 border-t border-gray-200 flex justify-end space-x-3">
<button id="cancelAddTrend" class="px-4 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700">
Cancel
</button>
<button id="saveTrend" class="px-4 py-2 bg-primary text-white rounded-md text-sm font-medium">
Save Trend
</button>
</div>
</div>
</div>
<!-- DMIM Token Info Modal (hidden by default) -->
<div id="dmimModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
<div class="bg-white rounded-lg w-full max-w-md mx-4">
<div class="p-4 border-b border-gray-200 flex justify-between items-center">
<h3 class="font-semibold text-lg">DMIM Token</h3>
<span class="inline-flex items-center bg-green-100 text-green-800 text-xs px-2 py-1 rounded-full">
<i class="fas fa-check-circle mr-1"></i> Verified
</span>
</div>
<div class="p-4">
<div class="flex items-center mb-4">
<div class="w-12 h-12 rounded-full dmim-bg text-white flex items-center justify-center mr-3">
<i class="fas fa-coins text-xl"></i>
</div>
<div>
<h4 class="font-medium">Bitcoin Cash CHIP Protocol</h4>
<p class="text-sm text-gray-500">0.3% APY Yield Farming</p>
</div>
</div>
<div class="mb-4">
<p class="text-sm text-gray-700 mb-3">
DMIM is a private cryptocurrency token on the Bitcoin Cash network using the CHIP protocol.
Stake DMIM to your saved trends to earn yield.
</p>
<div class="space-y-2">
<a href="https://tokenexplorer.cash/?tokenId=81fd176d7e3769aad00bc21539082cc3345f9cd613623fa281e6726f451f32f9" target="_blank" class="flex items-center text-blue-500 text-sm">
<i class="fas fa-external-link-alt mr-2"></i> View on Token Explorer
</a>
<a href="https://app.cauldron.quest/swap/81fd176d7e3769aad00bc21539082cc3345f9cd613623fa281e6726f451f32f9" target="_blank" class="flex items-center text-blue-500 text-sm">
<i class="fas fa-exchange-alt mr-2"></i> Swap on Cauldron
</a>
<a href="https://blockchair.com/bitcoin-cash/transaction/81fd176d7e3769aad00bc21539082cc3345f9cd613623fa281e6726f451f32f9" target="_blank" class="flex items-center text-blue-500 text-sm">
<i class="fas fa-link mr-2"></i> View Transaction
</a>
</div>
</div>
<div class="bg-gray-100 rounded-lg p-3">
<h4 class="font-medium text-sm mb-2">Your DMIM Balance</h4>
<div class="flex justify-between items-center">
<span class="font-medium" id="dmimBalance">0 DMIM</span>
<button id="addDmimBtn" class="text-sm text-primary font-medium">
<i class="fas fa-plus-circle mr-1"></i> Add DMIM
</button>
</div>
</div>
</div>
<div class="p-4 border-t border-gray-200 flex justify-center">
<button id="closeDmimModal" class="px-4 py-2 bg-primary text-white rounded-md text-sm font-medium">
Close
</button>
</div>
</div>
</div>
<!-- Toast Notification (hidden by default) -->
<div id="toast" class="fixed bottom-20 left-1/2 transform -translate-x-1/2 bg-gray-800 text-white px-4 py-2 rounded-md shadow-lg hidden z-50">
<div class="flex items-center">
<span id="toastMessage">Searching for #trending...</span>
</div>
</div>
</div>
<script>
// Sample data for trending cards
const trendingData = [
{
hashtag: "#Crypto",
title: "Latest cryptocurrency trends and discussions",
platform: "twitter",
posts: "12K",
trendType: "newest",
popularity: "1.2M",
hasDmim: true
},
{
hashtag: "#Tech",
title: "New tech innovations and product launches",
platform: "twitter",
posts: "8K",
trendType: "hottest",
popularity: "890K",
hasDmim: false
},
{
hashtag: "#Gaming",
title: "Upcoming game releases and esports news",
platform: "youtube",
posts: "15K",
trendType: "newest",
popularity: "750K",
hasDmim: true
},
{
hashtag: "#Finance",
title: "Stock market updates and investment tips",
platform: "twitter",
posts: "25K",
trendType: "hottest",
popularity: "1.5M",
hasDmim: false
}
];
// Sample data for recent cards
const recentData = [
{
hashtag: "#Bitcoin",
title: "Bitcoin price analysis and market trends",
platform: "twitter",
posts: "5K",
trendType: "newest",
hasDmim: true
},
{
hashtag: "#DeFi",
title: "Decentralized finance protocols and yield farming",
platform: "twitter",
posts: "18K",
trendType: "hottest",
hasDmim: true
}
];
// User data
let userData = {
dmimBalance: 0,
savedTrends: [],
stakedTrends: {}
};
// Function to generate platform icon
function getPlatformIcon(platform) {
const icons = {
twitter: '<i class="fab fa-twitter text-blue-400"></i>',
tiktok: '<i class="fab fa-tiktok"></i>',
instagram: '<i class="fab fa-instagram text-pink-500"></i>',
youtube: '<i class="fab fa-youtube text-red-500"></i>'
};
return icons[platform] || '<i class="fas fa-hashtag"></i>';
}
// Function to generate platform color indicator
function getPlatformColor(platform) {
const colors = {
twitter: 'bg-blue-400',
tiktok: 'bg-black',
instagram: 'bg-gradient-to-r from-purple-500 via-pink-500 to-red-500',
youtube: 'bg-red-500'
};
return colors[platform] || 'bg-gray-400';
}
// Function to render trending cards
function renderTrendingCards() {
const container = document.getElementById('trendingCardsContainer');
container.innerHTML = '';
trendingData.forEach(item => {
const card = document.createElement('div');
card.className = 'trend-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300 cursor-pointer p-4 h-32 flex flex-col justify-between';
card.innerHTML = `
<div class="flex items-start justify-between mb-2">
<div>
<span class="inline-flex items-center bg-gray-100 text-gray-800 text-xs px-2 py-1 rounded-full">
${getPlatformIcon(item.platform)}
<span class="ml-1">${item.hashtag}</span>
${item.hasDmim ? '<span class="ml-1 text-green-500"><i class="fas fa-check-circle"></i></span>' : ''}
</span>
</div>
<span class="inline-flex items-center bg-gray-100 text-gray-800 text-xs px-2 py-1 rounded-full">
<i class="fas fa-fire text-orange-400 mr-1"></i> ${item.popularity}
</span>
</div>
<h3 class="font-medium text-sm line-clamp-2 mb-3">${item.title}</h3>
<div class="flex justify-between items-center text-xs text-gray-500">
<span>${item.posts} posts</span>
<span class="capitalize">${item.trendType}</span>
</div>
`;
container.appendChild(card);
});
}
// Function to render recent cards
function renderRecentCards() {
const container = document.getElementById('recentCardsContainer');
container.innerHTML = '';
recentData.forEach(item => {
const card = document.createElement('div');
card.className = 'trend-card bg-white rounded-lg shadow-sm transition duration-300 cursor-pointer p-3 flex items-start h-28';
card.innerHTML = `
<div class="flex-shrink-0 mr-3">
<span class="platform-indicator ${getPlatformColor(item.platform)}"></span>
</div>
<div class="flex-1">
<h3 class="font-medium text-sm line-clamp-2">${item.title}</h3>
<div class="flex justify-between items-center mt-2 text-xs text-gray-500">
<span>${item.hashtag} ${item.hasDmim ? '<i class="fas fa-check-circle text-green-500 ml-1"></i>' : ''}</span>
<span class="capitalize">${item.trendType}</span>
</div>
</div>
`;
container.appendChild(card);
});
}
// Function to render saved trends
function renderSavedTrends() {
const container = document.getElementById('savedTrendsContainer');
container.innerHTML = '';
// Update select dropdown
const trendSelect = document.getElementById('trendSelect');
trendSelect.innerHTML = '<option value="">-- Select a saved trend --</option>';
userData.savedTrends.forEach(trend => {
const element = document.createElement('div');
element.className = 'flex items-center p-3 rounded-lg bg-white shadow-sm cursor-pointer hover:bg-gray-50';
element.innerHTML = `
<div class="flex-shrink-0 mr-3">
<div class="w-8 h-8 rounded-full ${getPlatformColor(trend.platform)} flex items-center justify-center text-white">
${getPlatformIcon(trend.platform)}
</div>
</div>
<div class="flex-1">
<div class="flex items-center">
<h4 class="font-medium text-sm line-clamp-1">${trend.hashtag}</h4>
${trend.hasDmim ? '<span class="ml-1 text-green-500"><i class="fas fa-check-circle"></i></span>' : ''}
</div>
<p class="text-gray-500 text-xs">${trend.platform} • ${trend.hasDmim ? 'Staked: ' + (userData.stakedTrends[trend.hashtag] || 0) + ' DMIM' : 'Not staked'}</p>
</div>
<button class="text-gray-500">
<i class="fas fa-ellipsis-v"></i>
</button>
`;
container.appendChild(element);
// Add to select dropdown
const option = document.createElement('option');
option.value = trend.hashtag;
option.textContent = trend.hashtag;
trendSelect.appendChild(option);
});
// Update DMIM balance display
document.getElementById('dmimBalance').textContent = userData.dmimBalance + ' DMIM';
}
// Function to show search results
function showSearchResults(query) {
const container = document.getElementById('searchResultsContainer');
container.innerHTML = '';
if (!query) return;
// Simulate search with timeout
setTimeout(() => {
// In a real app, this would fetch actual search results
const results = [
{
hashtag: `#${query}`,
title: `Latest content about ${query}`,
platform: "twitter",
posts: Math.floor(Math.random() * 100) + "K",
trendType: "hottest"
},
{
hashtag: `#${query}News`,
title: `Breaking news about ${query}`,
platform: "twitter",
posts: Math.floor(Math.random() * 50) + "K",
trendType: "newest"
},
{
hashtag: `#${query}Trends`,
title: `Trending topics related to ${query}`,
platform: "youtube",
posts: Math.floor(Math.random() * 30) + "K",
trendType: "hottest"
}
];
results.forEach(item => {
const card = document.createElement('div');
card.className = 'trend-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300 cursor-pointer p-4 h-32 flex flex-col justify-between';
card.innerHTML = `
<div class="flex items-start justify-between mb-2">
<div>
<span class="inline-flex items-center bg-gray-100 text-gray-800 text-xs px-2 py-1 rounded-full">
${getPlatformIcon(item.platform)}
<span class="ml-1">${item.hashtag}</span>
</span>
</div>
<button class="save-trend-btn text-gray-400 hover:text-primary" data-hashtag="${item.hashtag}" data-platform="${item.platform}">
<i class="fas fa-bookmark"></i>
</button>
</div>
<h3 class="font-medium text-sm line-clamp-2 mb-3">${item.title}</h3>
<div class="flex justify-between items-center text-xs text-gray-500">
<span>${item.posts} posts</span>
<span class="capitalize">${item.trendType}</span>
</div>
`;
container.appendChild(card);
});
// Add event listeners to save buttons
document.querySelectorAll('.save-trend-btn').forEach(btn => {
btn.addEventListener('click', function(e) {
e.stopPropagation();
const hashtag = this.getAttribute('data-hashtag');
const platform = this.getAttribute('data-platform');
saveTrend(hashtag, platform);
});
});
showToast(`Found results for ${query}`);
}, 1000);
}
// Function to save a trend
function saveTrend(hashtag, platform) {
// Check if already saved
if (userData.savedTrends.some(t => t.hashtag === hashtag)) {
showToast('This trend is already saved');
return;
}
// Add to saved trends
userData.savedTrends.push({
hashtag,
platform,
hasDmim: false
});
// Update UI
renderSavedTrends();
showToast(`${hashtag} saved to your library`);
// Close modal if open
document.getElementById('addTrendModal').classList.add('hidden');
}
// Function to stake DMIM to a trend
function stakeDmim(hashtag, amount) {
if (!hashtag || !amount || amount <= 0) {
showToast('Please select a trend and enter a valid amount');
return;
}
if (amount > userData.dmimBalance) {
showToast('Insufficient DMIM balance');
return;
}
// Update staked amount
userData.stakedTrends[hashtag] = (userData.stakedTrends[hashtag] || 0) + amount;
userData.dmimBalance -= amount;
// Mark trend as having DMIM
const trend = userData.savedTrends.find(t => t.hashtag === hashtag);
if (trend) {
trend.hasDmim = true;
}
// Update UI
renderSavedTrends();
showToast(`Staked ${amount} DMIM to ${hashtag}`);
}
// Function to add DMIM tokens
function addDmim(amount) {
userData.dmimBalance += amount;
renderSavedTrends();
showToast(`Added ${amount} DMIM to your balance`);
}
// Initialize the app
function initApp() {
renderTrendingCards();
renderRecentCards();
renderSavedTrends();
// Add some sample saved trends
userData.savedTrends = [
{
hashtag: "#Bitcoin",
platform: "twitter",
hasDmim: true
},
{
hashtag: "#DeFi",
platform: "twitter",
hasDmim: false
}
];
// Add some sample staked trends
userData.stakedTrends = {
"#Bitcoin": 500
};
// Set initial DMIM balance
userData.dmimBalance = 1000;
}
// Tab switching functionality
document.querySelectorAll('.tab-button').forEach(button => {
button.addEventListener('click', function() {
// Remove active class from all buttons
document.querySelectorAll('.tab-button').forEach(btn => {
btn.classList.remove('active', 'text-primary');
btn.classList.add('text-gray-500');
});
// Add active class to clicked button
this.classList.add('active', 'text-primary');
this.classList.remove('text-gray-500');
// Hide all tabs
document.querySelectorAll('#mainContent > div').forEach(tab => {
tab.classList.add('hidden');
});
// Show selected tab
const tabId = this.getAttribute('data-tab');
document.getElementById(tabId).classList.remove('hidden');
// Scroll to top when switching tabs
document.getElementById('mainContent').scrollTo(0, 0);
// If switching to explore tab, focus search input
if (tabId === 'exploreTab') {
setTimeout(() => {
document.getElementById('trendSearchInput').focus();
}, 100);
}
});
});
// Search trend functionality
document.getElementById('searchTrendBtn').addEventListener('click', function() {
const query = document.getElementById('trendSearchInput').value.trim();
if (query) {
showSearchResults(query);
}
});
document.getElementById('trendSearchInput').addEventListener('keypress', function(e) {
if (e.key === 'Enter') {
const query = this.value.trim();
if (query) {
showSearchResults(query);
}
}
});
// Category buttons
document.querySelectorAll('.category-btn').forEach(btn => {
btn.addEventListener('click', function() {
const category = this.getAttribute('data-category');
document.getElementById('trendSearchInput').value = category;
showSearchResults(category);
});
});
// Floating button to add new trend
document.getElementById('hashtagSearchBtn').addEventListener('click', function() {
document.getElementById('addTrendModal').classList.remove('hidden');
});
// Cancel add trend
document.getElementById('cancelAddTrend').addEventListener('click', function() {
document.getElementById('addTrendModal').classList.add('hidden');
});
// Save new trend
document.getElementById('saveTrend').addEventListener('click', function() {
const hashtag = document.getElementById('newHashtag').value.trim();
const platform = document.querySelector('.platform-btn.bg-primary')?.getAttribute('data-platform');
const linkDmim = document.getElementById('linkDmim').checked;
if (!hashtag || !platform) {
showToast('Please enter a hashtag and select a platform');
return;
}
// Add to saved trends
userData.savedTrends.push({
hashtag,
platform,
hasDmim: linkDmim
});
// If linking DMIM, add some stake
if (linkDmim) {
userData.stakedTrends[hashtag] = 100;
userData.dmimBalance = Math.max(0, userData.dmimBalance - 100);
}
// Update UI
renderSavedTrends();
document.getElementById('addTrendModal').classList.add('hidden');
showToast(`${hashtag} saved to your library`);
});
// Platform selection in add trend modal
document.querySelectorAll('.platform-btn').forEach(btn => {
btn.addEventListener('click', function() {
document.querySelectorAll('.platform-btn').forEach(b => {
b.classList.remove('bg-primary', 'text-white');
b.classList.add('bg-gray-200', 'text-gray-700');
});
this.classList.remove('bg-gray-200', 'text-gray-700');
this.classList.add('bg-primary', 'text-white');
});
});
// Stake DMIM button
document.getElementById('stakeBtn').addEventListener('click', function() {
const hashtag = document.getElementById('trendSelect').value;
const amount = parseFloat(document.getElementById('stakeAmount').value);
stakeDmim(hashtag, amount);
});
// DMIM token info
document.addEventListener('click', function(e) {
if (e.target.closest('.dmim-info')) {
document.getElementById('dmimModal').classList.remove('hidden');
}
});
// Close DMIM modal
document.getElementById('closeDmimModal').addEventListener('click', function() {
document.getElementById('dmimModal').classList.add('hidden');
});
// Add DMIM button
document.getElementById('addDmimBtn').addEventListener('click', function() {
addDmim(1000);
});
// Dark mode toggle
const darkModeToggle = document.getElementById('darkModeToggle');
function toggleDarkMode() {
document.body.classList.toggle('bg-gray-900');
document.body.classList.toggle('text-gray-100');
document.querySelector('main').classList.toggle('bg-gray-800');
document.querySelectorAll('.bg-white').forEach(el => {
el.classList.toggle('bg-gray-700');
el.classList.toggle('text-gray-100');
});
document.querySelector('nav').classList.toggle('bg-gray-700');
document.querySelector('nav').classList.toggle('border-gray-600');
// Save preference to localStorage
const isDark = document.body.classList.contains('bg-gray-900');
localStorage.setItem('darkMode', isDark);
}
darkModeToggle.addEventListener('click', toggleDarkMode);
// Check for saved dark mode preference
if (localStorage.getItem('darkMode') === 'true') {
toggleDarkMode();
}
// Toast notification function
function showToast(message) {
const toast = document.getElementById('toast');
const toastMessage = document.getElementById('toastMessage');
toastMessage.textContent = message;
toast.classList.remove('hidden');
setTimeout(() => {
toast.classList.add('hidden');
}, 3000);
}
// Initialize the app when DOM is loaded
document.addEventListener('DOMContentLoaded', initApp);
// Prevent default behavior for all buttons to avoid unwanted scrolling on mobile
document.querySelectorAll('button').forEach(button => {
button.addEventListener('touchstart', function(e) {
e.preventDefault();
});
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=privateuserh/privdmi" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |