File size: 2,863 Bytes
2929135
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import streamlit as st
from datetime import datetime

class HeaderComponent:
    def __init__(self):
        """Initialize the header component"""
        # Initialize session state for notifications if not exists
        if 'notifications' not in st.session_state:
            st.session_state.notifications = []

    def _add_notification(self, message: str, type: str = "info"):
        """Add a notification to the session state"""
        st.session_state.notifications.append({
            "message": message,
            "type": type,
            "timestamp": datetime.now()
        })

    def render(self):
        """Render the header"""
        # Main header container
        header_container = st.container()
        
        with header_container:
            # Top row with logo and title
            col1, col2, col3 = st.columns([1, 4, 1])
            
            with col1:
                st.markdown("# πŸ₯")
            
            with col2:
                st.title("Healthcare Operations Assistant")
                st.markdown("""
                    <div style='padding: 0.5rem 0; color: #4a4a4a;'>
                        *AI-Powered Healthcare Management System* πŸ€–
                    </div>
                """, unsafe_allow_html=True)
            
            with col3:
                # Status indicator
                status = "🟒 Online" if st.session_state.get('system_status', True) else "πŸ”΄ Offline"
                st.markdown(f"### {status}")

            # Notification area
            if st.session_state.notifications:
                with st.expander("πŸ“¬ Notifications", expanded=True):
                    for notif in st.session_state.notifications[-3:]:  # Show last 3
                        if notif["type"] == "info":
                            st.info(notif["message"])
                        elif notif["type"] == "warning":
                            st.warning(notif["message"])
                        elif notif["type"] == "error":
                            st.error(notif["message"])
                        elif notif["type"] == "success":
                            st.success(notif["message"])

            # System status bar
            status_cols = st.columns(4)
            with status_cols[0]:
                st.markdown("**System Status:** Operational βœ…")
            with status_cols[1]:
                st.markdown("**API Status:** Connected πŸ”—")
            with status_cols[2]:
                st.markdown("**Load:** Normal πŸ“Š")
            with status_cols[3]:
                st.markdown(f"**Last Update:** {datetime.now().strftime('%H:%M')} πŸ•’")

            # Divider
            st.markdown("---")

    def add_notification(self, message: str, type: str = "info"):
        """Public method to add notifications"""
        self._add_notification(message, type)