import { Card, CardContent, CardHeader } from '@/components/ui/card';
import { Button } from '@/components/ui/button';
import { Badge } from '@/components/ui/badge';
import {
Bookmark as BookmarkIcon,
MessageSquare,
FileText,
Trash2,
ExternalLink,
} from 'lucide-react';
import { Bookmark, BookmarkType } from '@opchan/core';
import { useUserDisplay } from '@/hooks';
import { cn } from '@opchan/core';
import { formatDistanceToNow } from 'date-fns';
import { useNavigate } from 'react-router-dom';
interface BookmarkCardProps {
bookmark: Bookmark;
onRemove: (bookmarkId: string) => void;
onNavigate?: (bookmark: Bookmark) => void;
className?: string;
}
export function BookmarkCard({
bookmark,
onRemove,
onNavigate,
className,
}: BookmarkCardProps) {
const authorInfo = useUserDisplay(bookmark.author || '');
const navigate = useNavigate();
const handleNavigate = () => {
if (onNavigate) {
onNavigate(bookmark);
} else {
// Default navigation behavior
if (bookmark.type === BookmarkType.POST) {
navigate(`/post/${bookmark.targetId}`);
} else if (bookmark.type === BookmarkType.COMMENT && bookmark.postId) {
navigate(`/post/${bookmark.postId}#comment-${bookmark.targetId}`);
}
}
};
const handleRemove = (e: React.MouseEvent) => {
e.stopPropagation();
onRemove(bookmark.id);
};
return (
{bookmark.title || 'Untitled'}
Bookmark posts and comments you want to revisit later. Your bookmarks are saved locally and won't be shared.