import Link from "next/link"; import { UpvoteButton } from "./UpvoteButton"; interface IdeaCardProps { idea: { id: string; title: string; problemStatement: string; tags: string[]; upvotesCount: number; commentsCount: number; createdAt: string; tasks?: { id: string; status: string }[]; }; hasVoted?: boolean; } function timeAgo(date: string): string { const seconds = Math.floor( (Date.now() - new Date(date).getTime()) / 1000 ); if (seconds < 60) return "just now"; const minutes = Math.floor(seconds / 60); if (minutes < 60) return `${minutes}m ago`; const hours = Math.floor(minutes / 60); if (hours < 24) return `${hours}h ago`; const days = Math.floor(hours / 24); return `${days}d ago`; } export function IdeaCard({ idea, hasVoted = false }: IdeaCardProps) { const tasksDone = idea.tasks?.filter((t) => t.status === "done").length || 0; const tasksTotal = idea.tasks?.length || 0; return (
{idea.problemStatement}