add the google map to let the buyer see what the products are close to them. and what the product far away.
Browse files- index.html +185 -6
index.html
CHANGED
|
@@ -101,10 +101,12 @@
|
|
| 101 |
</div>
|
| 102 |
</div>
|
| 103 |
</section>
|
| 104 |
-
|
| 105 |
<!-- Marketplace Section -->
|
| 106 |
<section id="marketplace" class="py-16 px-4 bg-gray-800">
|
| 107 |
-
<div class="max-w-7xl mx-auto">
|
|
|
|
|
|
|
|
|
|
| 108 |
<div class="flex items-center justify-between mb-10">
|
| 109 |
<h2 class="text-3xl font-bold">
|
| 110 |
<span class="gradient-text">Etsy-style</span> Marketplace
|
|
@@ -269,10 +271,12 @@
|
|
| 269 |
</div>
|
| 270 |
</div>
|
| 271 |
</section>
|
| 272 |
-
|
| 273 |
<!-- Food Rescue Section -->
|
| 274 |
<section id="food-rescue" class="py-16 px-4 bg-gray-900">
|
| 275 |
-
<div class="max-w-7xl mx-auto">
|
|
|
|
|
|
|
|
|
|
| 276 |
<div class="flex items-center justify-between mb-10">
|
| 277 |
<h2 class="text-3xl font-bold">
|
| 278 |
<span class="gradient-text">Too Good To Go</span> Style Food Rescue
|
|
@@ -629,9 +633,184 @@
|
|
| 629 |
</div>
|
| 630 |
</div>
|
| 631 |
</section>
|
| 632 |
-
<!-- Add Live Stream Script -->
|
|
|
|
| 633 |
<script>
|
| 634 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 635 |
const chatMessages = document.getElementById('chatMessages');
|
| 636 |
const chatInput = document.querySelector('#chatMessages + div input');
|
| 637 |
const chatSendBtn = document.querySelector('#chatMessages + div button');
|
|
|
|
| 101 |
</div>
|
| 102 |
</div>
|
| 103 |
</section>
|
|
|
|
| 104 |
<!-- Marketplace Section -->
|
| 105 |
<section id="marketplace" class="py-16 px-4 bg-gray-800">
|
| 106 |
+
<div class="max-w-7xl mx-auto mb-10">
|
| 107 |
+
<div id="map" class="h-96 rounded-xl overflow-hidden shadow-lg"></div>
|
| 108 |
+
</div>
|
| 109 |
+
<div class="max-w-7xl mx-auto">
|
| 110 |
<div class="flex items-center justify-between mb-10">
|
| 111 |
<h2 class="text-3xl font-bold">
|
| 112 |
<span class="gradient-text">Etsy-style</span> Marketplace
|
|
|
|
| 271 |
</div>
|
| 272 |
</div>
|
| 273 |
</section>
|
|
|
|
| 274 |
<!-- Food Rescue Section -->
|
| 275 |
<section id="food-rescue" class="py-16 px-4 bg-gray-900">
|
| 276 |
+
<div class="max-w-7xl mx-auto mb-10">
|
| 277 |
+
<div id="foodMap" class="h-96 rounded-xl overflow-hidden shadow-lg"></div>
|
| 278 |
+
</div>
|
| 279 |
+
<div class="max-w-7xl mx-auto">
|
| 280 |
<div class="flex items-center justify-between mb-10">
|
| 281 |
<h2 class="text-3xl font-bold">
|
| 282 |
<span class="gradient-text">Too Good To Go</span> Style Food Rescue
|
|
|
|
| 633 |
</div>
|
| 634 |
</div>
|
| 635 |
</section>
|
| 636 |
+
<!-- Add Google Maps and Live Stream Script -->
|
| 637 |
+
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMaps" async defer></script>
|
| 638 |
<script>
|
| 639 |
+
// Initialize Maps
|
| 640 |
+
function initMaps() {
|
| 641 |
+
// Marketplace Map
|
| 642 |
+
const marketplaceMap = new google.maps.Map(document.getElementById("map"), {
|
| 643 |
+
center: { lat: 40.7128, lng: -74.0060 }, // Default to NYC
|
| 644 |
+
zoom: 12,
|
| 645 |
+
styles: [
|
| 646 |
+
{ elementType: "geometry", stylers: [{ color: "#242f3e" }] },
|
| 647 |
+
{ elementType: "labels.text.stroke", stylers: [{ color: "#242f3e" }] },
|
| 648 |
+
{ elementType: "labels.text.fill", stylers: [{ color: "#746855" }] },
|
| 649 |
+
]
|
| 650 |
+
});
|
| 651 |
+
|
| 652 |
+
// Food Rescue Map
|
| 653 |
+
const foodMap = new google.maps.Map(document.getElementById("foodMap"), {
|
| 654 |
+
center: { lat: 40.7128, lng: -74.0060 }, // Default to NYC
|
| 655 |
+
zoom: 12,
|
| 656 |
+
styles: [
|
| 657 |
+
{ elementType: "geometry", stylers: [{ color: "#242f3e" }] },
|
| 658 |
+
{ elementType: "labels.text.stroke", stylers: [{ color: "#242f3e" }] },
|
| 659 |
+
{ elementType: "labels.text.fill", stylers: [{ color: "#746855" }] },
|
| 660 |
+
]
|
| 661 |
+
});
|
| 662 |
+
|
| 663 |
+
// Sample markers for marketplace products
|
| 664 |
+
const marketplaceMarkers = [
|
| 665 |
+
{
|
| 666 |
+
position: { lat: 40.7128, lng: -74.0060 },
|
| 667 |
+
title: "Handwoven Macrame Wall Hanging",
|
| 668 |
+
price: "$45",
|
| 669 |
+
image: "http://static.photos/craft/200x200/1"
|
| 670 |
+
},
|
| 671 |
+
{
|
| 672 |
+
position: { lat: 40.7145, lng: -74.0082 },
|
| 673 |
+
title: "Hand-thrown Ceramic Mug Set",
|
| 674 |
+
price: "$28",
|
| 675 |
+
image: "http://static.photos/craft/200x200/2"
|
| 676 |
+
},
|
| 677 |
+
{
|
| 678 |
+
position: { lat: 40.7200, lng: -73.9900 },
|
| 679 |
+
title: "Hand-stitched Leather Wallet",
|
| 680 |
+
price: "$75",
|
| 681 |
+
image: "http://static.photos/craft/200x200/3"
|
| 682 |
+
}
|
| 683 |
+
];
|
| 684 |
+
|
| 685 |
+
// Sample markers for food rescue
|
| 686 |
+
const foodMarkers = [
|
| 687 |
+
{
|
| 688 |
+
position: { lat: 40.7150, lng: -74.0020 },
|
| 689 |
+
title: "Fresh Bakery Surprise Bag",
|
| 690 |
+
price: "$3.99",
|
| 691 |
+
image: "http://static.photos/food/200x200/1"
|
| 692 |
+
},
|
| 693 |
+
{
|
| 694 |
+
position: { lat: 40.7180, lng: -73.9990 },
|
| 695 |
+
title: "Vegetarian Lunch Box",
|
| 696 |
+
price: "$4.80",
|
| 697 |
+
image: "http://static.photos/food/200x200/2"
|
| 698 |
+
}
|
| 699 |
+
];
|
| 700 |
+
|
| 701 |
+
// Add marketplace markers
|
| 702 |
+
marketplaceMarkers.forEach(markerInfo => {
|
| 703 |
+
const marker = new google.maps.Marker({
|
| 704 |
+
position: markerInfo.position,
|
| 705 |
+
map: marketplaceMap,
|
| 706 |
+
title: markerInfo.title,
|
| 707 |
+
icon: {
|
| 708 |
+
url: markerInfo.image,
|
| 709 |
+
scaledSize: new google.maps.Size(40, 40),
|
| 710 |
+
origin: new google.maps.Point(0, 0),
|
| 711 |
+
anchor: new google.maps.Point(20, 20)
|
| 712 |
+
}
|
| 713 |
+
});
|
| 714 |
+
|
| 715 |
+
const infowindow = new google.maps.InfoWindow({
|
| 716 |
+
content: `<div class="text-gray-900">
|
| 717 |
+
<img src="${markerInfo.image}" class="w-16 h-16 object-cover mb-2">
|
| 718 |
+
<h4 class="font-bold">${markerInfo.title}</h4>
|
| 719 |
+
<p>Price: ${markerInfo.price}</p>
|
| 720 |
+
<a href="#marketplace" class="text-primary-500 hover:underline">View Product</a>
|
| 721 |
+
</div>`
|
| 722 |
+
});
|
| 723 |
+
|
| 724 |
+
marker.addListener("click", () => {
|
| 725 |
+
infowindow.open(marketplaceMap, marker);
|
| 726 |
+
});
|
| 727 |
+
});
|
| 728 |
+
|
| 729 |
+
// Add food rescue markers
|
| 730 |
+
foodMarkers.forEach(markerInfo => {
|
| 731 |
+
const marker = new google.maps.Marker({
|
| 732 |
+
position: markerInfo.position,
|
| 733 |
+
map: foodMap,
|
| 734 |
+
title: markerInfo.title,
|
| 735 |
+
icon: {
|
| 736 |
+
url: markerInfo.image,
|
| 737 |
+
scaledSize: new google.maps.Size(40, 40),
|
| 738 |
+
origin: new google.maps.Point(0, 0),
|
| 739 |
+
anchor: new google.maps.Point(20, 20)
|
| 740 |
+
}
|
| 741 |
+
});
|
| 742 |
+
|
| 743 |
+
const infowindow = new google.maps.InfoWindow({
|
| 744 |
+
content: `<div class="text-gray-900">
|
| 745 |
+
<img src="${markerInfo.image}" class="w-16 h-16 object-cover mb-2">
|
| 746 |
+
<h4 class="font-bold">${markerInfo.title}</h4>
|
| 747 |
+
<p>Price: ${markerInfo.price}</p>
|
| 748 |
+
<a href="#food-rescue" class="text-primary-500 hover:underline">View Offer</a>
|
| 749 |
+
</div>`
|
| 750 |
+
});
|
| 751 |
+
|
| 752 |
+
marker.addListener("click", () => {
|
| 753 |
+
infowindow.open(foodMap, marker);
|
| 754 |
+
});
|
| 755 |
+
});
|
| 756 |
+
|
| 757 |
+
// Try HTML5 geolocation to center map on user
|
| 758 |
+
if (navigator.geolocation) {
|
| 759 |
+
navigator.geolocation.getCurrentPosition(
|
| 760 |
+
(position) => {
|
| 761 |
+
const userPos = {
|
| 762 |
+
lat: position.coords.latitude,
|
| 763 |
+
lng: position.coords.longitude
|
| 764 |
+
};
|
| 765 |
+
|
| 766 |
+
// Center both maps on user location
|
| 767 |
+
marketplaceMap.setCenter(userPos);
|
| 768 |
+
foodMap.setCenter(userPos);
|
| 769 |
+
|
| 770 |
+
// Add user marker
|
| 771 |
+
new google.maps.Marker({
|
| 772 |
+
position: userPos,
|
| 773 |
+
map: marketplaceMap,
|
| 774 |
+
title: "Your Location",
|
| 775 |
+
icon: {
|
| 776 |
+
path: google.maps.SymbolPath.CIRCLE,
|
| 777 |
+
scale: 8,
|
| 778 |
+
fillColor: "#d946ef",
|
| 779 |
+
fillOpacity: 1,
|
| 780 |
+
strokeColor: "#fff",
|
| 781 |
+
strokeWeight: 2
|
| 782 |
+
}
|
| 783 |
+
});
|
| 784 |
+
|
| 785 |
+
new google.maps.Marker({
|
| 786 |
+
position: userPos,
|
| 787 |
+
map: foodMap,
|
| 788 |
+
title: "Your Location",
|
| 789 |
+
icon: {
|
| 790 |
+
path: google.maps.SymbolPath.CIRCLE,
|
| 791 |
+
scale: 8,
|
| 792 |
+
fillColor: "#d946ef",
|
| 793 |
+
fillOpacity: 1,
|
| 794 |
+
strokeColor: "#fff",
|
| 795 |
+
strokeWeight: 2
|
| 796 |
+
}
|
| 797 |
+
});
|
| 798 |
+
},
|
| 799 |
+
() => {
|
| 800 |
+
// Default to NYC if geolocation fails
|
| 801 |
+
marketplaceMap.setCenter({ lat: 40.7128, lng: -74.0060 });
|
| 802 |
+
foodMap.setCenter({ lat: 40.7128, lng: -74.0060 });
|
| 803 |
+
}
|
| 804 |
+
);
|
| 805 |
+
} else {
|
| 806 |
+
// Browser doesn't support Geolocation
|
| 807 |
+
marketplaceMap.setCenter({ lat: 40.7128, lng: -74.0060 });
|
| 808 |
+
foodMap.setCenter({ lat: 40.7128, lng: -74.0060 });
|
| 809 |
+
}
|
| 810 |
+
}
|
| 811 |
+
|
| 812 |
+
// Initialize feather icons
|
| 813 |
+
// Live stream chat functionality
|
| 814 |
const chatMessages = document.getElementById('chatMessages');
|
| 815 |
const chatInput = document.querySelector('#chatMessages + div input');
|
| 816 |
const chatSendBtn = document.querySelector('#chatMessages + div button');
|