import React from 'react' import { useNavigate } from 'react-router-dom' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { IconDefinition } from '@fortawesome/fontawesome-svg-core' import { IndividualBookmark } from '../../types/bookmarks' import { formatDateCompact } from '../../utils/bookmarkUtils' import RichContent from '../RichContent' import { naddrEncode } from 'nostr-tools/nip19' import { ReadingProgressBar } from '../ReadingProgressBar' interface CompactViewProps { bookmark: IndividualBookmark index: number hasUrls: boolean extractedUrls: string[] onSelectUrl?: (url: string, bookmark?: { id: string; kind: number; tags: string[][]; pubkey: string }) => void articleTitle?: string contentTypeIcon: IconDefinition readingProgress?: number } export const CompactView: React.FC = ({ bookmark, index, hasUrls, extractedUrls, onSelectUrl, articleTitle, contentTypeIcon, readingProgress }) => { const navigate = useNavigate() const isArticle = bookmark.kind === 30023 const isWebBookmark = bookmark.kind === 39701 const isNote = bookmark.kind === 1 const isClickable = hasUrls || isArticle || isWebBookmark || isNote const displayText = isArticle && articleTitle ? articleTitle : bookmark.content const handleCompactClick = () => { if (isArticle) { const dTag = bookmark.tags.find(t => t[0] === 'd')?.[1] if (dTag) { const naddr = naddrEncode({ kind: bookmark.kind, pubkey: bookmark.pubkey, identifier: dTag }) navigate(`/a/${naddr}`) } } else if (hasUrls) { onSelectUrl?.(extractedUrls[0]) } else if (isNote) { navigate(`/e/${bookmark.id}`) } } return (
{displayText ? (
60 ? '…' : '')} className="" />
) : (
{bookmark.id.slice(0, 12)}...
)} {formatDateCompact(bookmark.created_at ?? bookmark.listUpdatedAt)} {/* CTA removed */}
{/* Reading progress indicator - only show when there's actual progress */} {readingProgress !== undefined && readingProgress > 0 && ( )}
) }