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' interface CompactViewProps { bookmark: IndividualBookmark index: number hasUrls: boolean extractedUrls: string[] onSelectUrl?: (url: string, bookmark?: { id: string; kind: number; tags: string[][]; pubkey: string }) => void articleSummary?: string contentTypeIcon: IconDefinition readingProgress?: number } export const CompactView: React.FC = ({ bookmark, index, hasUrls, extractedUrls, onSelectUrl, articleSummary, 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 && articleSummary ? articleSummary : bookmark.content // Calculate progress color let progressColor = '#6366f1' // Default blue (reading) if (readingProgress && readingProgress >= 0.95) { progressColor = '#10b981' // Green (completed) } else if (readingProgress && readingProgress > 0 && readingProgress <= 0.10) { progressColor = 'var(--color-text)' // Neutral text color (started) } const handleCompactClick = () => { if (isArticle) { onSelectUrl?.('', { id: bookmark.id, kind: bookmark.kind, tags: bookmark.tags, pubkey: bookmark.pubkey }) } 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 for all bookmark types with reading data */} {readingProgress !== undefined && readingProgress > 0 && (
)}
) }