import { useState } from "react"; import { useTranslation } from "react-i18n-lite"; import { highlightBackgroundStyle, markerPassageStyle, normalizeHighlightColor, } from "@/constants/bookmarkHighlightColors"; const PASSAGE_COLLAPSE_CHARS = 200; const THOUGHT_COLLAPSE_CHARS = 120; interface CollapsibleMarkerPassageProps { text: string; highlightColor?: string | null; className?: string; } export function CollapsibleMarkerPassage({ text, highlightColor, className = "annotation-quote marker-thread-passage", }: CollapsibleMarkerPassageProps) { const { t } = useTranslation(); const [expanded, setExpanded] = useState(false); const collapsible = text.length > PASSAGE_COLLAPSE_CHARS; const color = normalizeHighlightColor(highlightColor); return (
“{text}” {collapsible && ( )}
); } interface CollapsibleMarkerThoughtProps { text: string; className?: string; } export function CollapsibleMarkerThought({ text, className = "marker-thread-thought", }: CollapsibleMarkerThoughtProps) { const { t } = useTranslation(); const [expanded, setExpanded] = useState(false); const collapsible = text.length > THOUGHT_COLLAPSE_CHARS; return (

{text}

{collapsible && ( )}
); }