aboutsummaryrefslogtreecommitdiff
path: root/app.py
diff options
context:
space:
mode:
authorTyler <tyler@tylerhoang.xyz>2026-05-16 01:40:02 -0700
committerTyler <tyler@tylerhoang.xyz>2026-05-16 01:40:02 -0700
commitbbceb4c6798d43f4b32e73f38fc4907e00733244 (patch)
treeaa5ff1fed343e92fbd3d9f7e05859f621bb217f2 /app.py
parentb321614ef1aabf3ce001fea471e45bebc35ccb86 (diff)
Rewrite watchlist as custom HTML component with proper styling
Replaces st.button rows with a components.html iframe that renders sym·price·Δ% in a 3-column grid with hairline dividers, monospace fonts, and colored change percentages. Adds hidden text_input click receiver so row clicks update session state. Fixes toggle button to show toast when watchlist cap is hit and removes now-redundant psm-watch-toggle CSS. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'app.py')
-rw-r--r--app.py35
1 files changed, 6 insertions, 29 deletions
diff --git a/app.py b/app.py
index b0a9453..f8acd3c 100644
--- a/app.py
+++ b/app.py
@@ -404,29 +404,9 @@ hr {
::-webkit-scrollbar-thumb { background: var(--ink-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }
-/* ── Watch toggle button ────────────────────────────────────────────────── */
-[data-testid="stSidebar"] .psm-watch-toggle button {
- background: var(--ink-2) !important;
- color: var(--fg-3) !important;
- border: 1px solid var(--line-2) !important;
- border-radius: 2px !important;
- font-family: var(--font-sans) !important;
- font-size: 0.6875rem !important;
- font-weight: 500 !important;
- letter-spacing: 0.06em !important;
- text-transform: uppercase !important;
- padding: 3px 8px !important;
- margin-top: 6px !important;
-}
-
-[data-testid="stSidebar"] .psm-watch-toggle button:hover {
- background: var(--ink-3) !important;
- border-color: var(--line-3) !important;
- color: var(--fg-1) !important;
-}
-
-[data-testid="stSidebar"] .psm-watch-toggle button p {
- color: inherit !important;
+/* Hide the watchlist click receiver input */
+[data-testid="stSidebar"] [data-testid="stTextInput"]:has(input[aria-label="wl_click_receiver"]) {
+ display: none !important;
}
/* ── Ticker Header Band ──────────────────────────────────────────────────── */
@@ -762,18 +742,15 @@ with st.sidebar:
if ticker:
in_watch = ticker in st.session_state["watchlist"]
label = "— Remove from watchlist" if in_watch else "+ Save to watchlist"
- st.markdown('<div class="psm-watch-toggle">', unsafe_allow_html=True)
if st.button(label, key="watch_toggle", use_container_width=True):
if in_watch:
st.session_state["watchlist"].remove(ticker)
else:
- if (
- ticker not in st.session_state["watchlist"]
- and len(st.session_state["watchlist"]) < 10
- ):
+ if len(st.session_state["watchlist"]) >= 10:
+ st.toast("Watchlist full — 10 tickers maximum")
+ else:
st.session_state["watchlist"].append(ticker)
st.rerun()
- st.markdown("</div>", unsafe_allow_html=True)
# ── Watchlist ──────────────────────────────────────────────────────────
render_watchlist()