hezarfen_frontend
Clone
https://git.tahinli.com/archive/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits
| 1 | import { For } from "solid-js"; |
| 2 | import { useT } from "@/stores/preferences-context"; |
| 3 | |
| 4 | /** The transcript's chapters: the backend joins them with blank lines. */ |
| 5 | export function transcriptChapters(text: string | null | undefined): string[] { |
| 6 | return (text ?? "") |
| 7 | .split(/\r?\n\s*\r?\n/) |
| 8 | .map((chapter) => chapter.trim()) |
| 9 | .filter(Boolean); |
| 10 | } |
| 11 | |
| 12 | /** |
| 13 | * The episode's transcript, one paragraph per chapter. The backend sends it |
| 14 | * without timings, so it reads alongside playback rather than following it. |
| 15 | */ |
| 16 | export function PodcastTranscript(props: { chapters: string[] }) { |
| 17 | const t = useT(); |
| 18 | return ( |
| 19 | <div |
| 20 | class="max-h-72 space-y-3 overflow-y-auto rounded-lg border border-border-hairline bg-surface-base px-3 py-2.5 text-sm leading-relaxed text-muted-foreground" |
| 21 | role="region" |
| 22 | aria-label={t("podcast.transcript.title")} |
| 23 | tabindex="0" |
| 24 | > |
| 25 | <For each={props.chapters}>{(chapter) => <p class="whitespace-pre-line">{chapter}</p>}</For> |
| 26 | </div> |
| 27 | ); |
| 28 | } |