From b1df46ef191236aa900e5079a3d710df38ecc389 Mon Sep 17 00:00:00 2001 From: avi Date: Sun, 13 Sep 2026 16:28:12 -0500 Subject: [PATCH] Desktop: detail screen shows the saved report (summary was unreachable) --- .../kotlin/com/shonar/desktop/DesktopState.kt | 8 +++++- .../main/kotlin/com/shonar/desktop/Screens.kt | 26 ++++++++++++++++--- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/desktop/app/src/main/kotlin/com/shonar/desktop/DesktopState.kt b/desktop/app/src/main/kotlin/com/shonar/desktop/DesktopState.kt index 16b3ca6..5b7adca 100644 --- a/desktop/app/src/main/kotlin/com/shonar/desktop/DesktopState.kt +++ b/desktop/app/src/main/kotlin/com/shonar/desktop/DesktopState.kt @@ -62,6 +62,9 @@ class DesktopState(private val appDir: File = defaultAppDir()) { var jobs: List = emptyList(), var transcript: TranscriptData? = null, var summary: SummaryData? = null, + /** Contents of the saved .transcript.md report, shown when opening + * an already-transcribed file (no live transcript in memory). */ + var reportText: String? = null, var error: String? = null, ) @@ -702,7 +705,10 @@ class DesktopState(private val appDir: File = defaultAppDir()) { fun openDetail(file: File) { pollJob?.cancel() - _detail.value = DetailUi(file = file) + // Show the saved report immediately — otherwise opening a finished + // file looks empty and the summary appears unreachable. + val saved = runCatching { reportFile(file).readText() }.getOrNull() + _detail.value = DetailUi(file = file, reportText = saved) go(Screen.DETAIL) } diff --git a/desktop/app/src/main/kotlin/com/shonar/desktop/Screens.kt b/desktop/app/src/main/kotlin/com/shonar/desktop/Screens.kt index c116a91..cca5b97 100644 --- a/desktop/app/src/main/kotlin/com/shonar/desktop/Screens.kt +++ b/desktop/app/src/main/kotlin/com/shonar/desktop/Screens.kt @@ -320,7 +320,8 @@ fun DetailScreen(state: DesktopState) { Button({ state.retry() }) { Text("Retry transcription") } } } - if (detail.busy == null && detail.transcript == null && detail.error == null) { + if (detail.busy == null && detail.transcript == null && + detail.reportText == null && detail.error == null) { Button({ state.transcribe() }) { Text("Transcribe") } } detail.transcript?.let { t -> @@ -347,10 +348,27 @@ fun DetailScreen(state: DesktopState) { Text(s.short) } } + // No live transcript (file opened from the library after the fact): + // show the saved report so summary + transcript are actually visible. + val savedReport = detail.reportText + if (detail.transcript == null && savedReport != null) { + Text("Saved report", style = MaterialTheme.typography.titleMedium) + val reportLines = savedReport.lines() + LazyColumn(Modifier.fillMaxWidth().weight(1f), + verticalArrangement = Arrangement.spacedBy(2.dp)) { + items(reportLines.size) { i -> + Text(reportLines[i], + style = MaterialTheme.typography.bodyMedium) + } + } + Text("Saved to ${detail.file.nameWithoutExtension}.transcript.md", + style = MaterialTheme.typography.bodySmall, + color = MaterialTheme.colorScheme.onSurfaceVariant) + } Spacer(Modifier.height(4.dp)) - Text("Summaries via Hermes land in Stage 4 — transcription above is complete without it.", - style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant) + if (detail.transcript != null || detail.reportText != null) { + TextButton({ state.transcribe() }) { Text("Re-transcribe") } + } } }