Compact recordings list rows to title plus one transcript preview line.

This commit is contained in:
ben
2026-08-12 20:36:22 +02:00
parent 6bc5a20606
commit b7c36b8b3b
3 changed files with 40 additions and 13 deletions
+22
View File
@@ -179,6 +179,28 @@ class Recording extends Model
});
}
/**
* First line of the transcript, truncated for compact list rows.
*/
public function transcriptFirstLine(int $limit = 120): ?string
{
if (! filled($this->transcript)) {
return null;
}
$firstLine = Str::of($this->transcript)
->before("\n")
->replaceMatches('/\s+/', ' ')
->trim()
->toString();
if ($firstLine === '') {
return null;
}
return Str::limit($firstLine, $limit);
}
/**
* Short transcript excerpt, optionally centered on a search hit.
*/