Replace deprecated use_container_width with width param in dashboard

Streamlit 1.58 warns on every use_container_width call; switch to the
width="stretch" replacement to silence the noisy deprecation warnings.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Jose Manuel 2026-07-02 20:17:43 +02:00
parent 94745cfda3
commit 8cb5832f8b

View File

@ -248,7 +248,7 @@ col_m, col_a = st.sidebar.columns(2)
mes_sel = col_m.number_input("Mes", min_value=1, max_value=12, value=today.month) mes_sel = col_m.number_input("Mes", min_value=1, max_value=12, value=today.month)
anio_sel = col_a.number_input("Año", min_value=2024, max_value=2030, value=today.year, step=1) anio_sel = col_a.number_input("Año", min_value=2024, max_value=2030, value=today.year, step=1)
if st.sidebar.button("🔄 Actualizar datos", use_container_width=True): if st.sidebar.button("🔄 Actualizar datos", width="stretch"):
st.cache_data.clear() st.cache_data.clear()
st.sidebar.divider() st.sidebar.divider()
@ -357,7 +357,7 @@ with tab_resumen:
) )
.properties(height=320) .properties(height=320)
) )
st.altair_chart(chart, use_container_width=True) st.altair_chart(chart, width="stretch")
st.caption("Margen (sumatorio) = Ingreso reportado Gasto · Margen (PPL) = Leads del día × PPL de campaña Gasto") st.caption("Margen (sumatorio) = Ingreso reportado Gasto · Margen (PPL) = Leads del día × PPL de campaña Gasto")
st.divider() st.divider()
@ -403,7 +403,7 @@ with tab_resumen:
df = pd.DataFrame(table_rows) df = pd.DataFrame(table_rows)
event = st.dataframe( event = st.dataframe(
df, df,
use_container_width=True, width="stretch",
hide_index=True, hide_index=True,
on_select="rerun", on_select="rerun",
selection_mode="single-row", selection_mode="single-row",
@ -455,7 +455,7 @@ with tab_campanas:
edited = st.data_editor( edited = st.data_editor(
editor_data.drop(columns=["_id"]), editor_data.drop(columns=["_id"]),
use_container_width=True, width="stretch",
hide_index=True, hide_index=True,
disabled=["Campaña", "Status", "Gasto", "Leads lake"], disabled=["Campaña", "Status", "Gasto", "Leads lake"],
column_config={ column_config={
@ -510,7 +510,7 @@ with tab_campanas:
cm_edited = st.data_editor( cm_edited = st.data_editor(
cm_data.drop(columns=["_id"]), cm_data.drop(columns=["_id"]),
use_container_width=True, width="stretch",
hide_index=True, hide_index=True,
disabled=["Curso ID", "Nombre"], disabled=["Curso ID", "Nombre"],
column_config={ column_config={
@ -622,7 +622,7 @@ with hist_camp_tab:
# Tabla detalle # Tabla detalle
st.markdown("**Detalle diario**") st.markdown("**Detalle diario**")
display_cols = [c for c in ["Fecha", "Leads", "Gasto", "Revenue", "Margen"] if c in df_daily.columns] display_cols = [c for c in ["Fecha", "Leads", "Gasto", "Revenue", "Margen"] if c in df_daily.columns]
st.dataframe(df_daily[display_cols], use_container_width=True, hide_index=True) st.dataframe(df_daily[display_cols], width="stretch", hide_index=True)
else: else:
st.info("Sin datos diarios para esta campaña.") st.info("Sin datos diarios para esta campaña.")
else: else:
@ -702,7 +702,7 @@ with tab_ejecucion:
with col_dry: with col_dry:
st.markdown("**Dry Run** — Solo análisis, sin cambios en Google Ads") st.markdown("**Dry Run** — Solo análisis, sin cambios en Google Ads")
if st.button("▶ Ejecutar Dry Run", use_container_width=True): if st.button("▶ Ejecutar Dry Run", width="stretch"):
st.session_state["run_mode"] = "dry" st.session_state["run_mode"] = "dry"
st.session_state["run_started"] = True st.session_state["run_started"] = True
@ -710,7 +710,7 @@ with tab_ejecucion:
st.markdown("**Producción** — Aplica cambios reales en Google Ads") st.markdown("**Producción** — Aplica cambios reales en Google Ads")
confirm = st.checkbox("Confirmo que quiero ejecutar en producción") confirm = st.checkbox("Confirmo que quiero ejecutar en producción")
prod_disabled = not confirm prod_disabled = not confirm
if st.button("🚀 Ejecutar en Producción", use_container_width=True, disabled=prod_disabled): if st.button("🚀 Ejecutar en Producción", width="stretch", disabled=prod_disabled):
st.session_state["run_mode"] = "prod" st.session_state["run_mode"] = "prod"
st.session_state["run_started"] = True st.session_state["run_started"] = True