Keep the clicked voice chip selected while its summarize job runs

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.
This commit is contained in:
avi 2026-09-18 17:46:25 -05:00
commit d1a85bb6d0

View file

@ -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