From d1a85bb6d07f34239b43dc6ac857cacaaf632140 Mon Sep 17 00:00:00 2001 From: avi Date: Fri, 18 Sep 2026 17:46:25 -0500 Subject: [PATCH] Keep the clicked voice chip selected while its summarize job runs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Chips are disabled during a run, so selection followed the previous summary's voice while the new job churned — Neutral grayed out next to a highlighted sarcastic even though sarcastic was what was running. Selection now prefers the running job's tone, then the live draft, then the saved summary. --- .../main/kotlin/com/shonar/desktop/Screens.kt | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/shonar/desktop/Screens.kt b/app/src/main/kotlin/com/shonar/desktop/Screens.kt index 2caee7d..34f644c 100644 --- a/app/src/main/kotlin/com/shonar/desktop/Screens.kt +++ b/app/src/main/kotlin/com/shonar/desktop/Screens.kt @@ -596,6 +596,20 @@ fun DetailScreen(state: DesktopState) { ?: emptyList() val recHits = searchTranscriptLines(transcriptLines, recQuery) + // Voice shown as SELECTED on the chips: the running job's tone first + // (chips are disabled mid-run — the selection must say which voice is + // cooking), then the current summary's tone (reopening a file shows + // the voice it was actually summarized in — sumTone resets to null on + // every navigation and used to leave Neutral falsely selected), and + // only then a fresh click with no summary yet. + val sJobNow = detail.jobs.firstOrNull { it.jobType == "summarize" } + val sSummary = detail.summary + val chipTone: String? = when { + sJobNow != null && sJobNow.status in setOf("queued", "running") -> sJobNow.tone + sSummary != null -> sSummary.tone + else -> sumTone + } + // Header stays pinned (outside the scroller): deep in a long // transcript, scrolling all the way up just to leave the page was // the complaint. Everything below scrolls as one flow. @@ -909,7 +923,7 @@ fun DetailScreen(state: DesktopState) { Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) { SUMMARIZE_PERSONAS.forEach { (label, tone) -> FilterChip( - selected = sumTone == tone, + selected = chipTone == tone, enabled = voicesEnabled, onClick = { sumTone = tone @@ -975,7 +989,7 @@ fun DetailScreen(state: DesktopState) { Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) { SUMMARIZE_PERSONAS.forEach { (label, tone) -> FilterChip( - selected = sumTone == tone, + selected = chipTone == tone, enabled = voicesEnabled, onClick = { sumTone = tone