import gradio as gr # --- LOGIN & SIGN-UP FUNCTIONS --- def community_login(username, password): if username and password: # Hide intro screen + community portal, show dashboard return ( gr.update(visible=False), # Hide intro_buttons gr.update(visible=False), # Hide community_portal gr.update(visible=True), # Show community_dashboard f"✅ Welcome back, {username}!" ) return gr.update(), gr.update(), gr.update(), "⚠️ Please enter both username and password." def community_signup(first, last, email, zip_code, interests): if not (first and last and email): return "⚠️ Please fill in all required fields (First, Last, Email)." return ( f"🎉 Thanks for signing up, {first} {last}!\n" f"📧 Email: {email}\n" f"📍 Zip Code: {zip_code or 'Not provided'}\n" f"🎯 Interests: {', '.join(interests) if interests else 'None selected'}\n" "Welcome to LiftLocal!" ) def corporate_login(username, password): if username == "admin" and password == "1234": return ( gr.update(visible=False), # Hide intro_buttons gr.update(visible=False), # Hide corporate_portal gr.update(visible=True), # Show corporate_dashboard "✅ Corporate access granted. Welcome!" ) elif username and password: return ( gr.update(visible=False), gr.update(visible=False), gr.update(visible=True), f"Hello {username}! (Demo login only)" ) return gr.update(), gr.update(), gr.update(), "⚠️ Please enter both username and password." # ✅ FIX: logout returns the updates, not used inline def logout(): return ( gr.update(visible=True), # Show intro gr.update(visible=False), # Hide community dashboard gr.update(visible=False) # Hide corporate dashboard ) # --- MAIN INTERFACE --- with gr.Blocks( title="LiftLocal Login", css=""" body, .gradio-container, .block, .wrap { background-color: #f5f1e6 !important; color: #000000 !important; } #logo, #logo * { border: none !important; box-shadow: none !important; outline: none !important; background: none !important; } #logo { display: flex; justify-content: center; align-items: center; margin: 0 auto 10px auto; padding: 0 !important; } .gr-image { background: transparent !important; box-shadow: none !important; border: none !important; } img { background: transparent !important; border: none !important; box-shadow: none !important; } #user_button, #employee_button { font-size: 18px; padding: 10px 18px; margin: 10px; background-color: #ffffff; border: 2px solid #b0a999; border-radius: 10px; color: #000000; transition: all 0.3s ease; width: 180px; } #user_button:hover, #employee_button:hover { background-color: #e0d6c3; border-color: #8a7f6b; transform: scale(1.05); } h1, h2, h3, p { text-align: center !important; color: #000000 !important; } label, .gr-label, .gradio-input label, .wrap label, .form label { color: #000000 !important; font-weight: 600 !important; text-align: left !important; } input, textarea, select { background-color: #ffffff !important; color: #000000 !important; border: 1.5px solid #b0a999 !important; border-radius: 6px !important; font-size: 16px !important; caret-color: #000000 !important; } input::placeholder, textarea::placeholder { color: #7a7a7a !important; opacity: 1 !important; } input:focus, textarea:focus, select:focus { border-color: #8a7f6b !important; outline: none !important; box-shadow: 0 0 5px rgba(138, 127, 107, 0.4) !important; } .block { display: flex; flex-direction: column; align-items: center; } .gradio-container .form { background-color: transparent !important; box-shadow: none !important; } .tabs { background-color: transparent !important; } .logout-btn { position: absolute; top: 15px; right: 20px; background: #ffffff; border: 2px solid #b0a999; border-radius: 8px; padding: 6px 14px; font-size: 15px; cursor: pointer; transition: 0.3s; } .logout-btn:hover { background-color: #e0d6c3; } """ ) as demo: # --- INTRO SECTION --- gr.Image("liftlocall.png", show_label=False, show_download_button=False, elem_id="logo", height=300) gr.Markdown("