import React from 'react'; import Image from 'next/image'; import { useImageProxy } from '@/hooks/useImageProxy'; import { formatUnixTimestamp } from '@/utils/time'; import { Tag } from 'primereact/tag'; import { Message } from 'primereact/message'; import GenericButton from '@/components/buttons/GenericButton'; import useWindowWidth from '@/hooks/useWindowWidth'; import { BookOpen } from 'lucide-react'; import { highlightText, getTextWithMatchContext } from '@/utils/text'; const ContentDropdownItem = ({ content, onSelect }) => { const { returnImageProxy } = useImageProxy(); const windowWidth = useWindowWidth(); const isMobile = windowWidth <= 600; // Get match information if available const matches = content?._matches || {}; return (
{matches.description ? highlightText( getTextWithMatchContext(content.summary, matches.description.term, 60), matches.description.term, 'bg-yellow-500/30 text-white font-medium px-0.5 rounded' ) : content.summary}
)}