Jaafarsa commited on
Commit
89bb2c3
·
verified ·
1 Parent(s): cdeb7d4

Add a chat functionality to the live stream component, allowing viewers to interact with the seller and each other during broadcasts. And buyer can buy anything during broadcast.

Browse files
Files changed (1) hide show
  1. index.html +145 -1
index.html CHANGED
@@ -461,9 +461,114 @@
461
  </div>
462
  </div>
463
  </section>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
464
 
465
  <!-- CTA Section -->
466
- <section class="py-20 px-4 bg-gradient-to-r from-gray-800 to-gray-900">
467
  <div class="max-w-4xl mx-auto text-center">
468
  <h2 class="text-3xl md:text-5xl font-bold mb-6">
469
  Ready to Join the <span class="gradient-text">YourHand.co</span> Community?
@@ -481,6 +586,45 @@
481
  </div>
482
  </div>
483
  </section>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
484
 
485
  <!-- Footer -->
486
  <footer class="bg-gray-900 border-t border-gray-800 py-12 px-4 relative z-10">
 
461
  </div>
462
  </div>
463
  </section>
464
+ <!-- Live Stream Marketplace Section -->
465
+ <section class="py-16 px-4 bg-gray-800">
466
+ <div class="max-w-7xl mx-auto">
467
+ <div class="flex items-center justify-between mb-10">
468
+ <h2 class="text-3xl font-bold">
469
+ <span class="gradient-text">Live Shopping</span> Broadcasts
470
+ </h2>
471
+ <a href="#" class="flex items-center text-primary-500 hover:text-primary-400 transition">
472
+ View all <i data-feather="chevron-right" class="ml-1 w-5 h-5"></i>
473
+ </a>
474
+ </div>
475
+
476
+ <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
477
+ <!-- Live Stream Card -->
478
+ <div class="bg-gray-700 rounded-xl overflow-hidden shadow-lg">
479
+ <div class="relative h-96 overflow-hidden">
480
+ <div class="absolute inset-0 bg-black bg-opacity-50 flex items-center justify-center">
481
+ <div class="text-center">
482
+ <i data-feather="play-circle" class="w-16 h-16 text-primary-500 mx-auto mb-4"></i>
483
+ <span class="text-white text-xl font-bold">Live Now</span>
484
+ </div>
485
+ </div>
486
+ <img src="http://static.photos/workspace/1024x576/1" alt="Live Stream" class="w-full h-full object-cover">
487
+ <div class="absolute bottom-4 left-4 bg-red-500 text-white px-2 py-1 rounded-full text-xs font-bold">
488
+ LIVE
489
+ </div>
490
+ <div class="absolute bottom-4 right-4 bg-gray-900 text-white px-2 py-1 rounded-full text-xs font-bold">
491
+ 128 Viewers
492
+ </div>
493
+ </div>
494
+ <div class="p-4 h-64 flex flex-col">
495
+ <div class="flex items-center mb-4">
496
+ <div class="w-10 h-10 rounded-full overflow-hidden mr-3">
497
+ <img src="http://static.photos/people/200x200/8" alt="Seller" class="w-full h-full object-cover">
498
+ </div>
499
+ <div>
500
+ <h4 class="font-bold">CraftyHands Studio</h4>
501
+ <p class="text-sm text-gray-400">Macrame & Home Decor</p>
502
+ </div>
503
+ </div>
504
+
505
+ <!-- Chat Section -->
506
+ <div class="flex-1 bg-gray-800 rounded-lg overflow-hidden flex flex-col">
507
+ <div id="chatMessages" class="flex-1 p-3 space-y-2 overflow-y-auto text-sm">
508
+ <div class="bg-gray-700 rounded-lg p-2 max-w-xs">
509
+ <span class="font-bold text-primary-500">Sarah:</span> Love that wall hanging!
510
+ </div>
511
+ <div class="bg-gray-700 rounded-lg p-2 max-w-xs ml-auto">
512
+ <span class="font-bold text-green-500">Seller:</span> Thanks! It's 100% handmade.
513
+ </div>
514
+ </div>
515
+ <div class="border-t border-gray-700 p-2">
516
+ <div class="flex">
517
+ <input type="text" placeholder="Type your message..."
518
+ class="flex-1 bg-gray-700 border border-gray-600 rounded-l-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-primary-500">
519
+ <button class="bg-primary-500 hover:bg-primary-600 text-white px-3 py-2 rounded-r-lg transition">
520
+ <i data-feather="send" class="w-4 h-4"></i>
521
+ </button>
522
+ </div>
523
+ </div>
524
+ </div>
525
+
526
+ <!-- Buy Now Button -->
527
+ <button class="mt-4 w-full bg-primary-500 hover:bg-primary-600 text-white font-bold py-2 px-4 rounded-lg transition">
528
+ Buy Now - $45.00
529
+ </button>
530
+ </div>
531
+ </div>
532
+
533
+ <!-- Upcoming Streams -->
534
+ <div>
535
+ <h3 class="text-xl font-bold mb-4">Upcoming Streams</h3>
536
+ <div class="space-y-4">
537
+ <!-- Upcoming Stream 1 -->
538
+ <div class="bg-gray-700 rounded-lg p-4 flex items-center">
539
+ <div class="w-16 h-16 rounded-lg overflow-hidden mr-3">
540
+ <img src="http://static.photos/craft/200x200/5" alt="Upcoming" class="w-full h-full object-cover">
541
+ </div>
542
+ <div class="flex-1">
543
+ <h4 class="font-bold">Pottery Workshop</h4>
544
+ <p class="text-sm text-gray-400">Tomorrow, 3PM EST</p>
545
+ </div>
546
+ <button class="bg-gray-600 hover:bg-gray-500 text-white px-3 py-1 rounded-lg text-sm transition">
547
+ Remind Me
548
+ </button>
549
+ </div>
550
+
551
+ <!-- Upcoming Stream 2 -->
552
+ <div class="bg-gray-700 rounded-lg p-4 flex items-center">
553
+ <div class="w-16 h-16 rounded-lg overflow-hidden mr-3">
554
+ <img src="http://static.photos/food/200x200/5" alt="Upcoming" class="w-full h-full object-cover">
555
+ </div>
556
+ <div class="flex-1">
557
+ <h4 class="font-bold">Bakery Surprise Box</h4>
558
+ <p class="text-sm text-gray-400">Friday, 10AM EST</p>
559
+ </div>
560
+ <button class="bg-gray-600 hover:bg-gray-500 text-white px-3 py-1 rounded-lg text-sm transition">
561
+ Remind Me
562
+ </button>
563
+ </div>
564
+ </div>
565
+ </div>
566
+ </div>
567
+ </div>
568
+ </section>
569
 
