aboutsummaryrefslogtreecommitdiff
path: root/components/top_movers.py
diff options
context:
space:
mode:
authorTyler <tyler@tylerhoang.xyz>2026-04-02 18:11:18 -0700
committerTyler <tyler@tylerhoang.xyz>2026-04-02 18:11:18 -0700
commit0c146fec412fb99153fbb32fa90f0211aa0c8b32 (patch)
treee87425e7e1e7cace303488ab0be4a5b50db4ea77 /components/top_movers.py
parent7a267bc3c28bc7a77e84eaa400667a7b4c0d5adf (diff)
Improve valuation model clarity
Diffstat (limited to 'components/top_movers.py')
-rw-r--r--components/top_movers.py13
1 files changed, 11 insertions, 2 deletions
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