Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -284,14 +284,9 @@ button {
|
|
| 284 |
alert("Your final order has been submitted!");
|
| 285 |
}
|
| 286 |
</script>
|
| 287 |
-
|
| 288 |
def app():
|
| 289 |
-
with gr.Blocks(
|
| 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")
|
|
@@ -322,14 +317,13 @@ def app():
|
|
| 322 |
value="All",
|
| 323 |
label="Choose a Preference",
|
| 324 |
)
|
| 325 |
-
|
|
|
|
| 326 |
view_cart_button = gr.Button("View Cart")
|
|
|
|
| 327 |
# Output area for menu items
|
| 328 |
menu_output = gr.HTML(value=filter_menu("All"))
|
| 329 |
|
| 330 |
-
# Button to navigate to Cart Page
|
| 331 |
-
view_cart_button = gr.Button("View Cart")
|
| 332 |
-
empty_div = gr.HTML('<div style="height: 300px;"></div>')
|
| 333 |
# Modal window
|
| 334 |
modal_window = gr.HTML("""
|
| 335 |
<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;">
|
|
@@ -361,17 +355,17 @@ def app():
|
|
| 361 |
<button style="background-color: #28a745; color: white; border: none; padding: 10px 20px; font-size: 14px; border-radius: 5px; cursor: pointer;" onclick="addToCart()">Add to Cart</button>
|
| 362 |
</div>
|
| 363 |
""")
|
| 364 |
-
# Update menu dynamically based on preference
|
| 365 |
-
selected_preference.change(filter_menu, inputs=[selected_preference], outputs=[menu_output])
|
| 366 |
|
| 367 |
# Layout
|
| 368 |
gr.Row([selected_preference])
|
|
|
|
| 369 |
gr.Row(menu_output)
|
|
|
|
| 370 |
gr.Row(modal_window)
|
| 371 |
gr.HTML(modal_and_cart_js)
|
| 372 |
|
| 373 |
# Cart & Final Order Page
|
| 374 |
-
with gr.Column(visible=False
|
| 375 |
gr.Markdown("### Cart & Final Order Page")
|
| 376 |
|
| 377 |
# Floating cart display
|
|
@@ -423,4 +417,4 @@ def app():
|
|
| 423 |
return demo
|
| 424 |
|
| 425 |
if __name__ == "__main__":
|
| 426 |
-
app().launch()
|
|
|
|
| 284 |
alert("Your final order has been submitted!");
|
| 285 |
}
|
| 286 |
</script>
|
| 287 |
+
# Gradio App
|
| 288 |
def app():
|
| 289 |
+
with gr.Blocks() as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 290 |
# Login Page
|
| 291 |
with gr.Column(visible=True) as login_section:
|
| 292 |
gr.Markdown("# Login Page")
|
|
|
|
| 317 |
value="All",
|
| 318 |
label="Choose a Preference",
|
| 319 |
)
|
| 320 |
+
|
| 321 |
+
# Add the same view_cart_button in both positions
|
| 322 |
view_cart_button = gr.Button("View Cart")
|
| 323 |
+
|
| 324 |
# Output area for menu items
|
| 325 |
menu_output = gr.HTML(value=filter_menu("All"))
|
| 326 |
|
|
|
|
|
|
|
|
|
|
| 327 |
# Modal window
|
| 328 |
modal_window = gr.HTML("""
|
| 329 |
<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;">
|
|
|
|
| 355 |
<button style="background-color: #28a745; color: white; border: none; padding: 10px 20px; font-size: 14px; border-radius: 5px; cursor: pointer;" onclick="addToCart()">Add to Cart</button>
|
| 356 |
</div>
|
| 357 |
""")
|
|
|
|
|
|
|
| 358 |
|
| 359 |
# Layout
|
| 360 |
gr.Row([selected_preference])
|
| 361 |
+
gr.Row(view_cart_button) # First position for view_cart_button
|
| 362 |
gr.Row(menu_output)
|
| 363 |
+
gr.Row(view_cart_button) # Second position for view_cart_button
|
| 364 |
gr.Row(modal_window)
|
| 365 |
gr.HTML(modal_and_cart_js)
|
| 366 |
|
| 367 |
# Cart & Final Order Page
|
| 368 |
+
with gr.Column(visible=False) as cart_section:
|
| 369 |
gr.Markdown("### Cart & Final Order Page")
|
| 370 |
|
| 371 |
# Floating cart display
|
|
|
|
| 417 |
return demo
|
| 418 |
|
| 419 |
if __name__ == "__main__":
|
| 420 |
+
app().launch()
|