import os import gradio as gr ACCESS_PASSWORD = "lb123" TOOLS = { "Orders": { "icon": "๐Ÿ“ฆ", "color": "#2563eb", "bg": "#eff6ff", "items": [ ("๐Ÿ“„ Open Order", "https://open-order-1019372524488.us-west1.run.app"), ("๐Ÿงพ Order Processing", "https://order-processing-1019372524488.asia-east1.run.app"), ("๐Ÿท๏ธ Ammu Order", "https://ammu-order-1019372524488.asia-east1.run.app"), ], }, "Shipping Tools": { "icon": "๐Ÿšš", "color": "#059669", "bg": "#ecfdf5", "items": [ ("๐Ÿ“ฎ EC-Ship App", "https://shipping-ec-ship-1019372524488.asia-east1.run.app"), ("โœˆ๏ธ FedEx App", "https://shipping-fedex-1019372524488.us-west1.run.app"), ("๐ŸŒ YunExpress App", "https://shipping-yunexpress-1019372524488.asia-east1.run.app"), ("๐Ÿšš DealerSend App", "https://dealersend-1019372524488.asia-east1.run.app"), ("๐Ÿ“ค Tracking Upload", "https://tracking-upload-1019372524488.asia-east1.run.app"), ], }, "Admin / Marketing": { "icon": "โš™๏ธ", "color": "#7c3aed", "bg": "#f5f3ff", "items": [ ("โœ‰๏ธ Email Template", "https://email-template-1019372524488.asia-east1.run.app"), ], }, "External Service Websites": { "icon": "๐Ÿ”—", "color": "#ea580c", "bg": "#fff7ed", "items": [ ("๐Ÿ›’ Shopify Website", "https://www.shopify.com/"), ("๐Ÿ“ฎ Hongkong Post EC-Ship Website", "https://ec-ship.hongkongpost.hk/"), ("โœˆ๏ธ FedEx Hong Kong Website", "https://www.fedex.com/secure-login/en-hk/#/credentials"), ("๐ŸŒ YunExpress Website", "https://passport.yunexpress.cn/login/#/"), ("๐Ÿ”Ž YunTrack Tracking Website", "https://www.yuntrack.com/"), ("๐Ÿ“ 17TRACK Tracking Website", "https://www.17track.net/en"), ("๐Ÿšš DealerSend Login Page", "https://dealer-send.com/zh-HK/login"), ], }, } def build_html(): html = """

Leading Bridge Admin Dashboard

Internal tools portal for order processing, shipping and administration.

""" for section_name, section_data in TOOLS.items(): color = section_data["color"] bg = section_data["bg"] icon = section_data["icon"] items = section_data["items"] html += f"""
{icon}
{section_name}
""" for name, url in items: subtitle = "Open website" if section_name == "External Service Websites" else "Open tool" html += f"""
{name}
{subtitle}
""" html += """
""" html += """
""" return html def check_password(password): if password == ACCESS_PASSWORD: return ( gr.update(visible=False), gr.update(visible=True), "" ) return ( gr.update(visible=True), gr.update(visible=False), "Incorrect password. Please try again." ) with gr.Blocks(title="Leading Bridge Admin Dashboard") as demo: login_box = gr.Column(visible=True) dashboard_box = gr.Column(visible=False) with login_box: gr.Markdown("## Leading Bridge Admin Dashboard") gr.Markdown("Please enter the access password.") password_input = gr.Textbox( label="Password", type="password", placeholder="Enter password" ) login_btn = gr.Button("Login") login_message = gr.Markdown("") with dashboard_box: gr.HTML(build_html()) login_btn.click( check_password, inputs=password_input, outputs=[login_box, dashboard_box, login_message] ) if __name__ == "__main__": demo.launch()