Spaces:
Sleeping
Sleeping
Update app.py
Browse files140 unmodified lines1411421431441451461471481491501511524 unmodified lines157158159160161162163164165166167168169170171172173174175176177140 unmodified linespopup_js = """<script>function showPopup(image, title, description, price) {const popup = document.getElementById("custom-popup");document.getElementById("popup-image").src = image;document.getElementById("popup-title").innerText = title;document.getElementById("popup-description").innerText = description;document.getElementById("popup-price").innerText = price;popup.style.display = "block";}4 unmodified lines</script>"""# HTML for the popup containerpopup_html = """<div id="custom-popup"style="position: fixed; display: none; top: 50%; left: 50%; transform: translate(-50%, -50%);background: white; border: 1px solid black; padding: 20px; z-index: 1000;box-shadow: 0 4px 8px rgba(0,0,0,0.2); border-radius: 10px; text-align: center; width: 400px;"><img id="popup-image" src="" alt="" style="width: 100%; height: auto; border-radius: 5px;"><h2 id="popup-title" style="margin-top: 10px; color: #444;"></h2><p id="popup-description" style="font-size: 14px; color: #666;"></p><p id="popup-price" style="font-size: 16px; color: #444;"></p><button onclick="hidePopup()" style="margin-top: 15px; padding: 10px 20px; background-color: #007bff; color: white;border: none; border-radius: 5px; cursor: pointer;">Close</button></div>"""# Filter dishes by categorydef filter_dishes(category):if category == "ALL":140 unmodified lines1411421431441451461471481491501511521531541551561571581591601611621634 unmodified lines168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203140 unmodified linespopup_js = """<script>let cursorX = 0;let cursorY = 0;document.addEventListener("mousemove", (event) => {cursorX = event.clientX;cursorY = event.clientY;});function showPopup(name, description, price) {const popup = document.getElementById("custom-popup");popup.style.left = cursorX + "px";popup.style.top = cursorY + "px";popup.innerHTML = `<h3 style="margin: 0;">${name}</h3><p style="margin: 5px 0;">${description}</p><p style="margin: 5px 0; font-weight: bold;">Price: ${price}</p>`;popup.style.display = "block";}4 unmodified lines</script>"""# HTML for popup containerpopup_html = """<div id="custom-popup"style="position: fixed; display: none; background: white; border: 1px solid black;padding: 10px; z-index: 1000; border-radius: 10px; box-shadow: 0px 4px 6px rgba(0,0,0,0.1);"></div>"""# Generate dish cardsdef display_dishes(category):html_content = "<div style='display: flex; flex-wrap: wrap; justify-content: space-between;'>"for dish in menu_data:if category == "ALL" or dish["category"] == category:html_content += f"""<div style='margin: 10px; width: 30%; border: 1px solid #ddd; border-radius: 10px; padding: 10px;'><img src='{dish['image']}' alt='{dish['name']}'style='width: 100%; height: auto; border-radius: 5px;'><h3>{dish['name']}</h3><p>{dish['description']}</p><p>Price: {dish['price']}</p><button onclick="showPopup('{dish['name']}', '{dish['description']}', '{dish['price']}')"style='background-color: #007bff; color: white; border: none; padding: 5px 10px; cursor: pointer;'>Add</button></div>"""html_content += "</div>"return html_content# Filter dishes by categorydef filter_dishes(category):if category == "ALL":
app.py+41-15