DivYonko commited on
Commit
39a10a0
Β·
1 Parent(s): 3974f5a

Move pinned messages to Comments view in all files

Browse files
Files changed (1) hide show
  1. frontend/streamlit_app.py +31 -32
frontend/streamlit_app.py CHANGED
@@ -895,6 +895,37 @@ _show_comments = _active_view == "πŸ’¬ Comments"
895
  if _show_comments:
896
  st.markdown('<div class="sec-hdr"><span class="sec-ttl">Live Chat Feed</span></div>', unsafe_allow_html=True)
897
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
898
  # Build stream options
899
  _feed_stream_options = {}
900
  for _fs in st.session_state.streams:
@@ -2104,38 +2135,6 @@ elif len(st.session_state.streams) > 1:
2104
  st.divider()
2105
  st.info("Add video IDs to your extra stream slots and click β–Ά Start to enable multi-stream comparison.")
2106
 
2107
- # ── PINNED MESSAGES ───────────────────────────────────────────
2108
- if st.session_state.pinned_messages:
2109
- st.divider()
2110
- st.markdown(
2111
- '<div class="sec-hdr"><span class="sec-ttl">πŸ“Œ Pinned Messages</span>'
2112
- f'<span class="sec-pill">{len(st.session_state.pinned_messages)} pinned</span></div>',
2113
- unsafe_allow_html=True
2114
- )
2115
- for idx, pmsg in enumerate(st.session_state.pinned_messages):
2116
- s = pmsg.get("sentiment", "Neutral")
2117
- s_color = SENT_COLORS.get(s, "#6b7280")
2118
- t_color = TOPIC_COLOR.get(pmsg.get("topic", "General"), "#6b7280")
2119
- pcol1, pcol2 = st.columns([10, 1])
2120
- with pcol1:
2121
- st.markdown(
2122
- f'<div class="chat-card chat-pinned">'
2123
- f'<div class="chat-author">πŸ“Œ {pmsg.get("author", "Unknown")}</div>'
2124
- f'<div class="chat-text">{pmsg.get("text", "")}</div>'
2125
- f'<div class="chat-badges">'
2126
- f'<span class="badge pin-badge">Pinned</span>'
2127
- f'<span class="badge" style="color:{s_color};">{s}</span>'
2128
- f'<span class="badge" style="color:{t_color};">{pmsg.get("topic","General")}</span>'
2129
- f'<span class="badge">{pmsg.get("time","")[:19]}</span>'
2130
- f'</div></div>',
2131
- unsafe_allow_html=True
2132
- )
2133
- with pcol2:
2134
- if st.button("βœ•", key=f"unpin_{idx}"):
2135
- st.session_state.pinned_messages.pop(idx)
2136
- st.rerun()
2137
-
2138
-
2139
  # ── AUTO REFRESH ──────────────────────────────────────────────
2140
  if auto_refresh:
2141
  time.sleep(refresh_rate)
 
895
  if _show_comments:
896
  st.markdown('<div class="sec-hdr"><span class="sec-ttl">Live Chat Feed</span></div>', unsafe_allow_html=True)
897
 
898
+ # ── PINNED MESSAGES (shown above the feed) ────────────────
899
+ if st.session_state.pinned_messages:
900
+ st.markdown(
901
+ '<div class="sec-hdr"><span class="sec-ttl">πŸ“Œ Pinned Messages</span>'
902
+ f'<span class="sec-pill">{len(st.session_state.pinned_messages)} pinned</span></div>',
903
+ unsafe_allow_html=True
904
+ )
905
+ for _pidx, _pmsg in enumerate(st.session_state.pinned_messages):
906
+ _ps = _pmsg.get("sentiment", "Neutral")
907
+ _ps_color = SENT_COLORS.get(_ps, "#6b7280")
908
+ _pt_color = TOPIC_COLOR.get(_pmsg.get("topic", "General"), "#6b7280")
909
+ _pcol1, _pcol2 = st.columns([10, 1])
910
+ with _pcol1:
911
+ st.markdown(
912
+ f'<div class="chat-card chat-pinned">'
913
+ f'<div class="chat-author">πŸ“Œ {_pmsg.get("author", "Unknown")}</div>'
914
+ f'<div class="chat-text">{_pmsg.get("text", "")}</div>'
915
+ f'<div class="chat-badges">'
916
+ f'<span class="badge pin-badge">Pinned</span>'
917
+ f'<span class="badge" style="color:{_ps_color};">{_ps}</span>'
918
+ f'<span class="badge" style="color:{_pt_color};">{_pmsg.get("topic","General")}</span>'
919
+ f'<span class="badge">{_pmsg.get("time","")[:19]}</span>'
920
+ f'</div></div>',
921
+ unsafe_allow_html=True
922
+ )
923
+ with _pcol2:
924
+ if st.button("\u2715", key=f"unpin_top_{_pidx}", width='stretch'):
925
+ st.session_state.pinned_messages.pop(_pidx)
926
+ st.rerun()
927
+ st.divider()
928
+
929
  # Build stream options
930
  _feed_stream_options = {}
931
  for _fs in st.session_state.streams:
 
2135
  st.divider()
2136
  st.info("Add video IDs to your extra stream slots and click β–Ά Start to enable multi-stream comparison.")
2137
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2138
  # ── AUTO REFRESH ──────────────────────────────────────────────
2139
  if auto_refresh:
2140
  time.sleep(refresh_rate)