Update src/ui/components.py
Browse files- src/ui/components.py +71 -1
src/ui/components.py
CHANGED
|
@@ -192,6 +192,76 @@ def render_stage_tracker(current_stage: int) -> None:
|
|
| 192 |
st.markdown("")
|
| 193 |
|
| 194 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 195 |
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 196 |
# Reusable card primitives
|
| 197 |
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
@@ -223,4 +293,4 @@ def script_box(text: str) -> None:
|
|
| 223 |
st.markdown(
|
| 224 |
f"<div class='script-display'>{text}</div>",
|
| 225 |
unsafe_allow_html=True,
|
| 226 |
-
)
|
|
|
|
| 192 |
st.markdown("")
|
| 193 |
|
| 194 |
|
| 195 |
+
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 196 |
+
# Mode selector β prominent pill toggle in main area
|
| 197 |
+
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 198 |
+
|
| 199 |
+
def render_mode_selector() -> str:
|
| 200 |
+
"""
|
| 201 |
+
Render a prominent two-button mode toggle in the main content area.
|
| 202 |
+
Persists selection in st.session_state["output_mode"].
|
| 203 |
+
Returns the selected mode value string (matches OutputMode.value).
|
| 204 |
+
"""
|
| 205 |
+
# Bootstrap default
|
| 206 |
+
if "output_mode" not in st.session_state:
|
| 207 |
+
st.session_state["output_mode"] = "Audio Transcript"
|
| 208 |
+
|
| 209 |
+
current = st.session_state["output_mode"]
|
| 210 |
+
|
| 211 |
+
st.markdown("""
|
| 212 |
+
<style>
|
| 213 |
+
.mode-toggle-wrap {
|
| 214 |
+
display: flex; gap: 12px; margin: 0.4rem 0 1.2rem 0;
|
| 215 |
+
}
|
| 216 |
+
.mode-btn {
|
| 217 |
+
flex: 1; padding: 0.65rem 1rem; border-radius: 10px;
|
| 218 |
+
font-family: 'Inter', sans-serif; font-size: 0.92rem; font-weight: 500;
|
| 219 |
+
text-align: center; cursor: pointer; transition: all 0.2s;
|
| 220 |
+
border: 1.5px solid var(--border);
|
| 221 |
+
background: var(--bg-card); color: var(--text-muted);
|
| 222 |
+
}
|
| 223 |
+
.mode-btn.active {
|
| 224 |
+
background: linear-gradient(135deg, rgba(124,106,247,0.18), rgba(124,106,247,0.06));
|
| 225 |
+
border-color: #7c6af7; color: #c4baff;
|
| 226 |
+
}
|
| 227 |
+
</style>
|
| 228 |
+
""", unsafe_allow_html=True)
|
| 229 |
+
|
| 230 |
+
col_t, col_p = st.columns(2)
|
| 231 |
+
|
| 232 |
+
with col_t:
|
| 233 |
+
transcript_active = current == "Audio Transcript"
|
| 234 |
+
if st.button(
|
| 235 |
+
"ποΈ Audio Transcript",
|
| 236 |
+
use_container_width=True,
|
| 237 |
+
type="primary" if transcript_active else "secondary",
|
| 238 |
+
key="mode_btn_transcript",
|
| 239 |
+
):
|
| 240 |
+
st.session_state["output_mode"] = "Audio Transcript"
|
| 241 |
+
st.rerun()
|
| 242 |
+
|
| 243 |
+
with col_p:
|
| 244 |
+
podcast_active = current == "Podcast (2 Speakers)"
|
| 245 |
+
if st.button(
|
| 246 |
+
"π Podcast β 2 Speakers",
|
| 247 |
+
use_container_width=True,
|
| 248 |
+
type="primary" if podcast_active else "secondary",
|
| 249 |
+
key="mode_btn_podcast",
|
| 250 |
+
):
|
| 251 |
+
st.session_state["output_mode"] = "Podcast (2 Speakers)"
|
| 252 |
+
st.rerun()
|
| 253 |
+
|
| 254 |
+
# Visual label showing what's active
|
| 255 |
+
icon = "ποΈ" if current == "Audio Transcript" else "π"
|
| 256 |
+
st.markdown(
|
| 257 |
+
f"<p style='font-size:0.8rem; color:#8b8fa8; margin: -0.6rem 0 0.8rem 0;'>"
|
| 258 |
+
f"{icon} Active: <strong style='color:#c4baff'>{current}</strong></p>",
|
| 259 |
+
unsafe_allow_html=True,
|
| 260 |
+
)
|
| 261 |
+
|
| 262 |
+
return st.session_state["output_mode"]
|
| 263 |
+
|
| 264 |
+
|
| 265 |
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 266 |
# Reusable card primitives
|
| 267 |
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
|
|
| 293 |
st.markdown(
|
| 294 |
f"<div class='script-display'>{text}</div>",
|
| 295 |
unsafe_allow_html=True,
|
| 296 |
+
)
|