Spaces:
Sleeping
Sleeping
Update app.py
Browse files148 unmodified lines14915015115215315415515615715815916016116216316416516616716816917017118 unmodified lines190191192193194195196197198199200201202203204205206148 unmodified lines# Generate dish cardsdef display_dishes(category):html_content = "<div style='display: flex; flex-direction: column; gap: 20px; width: 80%; margin: 0 auto;'>"for dish in menu_data:if category == "ALL" or dish["category"] == category:html_content += f"""<div style='display: flex; align-items: center; justify-content: space-between; padding: 20px; border: 1px solid #ddd; border-radius: 10px; background-color: #f9f9f9;'><div style='flex: 3; text-align: left;'><h3 style='margin: 0; font-size: 20px;'>{dish['name']}</h3><p style='margin: 5px 0; font-size: 14px; color: #555;'>{dish['description']}</p><p style='margin: 0; font-size: 16px; font-weight: bold;'>Price: {dish['price']}</p></div><div style='flex: 1; text-align: center;'><img src='{dish['image']}' alt='{dish['name']}' style='width: 120px; height: 80px; object-fit: cover; border-radius: 10px;'><button onclick="showPopup('{dish['name']}', '{dish['description']}', '{dish['price']}', '{dish['image']}')"style='margin-top: 10px; padding: 10px 20px; background-color: #28a745; color: white; border: none; border-radius: 5px; cursor: pointer;'>Add</button></div></div>"""html_content += "</div>"18 unmodified linesdish_display = gr.HTML(value=display_dishes("ALL"))btn_all.click(lambda: gr.update(value=display_dishes("ALL")),outputs=dish_display)btn_vegan.click(lambda: gr.update(value=display_dishes("VEGAN")),outputs=dish_display)btn_halal.click(lambda: gr.update(value=display_dishes("HALAL")),outputs=dish_display)with gr.Tab("Cart"):cart_display = gr.HTML(value=display_cart())148 unmodified lines14915015115215315415515615715815916016116216316416516616716816918 unmodified lines188189190191192193194195196197198199200201202203204148 unmodified lines# Generate dish cardsdef display_dishes(category):html_content = "<div style='display: flex; flex-wrap: wrap; gap: 20px; width: 80%; margin: 0 auto;'>"for dish in menu_data:if category == "ALL" or dish["category"] == category:html_content += f"""<div style='flex: 1 1 calc(30% - 20px); display: flex; flex-direction: column; align-items: center;justify-content: space-between; padding: 20px; border: 1px solid #ddd; border-radius: 10px;background-color: #f9f9f9; box-shadow: 0 4px 8px rgba(0,0,0,0.1);'><img src='{dish['image']}' alt='{dish['name']}' style='width: 100%; height: 150px; object-fit: cover; border-radius: 10px;'><h3 style='margin: 10px 0; font-size: 18px;'>{dish['name']}</h3><p style='margin: 5px 0; font-size: 14px; color: #555;'>{dish['description']}</p><p style='margin: 10px 0; font-size: 16px; font-weight: bold;'>Price: {dish['price']}</p><button onclick="showPopup('{dish['name']}', '{dish['description']}', '{dish['price']}', '{dish['image']}')"style='padding: 10px 20px; background-color: #28a745; color: white; border: none; border-radius: 5px; cursor: pointer;'>Add</button></div>"""html_content += "</div>"18 unmodified linesdish_display = gr.HTML(value=display_dishes("ALL"))btn_all.click(lambda: display_dishes("ALL"),outputs=dish_display)btn_vegan.click(lambda: display_dishes("VEGAN"),outputs=dish_display)btn_halal.click(lambda: display_dishes("HALAL"),outputs=dish_display)with gr.Tab("Cart"):cart_display = gr.HTML(value=display_cart())
app.py+21-23