From 0c146fec412fb99153fbb32fa90f0211aa0c8b32 Mon Sep 17 00:00:00 2001 From: Tyler Date: Thu, 2 Apr 2026 18:11:18 -0700 Subject: Improve valuation model clarity --- components/top_movers.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'components/top_movers.py') diff --git a/components/top_movers.py b/components/top_movers.py index ea72fc6..5589df6 100644 --- a/components/top_movers.py +++ b/components/top_movers.py @@ -8,6 +8,10 @@ DEFAULT_VISIBLE_MOVERS = 3 MAX_MOVERS = 8 +def _toggle_mover_tab(state_key: str): + st.session_state[state_key] = not st.session_state.get(state_key, False) + + def _inject_styles(): st.markdown( """ @@ -127,8 +131,13 @@ def _render_mover_tab(screen: str, state_key: str): if len(quotes) > DEFAULT_VISIBLE_MOVERS: button_label = "Show Less" if expanded else f"Show More ({len(quotes) - DEFAULT_VISIBLE_MOVERS} more)" - if st.button(button_label, key=f"{state_key}_button", use_container_width=True): - st.session_state[state_key] = not expanded + st.button( + button_label, + key=f"{state_key}_button", + use_container_width=True, + on_click=_toggle_mover_tab, + args=(state_key,), + ) @st.fragment -- cgit v1.3-2-g0d8e