From 775762d75bf2b6b49893f84db1f4910ef1aa1e4b Mon Sep 17 00:00:00 2001 From: Tyler Date: Sat, 16 May 2026 00:51:08 -0700 Subject: Harden script embedding, timezone parsing, and layout buffers - overview: use json_for_script for inline payload/meta to prevent break-out from yfinance-sourced strings; raise iframe height to cover responsive single-column collapse under 1100px - news: treat naive ISO/strptime datetimes as UTC before converting to local-naive, matching the int-timestamp branch from 75dbe29 - news: bump per-row iframe height to fit summary + metadata under scrolling=False - top_movers: drop name column in compact (sidebar) mode and tighten grid so symbol/price/change fit a default-width Streamlit sidebar Co-Authored-By: Claude Opus 4.7 --- components/overview.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'components/overview.py') diff --git a/components/overview.py b/components/overview.py index 27c4166..53358f0 100644 --- a/components/overview.py +++ b/components/overview.py @@ -7,6 +7,7 @@ import streamlit as st import streamlit.components.v1 as components from services.data_service import get_company_info, get_latest_price, get_price_history +from utils.security import json_for_script PERIODS = {"1mo": "1M", "3mo": "3M", "6mo": "6M", "1y": "1Y", "5y": "5Y"} SECTOR_ETF_MAP = { @@ -190,8 +191,6 @@ def _comparison_list(ticker: str, info: dict) -> list[dict]: def render_overview(ticker: str): - import json as _json - info = get_company_info(ticker) or {} if not info: st.error("Could not load data for this ticker.") @@ -271,8 +270,8 @@ def render_overview(ticker: str): "default_comparisons": ["^GSPC"], } - payload_js = "const OVERVIEW_DATA=" + _json.dumps(payload) + ";" - meta_js = "const OVERVIEW_META=" + _json.dumps(meta) + ";" + payload_js = "const OVERVIEW_DATA=" + json_for_script(payload) + ";" + meta_js = "const OVERVIEW_META=" + json_for_script(meta) + ";" if price is not None and prev_close is not None and prev_close > 0: chg_pct = (price - prev_close) / prev_close * 100.0 @@ -497,7 +496,7 @@ def render_overview(ticker: str): + "" ) - height = 1480 + height = 1950 # extra ~470px buffer for responsive single-column collapse at <1100px doc = ( "" -- cgit v1.3-2-g0d8e