import { Link, useNavigate } from "react-router"; import type { Dump } from "../model.ts"; import { relativeTime } from "../utils/relativeTime.ts"; import { isDumpVisited, isRecent, markDumpVisited } from "../utils/visited.ts"; import FilePreview from "./FilePreview.tsx"; import RichContentCard from "./RichContentCard.tsx"; import { VoteButton } from "./VoteButton.tsx"; import { Markdown } from "./Markdown.tsx"; interface DumpCardProps { dump: Dump; voteCount: number; voted: boolean; canVote: boolean; castVote: (id: string) => void; removeVote: (id: string) => void; className?: string; isOwner?: boolean; } export function DumpCard( { dump, voteCount, voted, canVote, castVote, removeVote, className, isOwner }: DumpCardProps, ) { const navigate = useNavigate(); const unread = !isOwner && isRecent(dump.createdAt) && !isDumpVisited(dump.id); function handleNavigate() { markDumpVisited(dump.id); navigate(`/dumps/${dump.id}`); } return (