Spaces:
Build error
Build error
Update app.py
Browse files128 unmodified lines129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171163 unmodified lines335336337338339340341342128 unmodified lines};let finalized = false;function openModal(name, image, description, price) {if (finalized) {alert("You cannot add more items after finalizing your order.");return;}const modal = document.getElementById('modal');const buttonRect = event.target.getBoundingClientRect(); // Get button position// Set modal width based on device sizeif (window.innerWidth <= 768) {modal.style.width = '90%'; // For mobile devices} else {modal.style.width = '30%'; // For laptops and larger screens}const modalWidth = modal.offsetWidth;const modalHeight = modal.offsetHeight;// Dynamically calculate modal positionconst modalTop = window.scrollY + buttonRect.top + buttonRect.height / 2 - modalHeight / 2;const modalLeft = window.scrollX + buttonRect.left + buttonRect.width / 2 - modalWidth / 2;// Apply positioning stylesmodal.style.display = 'block';modal.style.top = `${modalTop}px`;modal.style.left = `${modalLeft}px`;// Populate modal contentdocument.getElementById('modal-image').src = image;document.getElementById('modal-name').innerText = name;document.getElementById('modal-description').innerText = description;document.getElementById('modal-price').innerText = `$${price}`;// Reset inputsdocument.getElementById('quantity').value = 1;document.getElementById('special-instructions').value = '';}function closeModal() {document.getElementById('modal').style.display = 'none';163 unmodified lines# Modal windowmodal_window = gr.HTML("""<div id="modal" style="display: none; position: absolute; background: white; border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); padding: 20px; z-index: 1000;"><div style="text-align: right;"><button onclick="closeModal()" style="background: none; border: none; font-size: 18px; cursor: pointer;">×</button></div><img id="modal-image" style="width: 100%; height: auto; border-radius: 8px; margin-bottom: 20px;" />128 unmodified lines129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 unmodified lines326327328329330331332333128 unmodified lines};let finalized = false;function openModal(name, image, description, price) {const modal = document.getElementById('modal');const buttonRect = event.target.getBoundingClientRect();if (window.innerWidth <= 768) {modal.style.width = '90%';} else {modal.style.width = '30%';}const modalTop = window.scrollY + buttonRect.top + buttonRect.height + 20;const modalLeft = window.scrollX + buttonRect.left + buttonRect.width / 2 - modal.offsetWidth / 2;modal.style.display = 'block';modal.style.position = 'absolute';modal.style.top = `${modalTop}px`;modal.style.left = `${modalLeft}px`;document.getElementById('modal-name').innerText = name;document.getElementById('modal-image').src = image;document.getElementById('modal-description').innerText = description;document.getElementById('modal-price').innerText = `$${price}`;}function closeModal() {document.getElementById('modal').style.display = 'none';}</script>function closeModal() {document.getElementById('modal').style.display = 'none';163 unmodified lines# Modal windowmodal_window = gr.HTML("""<div id="modal" style="display: none; position: absolute; background: white; border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); padding: 20px; z-index: 1000;"><div style="text-align: right;"><button onclick="closeModal()" style="background: none; border: none; font-size: 18px; cursor: pointer;">×</button></div><img id="modal-image" style="width: 100%; height: auto; border-radius: 8px; margin-bottom: 20px;" />
app.py+16-25