Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

755 B
Raw Blame
import { parseCitedSegments } from '../utils/citations'
import { QuillTimestampCitation } from './QuillTimestampCitation'

export function QuillCitedText({
    text,
    segments,
    onSeek,
}: {
    text: string
    segments: unknown
    onSeek?: (timestampMs: number) => void
}): JSX.Element {
    const list = parseCitedSegments(text, segments)
    if (list.length === 0) {
        return <>{text}</>
    }
    return (
        <>
            {list.map((segment, i) =>
                segment.kind === 'text' ? (
                    <span key={i}>{segment.value}</span>
                ) : (
                    <QuillTimestampCitation key={i} timestampMs={segment.timestamp_ms} onSeek={onSeek} />
                )
            )}
        </>
    )
}