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(
"""
""",
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(
"""
""",
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()