nagasurendra commited on
Commit
c99d0cb
·
verified ·
1 Parent(s): 7096fc1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -306,23 +306,22 @@ def navigate_to_login():
306
 
307
  def app():
308
  with gr.Blocks() as demo:
 
 
 
 
 
 
 
 
 
309
 
310
  # Cart & Final Order Page (Always at the Top)
311
- with gr.Row(visible=False) as cart_section:
312
- gr.Column(visible=True)
313
  gr.Markdown("### Cart & Final Order Page (Always at the Top)")
314
-
315
- # Floating cart display
316
  cart_output = gr.HTML(value="Your cart is empty.", elem_id="floating-cart")
317
-
318
- # Final order display
319
  final_order_output = gr.HTML(value="", elem_id="final-order")
320
-
321
- # Button to navigate back to Menu Page
322
  back_to_menu_button = gr.Button("Back to Menu")
323
-
324
- gr.Row(cart_output)
325
- gr.Row(final_order_output)
326
  # Login Page
327
  with gr.Column(visible=True) as login_section:
328
  gr.Markdown("# Login Page")
@@ -402,7 +401,8 @@ def app():
402
  gr.Row(view_cart_button_top) # View Cart button at the top
403
  gr.Row([selected_preference])
404
  gr.Row(menu_output)
405
- gr.Row(view_cart_button_bottom) # View Cart button at the bottom
 
406
  gr.Row(modal_window)
407
  gr.HTML(modal_and_cart_js)
408
 
 
306
 
307
  def app():
308
  with gr.Blocks() as demo:
309
+ # JavaScript for scrolling to the top
310
+ scroll_to_top_js = """
311
+ <script>
312
+ function scrollToTop() {
313
+ document.body.scrollTop = 0; // For Safari
314
+ document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE, and Opera
315
+ }
316
+ </script>
317
+ """
318
 
319
  # Cart & Final Order Page (Always at the Top)
320
+ with gr.Column(visible=False) as cart_section:
 
321
  gr.Markdown("### Cart & Final Order Page (Always at the Top)")
 
 
322
  cart_output = gr.HTML(value="Your cart is empty.", elem_id="floating-cart")
 
 
323
  final_order_output = gr.HTML(value="", elem_id="final-order")
 
 
324
  back_to_menu_button = gr.Button("Back to Menu")
 
 
 
325
  # Login Page
326
  with gr.Column(visible=True) as login_section:
327
  gr.Markdown("# Login Page")
 
401
  gr.Row(view_cart_button_top) # View Cart button at the top
402
  gr.Row([selected_preference])
403
  gr.Row(menu_output)
404
+ gr.Row(view_cart_button_bottom)
405
+ gr.HTML(scroll_to_top_js)# View Cart button at the bottom
406
  gr.Row(modal_window)
407
  gr.HTML(modal_and_cart_js)
408