aboutsummaryrefslogtreecommitdiff
path: root/app.py
diff options
context:
space:
mode:
authorTyler <tyler@tylerhoang.xyz>2026-05-17 00:48:26 -0700
committerTyler <tyler@tylerhoang.xyz>2026-05-17 00:48:26 -0700
commite885be599095037f93209d42ba55c77c2fb6b6ee (patch)
tree5773174f4b4e11ad3cc03ec6fda4cac47638ffeb /app.py
parent2ea1abbe88b2b4acb1c58a74022fcec42d02a4c2 (diff)
Add session persistence and watchlist exit button
Persists watchlist and active ticker across browser refreshes via a localStorage bridge (components/persistence.py), and adds a sidebar "← Watchlist" button to clear the active ticker and return to the QuoteTable landing page. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'app.py')
-rw-r--r--app.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/app.py b/app.py
index e87482d..b0f3add 100644
--- a/app.py
+++ b/app.py
@@ -406,7 +406,9 @@ hr {
/* Hide click receiver inputs without removing them from React's event system */
[data-testid="stSidebar"] [data-testid="stTextInput"]:has(input[aria-label="wl_click_receiver"]),
-[data-testid="stTextInput"]:has(input[aria-label="qt_click_receiver"]) {
+[data-testid="stTextInput"]:has(input[aria-label="qt_click_receiver"]),
+[data-testid="stTextInput"]:has(input[aria-label="persist_wl"]),
+[data-testid="stTextInput"]:has(input[aria-label="persist_tk"]) {
visibility: hidden !important;
height: 0 !important;
min-height: 0 !important;
@@ -590,6 +592,7 @@ _prism_template = go.layout.Template(layout=_prism_layout)
pio.templates["prism"] = _prism_template
pio.templates.default = "prism"
+from components.persistence import render_persistence_bridge
from components.market_bar import render_market_bar
from components.top_movers import render_top_movers
from components.watchlist import render_watchlist
@@ -614,6 +617,7 @@ if "watchlist" not in st.session_state:
if "active_tab" not in st.session_state:
st.session_state["active_tab"] = "overview"
+render_persistence_bridge()
# ── Sidebar ───────────────────────────────────────────────────────────────────
@@ -719,6 +723,12 @@ with st.sidebar:
ticker = st.session_state["ticker"]
+ # ── Exit to landing page ──────────────────────────────────────────────
+ if st.session_state.get("ticker"):
+ if st.button("← Watchlist", key="exit_ticker", use_container_width=True):
+ st.session_state["ticker"] = None
+ st.rerun()
+
# ── Workspace nav ─────────────────────────────────────────────────────
st.markdown("<div class='psm-nav-section'>Workspace</div>", unsafe_allow_html=True)
_nav = [