nagasurendra commited on
Commit
ed0976b
·
verified ·
1 Parent(s): e7d49fa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -283,6 +283,15 @@ button {
283
  document.getElementById('final-order').innerHTML = finalOrderHTML;
284
  alert("Your final order has been submitted!");
285
  }
 
 
 
 
 
 
 
 
 
286
  </script>
287
  """
288
  # Authentication and Navigation Logic
@@ -437,9 +446,10 @@ def app():
437
  outputs=[menu_section, cart_section],
438
  )
439
  view_cart_button_bottom.click(
440
- lambda: (gr.update(visible=False), gr.update(visible=True)),
441
- outputs=[menu_section, cart_section],
442
  )
 
443
  # Navigate Back to Menu Page
444
  back_to_menu_button.click(
445
  lambda: (gr.update(visible=True), gr.update(visible=False)),
 
283
  document.getElementById('final-order').innerHTML = finalOrderHTML;
284
  alert("Your final order has been submitted!");
285
  }
286
+ function navigateToCart() {
287
+ // Hide the menu section and show the cart section
288
+ document.querySelector(".gr-Column.menu_section").style.display = "none";
289
+ document.querySelector(".gr-Column.cart_section").style.display = "block";
290
+
291
+ // Scroll to the top of the page
292
+ window.scrollTo({ top: 0, behavior: 'smooth' });
293
+ }
294
+
295
  </script>
296
  """
297
  # Authentication and Navigation Logic
 
446
  outputs=[menu_section, cart_section],
447
  )
448
  view_cart_button_bottom.click(
449
+ lambda: (gr.update(visible=False), gr.update(visible=True), gr.update(value="<script>navigateToCart()</script>")),
450
+ outputs=[menu_section, cart_section, gr.HTML()],
451
  )
452
+
453
  # Navigate Back to Menu Page
454
  back_to_menu_button.click(
455
  lambda: (gr.update(visible=True), gr.update(visible=False)),