"use client" import { useState, useCallback, useRef, useEffect } from "react" import { cn } from "@lib/utils" import { dmSansClassName } from "@/lib/fonts" import { ChevronLeft, ChevronRight, Info, MessageSquare, Link2, ArrowUp, X, } from "lucide-react" import { Logo } from "@ui/assets/Logo" import { analytics } from "@/lib/analytics" export type HighlightFormat = "paragraph" | "bullets" | "quote" | "one_liner" export interface HighlightItem { id: string title: string content: string format: HighlightFormat query: string sourceDocumentIds: string[] } interface HighlightsCardProps { items: HighlightItem[] onChat: (highlightContent: string, userReply: string) => void onShowRelated: (query: string) => void isLoading?: boolean } function renderContent(content: string, format: HighlightFormat) { switch (format) { case "bullets": { const lines = content .split("\n") .map((line) => line.replace(/^[-•*]\s*/, "").trim()) .filter(Boolean) return (
"{content}"
) case "one_liner": return{content}
default: return{content}
} } export function HighlightsCard({ items, onChat, onShowRelated, isLoading = false, }: HighlightsCardProps) { const [activeIndex, setActiveIndex] = useState(0) const [isReplyOpen, setIsReplyOpen] = useState(false) const [replyText, setReplyText] = useState("") const replyInputRef = useRefAdd some documents to see highlights here
{currentItem.title}