570
  <!-- CTA Section -->
571
+ <section class="py-20 px-4 bg-gradient-to-r from-gray-800 to-gray-900">
572
  <div class="max-w-4xl mx-auto text-center">
573
  <h2 class="text-3xl md:text-5xl font-bold mb-6">
574
  Ready to Join the <span class="gradient-text">YourHand.co</span> Community?
 
586
  </div>
587
  </div>
588
  </section>
589
+ <!-- Add Live Stream Script -->
590
+ <script>
591
+ // Live stream chat functionality
592
+ const chatMessages = document.getElementById('chatMessages');
593
+ const chatInput = document.querySelector('#chatMessages + div input');
594
+ const chatSendBtn = document.querySelector('#chatMessages + div button');
595
+
596
+ chatSendBtn.addEventListener('click', () => {
597
+ if (chatInput.value.trim() !== '') {
598
+ const messageDiv = document.createElement('div');
599
+ messageDiv.className = 'bg-gray-700 rounded-lg p-2 max-w-xs ml-auto';
600
+ messageDiv.innerHTML = `<span class="font-bold">You:</span> ${chatInput.value}`;
601
+ chatMessages.appendChild(messageDiv);
602
+ chatInput.value = '';
603
+ chatMessages.scrollTop = chatMessages.scrollHeight;
604
+ }
605
+ });
606
+
607
+ // Simulate incoming messages
608
+ setInterval(() => {
609
+ const messages = [
610
+ {user: 'Alex', text: 'How long did that take to make?'},
611
+ {user: 'Seller', text: 'About 8 hours total work!', isSeller: true},
612
+ {user: 'Jamie', text: 'Do you do custom colors?'},
613
+ {user: 'Taylor', text: 'Just bought one - so excited!'}
614
+ ];
615
+
616
+ const randomMsg = messages[Math.floor(Math.random() * messages.length)];
617
+ const messageDiv = document.createElement('div');
618
+ messageDiv.className = 'bg-gray-700 rounded-lg p-2 max-w-xs';
619
+ if (randomMsg.isSeller) {
620
+ messageDiv.innerHTML = `<span class="font-bold text-green-500">Seller:</span> ${randomMsg.text}`;
621
+ } else {
622
+ messageDiv.innerHTML = `<span class="font-bold text-primary-500">${randomMsg.user}:</span> ${randomMsg.text}`;
623
+ }
624
+ chatMessages.appendChild(messageDiv);
625
+ chatMessages.scrollTop = chatMessages.scrollHeight;
626
+ }, 10000);
627
+ </script>
628
 
629
  <!-- Footer -->
630
  <footer class="bg-gray-900 border-t border-gray-800 py-12 px-4 relative z-10">