import { useState } from 'react' import { Link } from 'react-router-dom' import { SectionBanner } from '@/components/ui/SectionBanner' import { reports, type Report } from '@/data/reports' const displayReports = reports.filter(r => !r.featured).slice(0, 6) const typeLabel: Record = { quarterly: 'گزارش فصلی', flash: 'فوری', risk: 'ریسک', free: 'رایگان', special: 'ویژه', } const dotColor: Record = { quarterly: 'var(--ink)', flash: 'var(--red)', risk: 'var(--red)', free: 'var(--green-ink)', special: 'var(--amber)', } function formatPrice(n: number) { return n.toLocaleString('fa-IR') } interface ReportCardProps { report: Report colIndex: number rowIndex: number totalRows: number } function ReportCard({ report, colIndex, rowIndex, totalRows }: ReportCardProps) { const [hovered, setHovered] = useState(false) const isLastRow = rowIndex === totalRows - 1 const isRightCol = colIndex === 0 // RTL: right col is index 0 return (
setHovered(true)} onMouseLeave={() => setHovered(false)} > {/* Type badge */}
{typeLabel[report.type] ?? report.type} · {report.category}
{/* Title */}

{report.title}

{/* Deck */}

{report.summary.slice(0, 140)} {report.summary.length > 140 ? '…' : ''}

{/* Divider */}
{/* Footer row */}
{/* Price block */}
{report.isFree ? ( دانلود رایگان ) : ( {formatPrice(report.price)} تومان )}
{report.pages} صفحه · {report.publishDate}
{/* Buy link */} (e.currentTarget.style.textDecoration = 'underline') } onMouseLeave={e => (e.currentTarget.style.textDecoration = 'none')} > {report.isFree ? 'دانلود' : 'خرید گزارش'} ←
) } export default function LatestReportsSection() { const rows = Math.ceil(displayReports.length / 2) return (
{/* Section header */}
{/* 2-col grid */}
{displayReports.map((report, idx) => { const colIndex = idx % 2 const rowIndex = Math.floor(idx / 2) return ( ) })}
) }