"""Hero block + stat cards + methodology note + sample question cards.""" from __future__ import annotations import streamlit as st from i18n import t from samples import SAMPLE_QUESTIONS def render_welcome(db_id: str) -> None: st.markdown( "
NLSQL
", unsafe_allow_html=True, ) st.markdown(f"
{t('tagline')}
", unsafe_allow_html=True) col_a, col_b = st.columns(2, gap="medium") with col_a: st.markdown( f"""
{t("metric_kicker")}
{t("metric_value")} {t("metric_percent")}
{t("metric_caption")}
""", unsafe_allow_html=True, ) with col_b: st.markdown( f"""
{t("research_kicker")}
{t("research_value")}
{t("research_short")}
""", unsafe_allow_html=True, ) with st.expander(t("methodology_label"), expanded=False): st.markdown( f"
{t('research_caption')}
", unsafe_allow_html=True, ) st.markdown( f"
{t('ask_intro_label')}
", unsafe_allow_html=True, ) samples = SAMPLE_QUESTIONS.get(db_id) if not samples: st.info(t("no_samples")) return cols = st.columns(len(samples), gap="medium") diff_map = { "simple": t("diff_simple"), "moderate": t("diff_moderate"), "challenging": t("diff_challenging"), } for col, (difficulty, question) in zip(cols, samples, strict=False): with col: st.markdown( f"
{diff_map.get(difficulty, difficulty)}
", unsafe_allow_html=True, ) if st.button( question, key=f"sample_{db_id}_{hash(question)}", use_container_width=True, ): st.session_state.pending_question = question st.rerun()