"""Base components for the API key manager."""
import streamlit as st
from typing import Dict, Any
from loguru import logger
from ..styles import API_KEY_MANAGER_STYLES
def render_step_indicator(current_step: int, total_steps: int) -> None:
"""Render the step indicator."""
try:
st.markdown("""
""", unsafe_allow_html=True)
steps = [
("🔑", "AI LLM", 1),
("👤", "AI Research", 2),
("🎨", "Personalization", 3),
("🔄", "Integrations", 4),
("✅", "Complete", 5)
]
html = '
'
for i, (icon, title, step) in enumerate(steps):
step_class = "active" if step == current_step else "completed" if step < current_step else ""
line_class = "active" if step == current_step else "completed" if step < current_step else ""
html += f'''
{icon}
{step}
{title}
'''
if i < len(steps) - 1:
html += f'
'
html += '
'
st.markdown(html, unsafe_allow_html=True)
except Exception as e:
logger.error(f"Error rendering step indicator: {str(e)}")
st.error("Error displaying step indicator")
def render_navigation_buttons(current_step: int, total_steps: int, changes_made: bool = True) -> bool:
"""Render the navigation buttons with modern glassmorphic styling.
Args:
current_step (int): Current step number
total_steps (int): Total number of steps
changes_made (bool): Whether changes were made in the current step
Returns:
bool: True if next/complete button was clicked, False otherwise
"""
col1, col2, col3 = st.columns([1, 2, 1])
with col1:
if current_step > 1:
if st.button("**← Back**", use_container_width=True, key="back_button"):
from ..wizard_state import previous_step
previous_step()
st.rerun()
with col3:
if current_step < total_steps:
next_text = "**Continue →**"
if st.button(next_text, use_container_width=True, disabled=not changes_made, key="next_button"):
# Don't call next_step() here, let the component handle it
return True
else:
if st.button("**Complete Setup ✓**", use_container_width=True, type="primary", key="complete_button"):
# Save the configuration
st.success("✅ Setup completed successfully!")
return True
return False
def render_tab_style() -> None:
"""Render enhanced tab styling."""
st.markdown("""
""", unsafe_allow_html=True)
def render_success_message():
"""Render the success message with glassmorphic design."""
st.markdown("""
✅ API keys saved successfully!
Please restart the application for the changes to take effect.
""", unsafe_allow_html=True)