feat: ilan ve ihale tarihi etiketli gosteriliyor + 'sadece acik ihaleler' filtresi gercekten calisiyor (varsayilan acik)

This commit is contained in:
2026-08-30 17:58:26 +03:00
parent 14f24e00f4
commit ac77146f73
5 changed files with 77 additions and 8 deletions
+39 -6
View File
@@ -1,6 +1,6 @@
import React from 'react';
import { useApp } from '../context/AppContext';
import { Star, MapPin, Clock, Tag, Package, Building2, AlertTriangle, Sparkles } from 'lucide-react';
import { Star, MapPin, Clock, Tag, Package, Building2, AlertTriangle, Sparkles, CalendarDays, Megaphone } from 'lucide-react';
export const TenderCard = ({ tender }) => {
const { toggleTrackTender, setActiveTenderDetail, favoriteKurumlar, toggleFavoriteKurum } = useApp();
@@ -9,6 +9,18 @@ export const TenderCard = ({ tender }) => {
const [day, monthYear] = tender.tarih ? tender.tarih.split('.') : ['01', '01.2026'];
const monthYearFormatted = monthYear ? `${monthYear}` : '08.2026';
// İlan (yayım) tarihi kaynaklara göre farklı biçimde geliyor:
// canlı akış ISO (2026-08-30), DT/arşiv gg.aa.yyyy. İkisini de gösterebilelim.
const ilanTarihiGoster = (() => {
const v = tender.ilanTarihi;
if (!v) return null;
if (/^\d{4}-\d{2}-\d{2}/.test(v)) {
const [y, a, g] = v.slice(0, 10).split('-');
return `${g}.${a}.${y}`;
}
return v;
})();
return (
<div className="bg-white rounded-xl border border-blue-200/80 shadow-xs hover:shadow-md transition-all overflow-hidden flex flex-col md:flex-row group border-l-4 border-l-blue-600">
@@ -17,7 +29,8 @@ export const TenderCard = ({ tender }) => {
onClick={() => setActiveTenderDetail(tender)}
className="bg-[#edf4ff] group-hover:bg-[#e2edff] text-blue-900 md:w-36 p-4 flex flex-col items-center justify-center shrink-0 border-b md:border-b-0 md:border-r border-blue-100 cursor-pointer select-none transition-colors"
>
<span className="text-3xl font-black tracking-tight text-blue-700">{day}</span>
<span className="text-[9px] font-black uppercase tracking-widest text-blue-900/50">İhale</span>
<span className="text-3xl font-black tracking-tight text-blue-700 leading-none">{day}</span>
<span className="text-xs font-bold text-blue-900/80 mt-0.5">{monthYearFormatted}</span>
<span className="text-[11px] font-semibold bg-white/80 px-2 py-0.5 rounded-full text-blue-800 mt-2 border border-blue-200">
{tender.saat}
@@ -75,10 +88,30 @@ export const TenderCard = ({ tender }) => {
<MapPin className="w-3.5 h-3.5 text-rose-500 shrink-0" />
<span>{tender.sehir}</span>
</span>
<span className="bg-emerald-50 text-emerald-700 border border-emerald-200 px-2 py-0.5 rounded-full text-[10px] font-bold flex items-center gap-1">
<Clock className="w-3 h-3 text-emerald-600" />
<span>{tender.eklenmeZamani}</span>
</span>
{ilanTarihiGoster && (
<span
className="bg-emerald-50 text-emerald-700 border border-emerald-200 px-2 py-0.5 rounded-full text-[10px] font-bold flex items-center gap-1"
title="İlanın yayımlandığı tarih"
>
<Megaphone className="w-3 h-3 text-emerald-600" />
<span>İlan: {ilanTarihiGoster}</span>
</span>
)}
{tender.tarih && (
<span
className="bg-blue-50 text-blue-700 border border-blue-200 px-2 py-0.5 rounded-full text-[10px] font-bold flex items-center gap-1"
title="İhalenin yapılacağı tarih"
>
<CalendarDays className="w-3 h-3 text-blue-600" />
<span>İhale: {tender.tarih}{tender.saat ? ` ${tender.saat}` : ''}</span>
</span>
)}
{tender.eklenmeZamani && !ilanTarihiGoster && (
<span className="bg-slate-100 text-slate-600 border border-slate-200 px-2 py-0.5 rounded-full text-[10px] font-bold flex items-center gap-1">
<Clock className="w-3 h-3 text-slate-500" />
<span>{tender.eklenmeZamani}</span>
</span>
)}
<span className="text-slate-400 font-mono text-[11px]">
# {tender.ikn}
</span>