Files
shumai/packages/webui/components/viewers/video/transcript-toggle-button.tsx
T
Yiling-J d3899d1257 feat(video): add video transcripts (#559)
* feat(video): generate transcripts with the local embedding server

* feat(video): show saved transcripts in the player

* fix(video): preserve transcript seek timestamps

* fix(video): refine transcript viewing and generation

* feat(video): resize transcripts and follow playback earlier

* fix(video): animate transcript playback scrolling

* fix(video): transcribe from the smallest full proxy

* fix(video): refine the sync to playback button

* feat(video): edit transcript segment text inline

* fix(video): keep transcript segment highlighted over edit button

* docs(video): note embedding server version for transcripts
2026-12-04 13:49:25 +08:00

32 lines
876 B
TypeScript

import { cn } from '@/ui/lib/utils'
import { m } from '@/ui/paraglide/messages.js'
import { ListVideo } from 'lucide-react'
import type { TranscriptToggle } from '../types'
export function TranscriptToggleButton({
panelId,
open,
buttonRef,
onToggle,
className,
}: TranscriptToggle & { className?: string }) {
return (
<button
ref={buttonRef}
type="button"
aria-label={m.transcript_view()}
aria-expanded={open}
aria-controls={open ? panelId : undefined}
title={m.transcript_view()}
className={cn(
'shrink-0 cursor-pointer rounded transition-colors hover:text-primary focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none',
open && 'text-primary',
className,
)}
onClick={onToggle}
>
<ListVideo className="size-5" aria-hidden="true" />
</button>
)
}