From f97b633d4cafe39fb0bcb4b374f813071b9ea09e Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 29 Apr 2026 00:17:34 +0000 Subject: [PATCH] feat: add live surviving rows preview in match group editor Shows a read-only preview of the output rows below the editor, updating as checkboxes and column dropdowns are changed. Co-Authored-By: Claude Opus 4.6 --- src/gui/components.py | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/src/gui/components.py b/src/gui/components.py index 0a54324..8946ce1 100644 --- a/src/gui/components.py +++ b/src/gui/components.py @@ -422,21 +422,33 @@ def match_group_card( f"{', '.join(differing_cols)}" ) - # Status + # Status + surviving rows preview if len(checked) == 0: st.warning("Select at least one row to keep.") - elif len(checked) == n_rows: - st.caption("Keeping all rows (no duplicates removed)") - elif len(checked) == 1: - st.caption( - f"Merging into Row {checked[0] + 1}, " - f"removing {n_rows - 1} row(s)" - ) else: - st.caption( - f"Keeping {len(checked)} rows, " - f"removing {n_rows - len(checked)}" - ) + if len(checked) == n_rows: + st.caption("Keeping all rows (no duplicates removed)") + elif len(checked) == 1: + st.caption( + f"Merging into Row {checked[0] + 1}, " + f"removing {n_rows - 1} row(s)" + ) + else: + st.caption( + f"Keeping {len(checked)} rows, " + f"removing {n_rows - len(checked)}" + ) + + # Build preview of surviving rows with edits applied + checked_positions = [ + i for i, idx in enumerate(group.row_indices) + if idx in checked + ] + preview = edited.iloc[checked_positions].drop( + columns=["Keep"], + ).reset_index(drop=True) + st.markdown("**Surviving rows preview:**") + st.dataframe(preview, use_container_width=True, hide_index=True) # Confirm def _on_confirm(