import streamlit as st import datetime from utils.auth import logout def render_sidebar(): """Render the sidebar with navigation links and user info""" with st.sidebar: # App logo/title st.markdown( """

🤗 HF Model Manager

""", unsafe_allow_html=True, ) # User information with badge st.markdown( f"""
Logged in as
{st.session_state.username}
HF Pro
Last login: {datetime.datetime.now().strftime("%B %d, %Y")}
""", unsafe_allow_html=True, ) # Navigation with tooltips st.markdown( """

Navigation

""", unsafe_allow_html=True, ) # Home button if st.button("🏠 Home", use_container_width=True, key="home_btn"): st.session_state.page = "home" st.session_state.selected_model = None st.rerun() # Repositories button if st.button( "📚 Manage Repositories", use_container_width=True, key="repo_btn" ): st.session_state.page = "repository_management" st.rerun() # Create new repository button with prominent styling st.markdown( """
""", unsafe_allow_html=True, ) if st.button( "➕ Create New Repository", use_container_width=True, key="create_new_repo" ): st.session_state.page = "repository_management" st.rerun() # Analytics button if st.button("📊 Analytics", use_container_width=True, key="analytics_btn"): st.session_state.page = "analytics" st.session_state.selected_model = None st.rerun() # Batch Operations button if st.button("🔄 Batch Operations", use_container_width=True, key="batch_btn"): st.session_state.page = "batch_operations" st.session_state.selected_model = None st.rerun() # Refresh models button if st.button( "🔄 Refresh Models", use_container_width=True, key="refresh_models" ): with st.spinner("Refreshing models..."): try: st.session_state.models = st.session_state.client.get_user_models() st.success("Models refreshed!") except Exception as e: st.error(f"Error refreshing models: {str(e)}") # Spacer st.markdown( """
""", unsafe_allow_html=True, ) # Bottom links with improved styling st.markdown( """
""", unsafe_allow_html=True, ) # Helpful links section st.markdown( """
📚 Hugging Face Documentation 🔍 Browse Models 🚀 Explore Spaces
""", unsafe_allow_html=True, ) # Version info st.markdown( """
HF Model Manager v1.0.0
""", unsafe_allow_html=True, ) # Logout button if st.button("🚪 Logout", use_container_width=True, key="logout_btn"): logout()