Desktop: detail screen shows the saved report (summary was unreachable)
This commit is contained in:
parent
9618067fc4
commit
b1df46ef19
2 changed files with 29 additions and 5 deletions
|
|
@ -62,6 +62,9 @@ class DesktopState(private val appDir: File = defaultAppDir()) {
|
|||
var jobs: List<JobInfo> = 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)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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,11 +348,28 @@ fun DetailScreen(state: DesktopState) {
|
|||
Text(s.short)
|
||||
}
|
||||
}
|
||||
Spacer(Modifier.height(4.dp))
|
||||
Text("Summaries via Hermes land in Stage 4 — transcription above is complete without it.",
|
||||
// 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))
|
||||
if (detail.transcript != null || detail.reportText != null) {
|
||||
TextButton({ state.transcribe() }) { Text("Re-transcribe") }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@androidx.compose.runtime.Composable
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue