"use client" import { formatPrice } from "@/lib/calculations" import { type StoredQuote, type QuoteStatus } from "@/lib/db" import { Button } from "@/components/ui/button" import { Phone, Check, X, ExternalLink } from "lucide-react" interface QuoteCardProps { quote: StoredQuote onStatusChange: (id: number, status: QuoteStatus) => void onReject: (quote: StoredQuote) => void } function formatRelativeDate(dateString: string): string { const date = new Date(dateString) const now = new Date() const diffMs = now.getTime() - date.getTime() const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24)) if (diffDays === 0) return "I dag" if (diffDays === 1) return "I går" if (diffDays < 7) return `${diffDays}d` if (diffDays < 30) return `${Math.floor(diffDays / 7)}u` return `${Math.floor(diffDays / 30)}m` } export function QuoteCard({ quote, onStatusChange, onReject }: QuoteCardProps) { const slug = `${quote.postalCode}-${quote.id}` const detailUrl = `/tilbud/${slug}` return (
{/* Main content - clickable */}
{quote.customerName}
{quote.postalCode} · {quote.area}m² · {formatRelativeDate(quote.createdAt)}
{quote.totalInclVat ? formatPrice(Math.round(quote.totalInclVat)) : "—"}
{/* Action buttons - always visible */}
) }