"""Design system & reusable UI components for Hostel MS."""
import streamlit as st
PALETTE = {
"primary": "#6366F1",
"primary_light": "#818CF8",
"accent": "#A855F7",
"success": "#10B981",
"warning": "#F59E0B",
"danger": "#EF4444",
"surface": "#1E293B",
"surface_alt": "#334155",
"bg": "#0B1220",
"text": "#F8FAFC",
"muted": "#94A3B8",
}
def inject_theme():
st.markdown(
f"""
""",
unsafe_allow_html=True,
)
def sidebar_brand():
st.markdown(
"""
""",
unsafe_allow_html=True,
)
def hero(title: str, subtitle: str, badge: str = ""):
badge_html = f'{badge} 路 ' if badge else ""
st.markdown(
f"""
{title}
{badge_html}{subtitle}
""",
unsafe_allow_html=True,
)
def metrics_row(items: list[tuple[str, str, str | None]]):
cols = st.columns(len(items))
for col, item in zip(cols, items):
val, label = item[0], item[1]
delta = item[2] if len(item) > 2 else None
delta_html = f'{delta}
' if delta else ""
col.markdown(
f"""
{val}
{label}
{delta_html}
""",
unsafe_allow_html=True,
)
def feature_grid(features: list[tuple[str, str, str]]):
cols = st.columns(len(features))
for col, (icon, title, desc) in zip(cols, features):
col.markdown(
f"""
""",
unsafe_allow_html=True,
)
def activity_feed(items: list[tuple[str, str, str]]):
for icon, title, meta in items:
st.markdown(
f"""
""",
unsafe_allow_html=True,
)
def room_grid(rooms: list[dict]):
cols = st.columns(min(len(rooms), 5))
for i, r in enumerate(rooms):
status = r.get("status", "Vacant")
css = "room-vacant" if status == "Vacant" else "room-partial" if status == "Partial" else "room-full"
cols[i % 5].markdown(
f"""
{r['number']}
{r['occupied']}/{r['capacity']}
""",
unsafe_allow_html=True,
)
def page_footer():
st.markdown(
"""
""",
unsafe_allow_html=True,
)
def status_badge(text: str, kind: str = "info") -> str:
return f'{text}'