feat: discard button — removes email from queue without writing to score file

This commit is contained in:
pyr0ball 2026-02-27 15:48:40 -08:00
parent 732564ae5e
commit f48590f859

View file

@ -717,7 +717,7 @@ with tab_label:
# ── Navigation ──────────────────────────────────────────────────── # ── Navigation ────────────────────────────────────────────────────
st.markdown("") st.markdown("")
nav_cols = st.columns([2, 1, 1]) nav_cols = st.columns([2, 1, 1, 1])
remaining = len(unlabeled) - 1 remaining = len(unlabeled) - 1
nav_cols[0].caption(f"**{remaining}** remaining · Keys: 19 = label, 0 = other, S = skip, U = undo") nav_cols[0].caption(f"**{remaining}** remaining · Keys: 19 = label, 0 = other, S = skip, U = undo")
@ -739,6 +739,16 @@ with tab_label:
st.session_state.idx = next_idx st.session_state.idx = next_idx
st.rerun() st.rerun()
if nav_cols[3].button("🗑️ Discard", use_container_width=True):
# Remove from queue entirely — not written to score file
st.session_state.queue = [e for e in queue if _entry_key(e) != _entry_key(entry)]
_save_jsonl(_QUEUE_FILE, st.session_state.queue)
next_idx = min(idx, len(st.session_state.queue) - 1)
while next_idx < len(st.session_state.queue) and _entry_key(st.session_state.queue[next_idx]) in labeled_keys:
next_idx += 1
st.session_state.idx = max(next_idx, 0)
st.rerun()
# Keyboard shortcut capture (JS → hidden button click) # Keyboard shortcut capture (JS → hidden button click)
st.components.v1.html( st.components.v1.html(
"""<script> """<script>