nagasurendra commited on
Commit
c32d07a
·
verified ·
1 Parent(s): aaf2fd0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -18
app.py CHANGED
@@ -303,8 +303,7 @@ def create_account(name, phone, email, password):
303
 
304
  def navigate_to_login():
305
  return gr.update(visible=True), gr.update(visible=False)
306
-
307
- # Gradio App
308
  def app():
309
  with gr.Blocks() as demo:
310
  # Login Page
@@ -337,19 +336,14 @@ def app():
337
  value="All",
338
  label="Choose a Preference",
339
  )
340
-
341
-
342
 
343
  # Output area for menu items
344
  menu_output = gr.HTML(value=filter_menu("All"))
345
- # Floating cart display
346
- cart_output = gr.HTML(value="Your cart is empty.", elem_id="floating-cart")
347
- final_order_output = gr.HTML(value="", elem_id="final-order")
348
-
349
- view_cart_button = gr.Button("View Cart")
350
-
351
 
 
 
352
 
 
353
  # Modal window
354
  modal_window = gr.HTML("""
355
  <div id="modal" style="display: none; position: fixed; background: white; border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); padding: 20px; z-index: 1000;">
@@ -387,17 +381,20 @@ def app():
387
  # Layout
388
  gr.Row([selected_preference])
389
  gr.Row(menu_output)
390
- gr.Row(cart_output)
391
  gr.Row(view_cart_button)
392
  gr.Row(modal_window)
393
- gr.Row(final_order_output)
394
  gr.HTML(modal_and_cart_js)
395
- with gr.Column(visible=False) as cart_section:
396
- gr.Markdown("### Your Cart")
397
- gr.Row(cart_output) # Displays the cart contents
398
- gr.Row(final_order_output) # Displays the final order summary
 
399
  back_to_menu_button = gr.Button("Back to Menu")
400
 
 
 
 
 
401
  # Button Bindings
402
  # Button Logic
403
  login_button.click(
@@ -418,13 +415,13 @@ def app():
418
  lambda: (gr.update(visible=True), gr.update(visible=False)),
419
  outputs=[login_section, signup_section],
420
  )
421
- # Logic for View Cart Button
422
  view_cart_button.click(
423
  lambda: (gr.update(visible=False), gr.update(visible=True)),
424
  outputs=[menu_section, cart_section],
425
  )
426
 
427
- # Logic for Back to Menu Button
428
  back_to_menu_button.click(
429
  lambda: (gr.update(visible=True), gr.update(visible=False)),
430
  outputs=[menu_section, cart_section],
 
303
 
304
  def navigate_to_login():
305
  return gr.update(visible=True), gr.update(visible=False)
306
+
 
307
  def app():
308
  with gr.Blocks() as demo:
309
  # Login Page
 
336
  value="All",
337
  label="Choose a Preference",
338
  )
 
 
339
 
340
  # Output area for menu items
341
  menu_output = gr.HTML(value=filter_menu("All"))
 
 
 
 
 
 
342
 
343
+ # "View Cart" button
344
+ view_cart_button = gr.Button("View Cart")
345
 
346
+
347
  # Modal window
348
  modal_window = gr.HTML("""
349
  <div id="modal" style="display: none; position: fixed; background: white; border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); padding: 20px; z-index: 1000;">
 
381
  # Layout
382
  gr.Row([selected_preference])
383
  gr.Row(menu_output)
 
384
  gr.Row(view_cart_button)
385
  gr.Row(modal_window)
 
386
  gr.HTML(modal_and_cart_js)
387
+
388
+ with gr.Column(visible=False) as cart_section:
389
+ gr.Markdown("### Cart Page")
390
+ cart_output = gr.HTML(value="Your cart is empty.", elem_id="cart-output")
391
+ final_order_output = gr.HTML(value="", elem_id="final-order")
392
  back_to_menu_button = gr.Button("Back to Menu")
393
 
394
+ gr.Row(cart_output)
395
+ gr.Row(final_order_output)
396
+ gr.Row(back_to_menu_button)
397
+
398
  # Button Bindings
399
  # Button Logic
400
  login_button.click(
 
415
  lambda: (gr.update(visible=True), gr.update(visible=False)),
416
  outputs=[login_section, signup_section],
417
  )
418
+ # Navigation from "View Cart" button to Cart Page
419
  view_cart_button.click(
420
  lambda: (gr.update(visible=False), gr.update(visible=True)),
421
  outputs=[menu_section, cart_section],
422
  )
423
 
424
+ # Navigation from Cart Page back to Menu Page
425
  back_to_menu_button.click(
426
  lambda: (gr.update(visible=True), gr.update(visible=False)),
427
  outputs=[menu_section, cart_section],