Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -286,15 +286,12 @@ button {
|
|
286 |
</script>
|
287 |
"""
|
288 |
def app():
|
289 |
-
with gr.Blocks(
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
</script>
|
296 |
-
""")
|
297 |
-
|
298 |
# Login Page
|
299 |
with gr.Column(visible=True) as login_section:
|
300 |
gr.Markdown("# Login Page")
|
@@ -374,7 +371,7 @@ def app():
|
|
374 |
gr.HTML(modal_and_cart_js)
|
375 |
|
376 |
# Cart & Final Order Page
|
377 |
-
with gr.Column(visible=False) as cart_section:
|
378 |
gr.Markdown("### Cart & Final Order Page")
|
379 |
|
380 |
# Floating cart display
|
@@ -417,20 +414,6 @@ def app():
|
|
417 |
lambda: (gr.update(visible=False), gr.update(visible=True)),
|
418 |
outputs=[menu_section, cart_section],
|
419 |
)
|
420 |
-
# Inject Scroll-to-Top Trigger
|
421 |
-
gr.HTML("""
|
422 |
-
<script>
|
423 |
-
// Listen for view cart button click and reset scroll position
|
424 |
-
const viewCartButton = document.querySelector('button:contains("View Cart")');
|
425 |
-
if (viewCartButton) {
|
426 |
-
viewCartButton.addEventListener("click", () => {
|
427 |
-
setTimeout(() => {
|
428 |
-
scrollToTop(); // Reset scroll position when transitioning to Cart Page
|
429 |
-
}, 100); // Ensure transition happens before scrolling
|
430 |
-
});
|
431 |
-
}
|
432 |
-
</script>
|
433 |
-
""")
|
434 |
# Navigate Back to Menu Page
|
435 |
back_to_menu_button.click(
|
436 |
lambda: (gr.update(visible=True), gr.update(visible=False)),
|
|
|
286 |
</script>
|
287 |
"""
|
288 |
def app():
|
289 |
+
with gr.Blocks(css="""
|
290 |
+
#cart-section {
|
291 |
+
height: 760px; /* Fixed height for the Cart Page */
|
292 |
+
overflow-y: auto; /* Enable scrolling if content exceeds height */
|
293 |
+
}
|
294 |
+
""") as demo:
|
|
|
|
|
|
|
295 |
# Login Page
|
296 |
with gr.Column(visible=True) as login_section:
|
297 |
gr.Markdown("# Login Page")
|
|
|
371 |
gr.HTML(modal_and_cart_js)
|
372 |
|
373 |
# Cart & Final Order Page
|
374 |
+
with gr.Column(visible=False, elem_id="cart-section") as cart_section:
|
375 |
gr.Markdown("### Cart & Final Order Page")
|
376 |
|
377 |
# Floating cart display
|
|
|
414 |
lambda: (gr.update(visible=False), gr.update(visible=True)),
|
415 |
outputs=[menu_section, cart_section],
|
416 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
417 |
# Navigate Back to Menu Page
|
418 |
back_to_menu_button.click(
|
419 |
lambda: (gr.update(visible=True), gr.update(visible=False)),
|