Desktop: detail screen shows the saved report (summary was unreachable)

This commit is contained in:
avi 2026-09-13 16:28:12 -05:00
commit b1df46ef19
2 changed files with 29 additions and 5 deletions

View file

@ -62,6 +62,9 @@ class DesktopState(private val appDir: File = defaultAppDir()) {
var jobs: List<JobInfo> = emptyList(), var jobs: List<JobInfo> = emptyList(),
var transcript: TranscriptData? = null, var transcript: TranscriptData? = null,
var summary: SummaryData? = 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, var error: String? = null,
) )
@ -702,7 +705,10 @@ class DesktopState(private val appDir: File = defaultAppDir()) {
fun openDetail(file: File) { fun openDetail(file: File) {
pollJob?.cancel() 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) go(Screen.DETAIL)
} }

View file

@ -320,7 +320,8 @@ fun DetailScreen(state: DesktopState) {
Button({ state.retry() }) { Text("Retry transcription") } 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") } Button({ state.transcribe() }) { Text("Transcribe") }
} }
detail.transcript?.let { t -> detail.transcript?.let { t ->
@ -347,11 +348,28 @@ fun DetailScreen(state: DesktopState) {
Text(s.short) Text(s.short)
} }
} }
Spacer(Modifier.height(4.dp)) // No live transcript (file opened from the library after the fact):
Text("Summaries via Hermes land in Stage 4 — transcription above is complete without it.", // 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, style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant) color = MaterialTheme.colorScheme.onSurfaceVariant)
} }
Spacer(Modifier.height(4.dp))
if (detail.transcript != null || detail.reportText != null) {
TextButton({ state.transcribe() }) { Text("Re-transcribe") }
}
}
} }
@androidx.compose.runtime.Composable @androidx.compose.runtime.Composable