feat: tüm mock veriyi kaldır + Resend e-posta entegrasyonu

- mockTenders.js silindi; referans listeleri (sektör/il/kurum) constants.js'e taşındı
- AppContext: tenders/liveStats/competitorWatchlist/vaultDocuments/notifications/
  savedFilters/apiKeys/scrapedCapabilities → gerçek/boş; sahte Math.random online
  sayacı kaldırıldı; competitor & belge kasası artık localStorage
- LiveStatsBar: gerçek alanlar (canlı havuz/yüklü/bugün/kalem/takibimdeki)
- AnalyticsDashboard: KPI'lar (katılım/kazanma oranı/kazanılan bedel) + aylık hacim
  + sektörel dağılım gerçek companyStats/monthlyStats/sectorStats'tan; ciro hedefi
  kullanıcı tarafından belirlenir; veri yoksa dürüst boş durum
- ContractSearch & Rakip Radar: gerçek firmStats
- analytics.js: companyStats/monthlyStats/parseDateTR eklendi
- Resend: server/email.mjs + /api/notify/email/config + /api/notify/email/test
  (auth'lu, kullanıcının kendi adresine); PwaSettings gerçek e-posta test kartı
This commit is contained in:
2026-08-28 08:49:10 +03:00
parent 7521f798f6
commit 3e129c2988
14 changed files with 497 additions and 555 deletions
+104 -77
View File
@@ -1,40 +1,30 @@
import React from 'react';
import React, { useState, useEffect } from 'react';
import { useApp } from '../../context/AppContext';
import { BarChart3, TrendingUp, Trophy, Target, MapPin, Building2, Award, ArrowUpRight, DollarSign } from 'lucide-react';
import { BarChart3, TrendingUp, Trophy, Target, Award, ArrowUpRight, Pencil } from 'lucide-react';
import { ResponsiveContainer, BarChart, Bar, XAxis, YAxis, Tooltip, CartesianGrid, PieChart, Pie, Cell } from 'recharts';
import { TurkeyHeatMap } from './TurkeyHeatMap';
import { companyStats, monthlyStats, sectorStats, formatTL } from '../../services/analytics';
const PIE_COLORS = ['#2563eb', '#059669', '#7c3aed', '#d97706', '#dc2626', '#0891b2', '#db2777', '#65a30d'];
export const AnalyticsDashboard = () => {
const { tenders, userProfile } = useApp();
const monthlyData = [
{ month: 'Ocak', kazanim: 380000, katilim: 550000 },
{ month: 'Şubat', kazanim: 420000, katilim: 600000 },
{ month: 'Mart', kazanim: 510000, katilim: 720000 },
{ month: 'Nisan', kazanim: 490000, katilim: 680000 },
{ month: 'Mayıs', kazanim: 610000, katilim: 850000 },
{ month: 'Haziran', kazanim: 580000, katilim: 810000 },
{ month: 'Temmuz', kazanim: 410000, katilim: 590000 }
];
const cs = companyStats(tenders);
const monthlyData = monthlyStats(tenders);
const sektorler = sectorStats(tenders);
const pieData = sektorler.slice(0, 6).map((s, i) => ({ name: s.sektor, value: s.count, color: PIE_COLORS[i % PIE_COLORS.length] }));
const pieToplam = pieData.reduce((s, p) => s + p.value, 0);
const pieData = [
{ name: 'Tıbbi Malzeme', value: 45, color: '#2563eb' },
{ name: 'Kırtasiye & Büro', value: 25, color: '#059669' },
{ name: 'Temizlik & Hijyen', value: 18, color: '#7c3aed' },
{ name: 'Bilişim & Donanım', value: 12, color: '#d97706' }
];
const cityHeatmap = [
{ city: 'Ankara', ihaleSayisi: 1420, ortalamaMaliyet: '₺240.000', yogunluk: 'Çok Yüksek (%88)', color: 'bg-red-500 text-white' },
{ city: 'Kayseri', ihaleSayisi: 850, ortalamaMaliyet: '₺180.000', yogunluk: 'Yüksek (%74)', color: 'bg-amber-500 text-white' },
{ city: 'İstanbul', ihaleSayisi: 2100, ortalamaMaliyet: '₺410.000', yogunluk: 'Çok Yüksek (%94)', color: 'bg-red-600 text-white' },
{ city: 'İzmir', ihaleSayisi: 980, ortalamaMaliyet: '₺210.000', yogunluk: 'Orta (%62)', color: 'bg-emerald-500 text-white' },
{ city: 'Antalya', ihaleSayisi: 640, ortalamaMaliyet: '₺165.000', yogunluk: 'Orta (%55)', color: 'bg-blue-500 text-white' }
];
// Ciro hedefi — kullanıcı belirler (localStorage)
const [hedef, setHedef] = useState(() => Number(localStorage.getItem('ihaleist_ciro_hedefi') || 0));
const [editing, setEditing] = useState(false);
useEffect(() => { localStorage.setItem('ihaleist_ciro_hedefi', String(hedef)); }, [hedef]);
const hedefYuzde = hedef > 0 ? Math.min(Math.round((cs.wonTotal / hedef) * 100), 100) : 0;
return (
<div className="space-y-6 animate-fade-in">
{/* Header Banner */}
<div className="bg-linear-to-r from-slate-900 via-purple-950 to-indigo-900 text-white p-6 rounded-2xl shadow-lg border border-purple-800/40 flex items-center justify-between">
<div className="flex items-center gap-3">
@@ -43,108 +33,145 @@ export const AnalyticsDashboard = () => {
</div>
<div>
<h2 className="font-extrabold text-xl">Analitik Dashboard & Fiyat Isı Haritası</h2>
<p className="text-xs text-purple-200 mt-0.5">{userProfile.company} firmasına özel kazanma oranı, ciro hedefleri ve il bazlı ihale yoğunluk analizi.</p>
<p className="text-xs text-purple-200 mt-0.5">{userProfile.company} — kanban süreçlerinizden hesaplanan gerçek kazanma oranı ve il bazlı ihale yoğunluğu.</p>
</div>
</div>
</div>
{/* KPI Cards & Ciro Target */}
{/* KPI Cards & Ciro Target — gerçek (kanban/takip verisinden) */}
<div className="grid grid-cols-1 md:grid-cols-4 gap-4">
<div className="bg-white p-5 rounded-2xl border border-slate-200 shadow-xs space-y-2">
<span className="text-xs font-bold text-slate-500 uppercase tracking-wider block">Katıldığımız İhaleler</span>
<div className="flex items-center justify-between">
<span className="text-2xl font-black text-slate-900">34 İhale</span>
<span className="text-2xl font-black text-slate-900">{cs.participated} İhale</span>
<div className="w-8 h-8 rounded-lg bg-blue-50 text-blue-600 flex items-center justify-center">
<Trophy className="w-4 h-4" />
</div>
</div>
<span className="text-[11px] text-slate-400">Teklif verilen + sonuçlanan</span>
</div>
<div className="bg-white p-5 rounded-2xl border border-slate-200 shadow-xs space-y-2">
<span className="text-xs font-bold text-slate-500 uppercase tracking-wider block">İhale Kazanma Oranımız</span>
<div className="flex items-center justify-between">
<span className="text-2xl font-black text-emerald-600">%68</span>
<span className="bg-emerald-100 text-emerald-800 font-extrabold text-[10px] px-2 py-0.5 rounded-full flex items-center gap-0.5">
<ArrowUpRight className="w-3 h-3" /> +%12
</span>
<span className="text-2xl font-black text-emerald-600">%{cs.winRate}</span>
{cs.resulted > 0 && (
<span className="bg-emerald-100 text-emerald-800 font-extrabold text-[10px] px-2 py-0.5 rounded-full flex items-center gap-0.5">
<ArrowUpRight className="w-3 h-3" /> {cs.won}/{cs.resulted}
</span>
)}
</div>
<span className="text-[11px] text-slate-400">{cs.resulted > 0 ? `${cs.resulted} sonuçlanan ihaleden` : 'Henüz sonuçlanan ihale yok'}</span>
</div>
<div className="bg-white p-5 rounded-2xl border border-slate-200 shadow-xs space-y-2">
<span className="text-xs font-bold text-slate-500 uppercase tracking-wider block">Toplam Kazanılan Bedel</span>
<div className="flex items-center justify-between">
<span className="text-2xl font-black text-indigo-900">₺3.400.000</span>
<span className="text-2xl font-black text-indigo-900">{formatTL(cs.wonTotal)}</span>
<div className="w-8 h-8 rounded-lg bg-indigo-50 text-indigo-600 flex items-center justify-center">
<Award className="w-4 h-4" />
</div>
</div>
<span className="text-[11px] text-slate-400">{cs.contracts} sözleşme</span>
</div>
{/* Target Progress Card */}
{/* Ciro Hedefi — kullanıcı belirler */}
<div className="bg-linear-to-br from-blue-900 to-indigo-900 text-white p-5 rounded-2xl shadow-xs space-y-2">
<div className="flex justify-between items-center text-xs font-bold">
<span className="text-blue-200 uppercase tracking-wider flex items-center gap-1">
<Target className="w-3.5 h-3.5 text-amber-300" /> 2026 Ciro Hedefi
<Target className="w-3.5 h-3.5 text-amber-300" /> Ciro Hedefi
</span>
<span className="text-amber-300 font-black">%68</span>
</div>
<span className="text-xl font-black text-white block">₺3.4M / ₺5.0M</span>
<div className="w-full bg-blue-950 rounded-full h-2 overflow-hidden border border-blue-700">
<div className="bg-amber-400 h-2 rounded-full" style={{ width: '68%' }} />
<button onClick={() => setEditing((e) => !e)} className="text-blue-200 hover:text-white" title="Hedefi düzenle">
{hedef > 0 ? <span className="text-amber-300 font-black">%{hedefYuzde}</span> : <Pencil className="w-3.5 h-3.5" />}
</button>
</div>
{editing || hedef === 0 ? (
<div className="flex items-center gap-1.5 pt-1">
<input
type="number"
value={hedef || ''}
onChange={(e) => setHedef(Number(e.target.value) || 0)}
placeholder="Hedef bedel (₺)"
className="w-full bg-blue-950/60 border border-blue-700 rounded-lg px-2 py-1.5 text-xs text-white placeholder:text-blue-300"
/>
<button onClick={() => setEditing(false)} className="bg-amber-400 text-blue-950 font-black text-xs px-2.5 py-1.5 rounded-lg">Kaydet</button>
</div>
) : (
<>
<span className="text-lg font-black text-white block">{formatTL(cs.wonTotal)} / {formatTL(hedef)}</span>
<div className="w-full bg-blue-950 rounded-full h-2 overflow-hidden border border-blue-700">
<div className="bg-amber-400 h-2 rounded-full transition-all" style={{ width: `${hedefYuzde}%` }} />
</div>
</>
)}
</div>
</div>
{/* Recharts Row */}
{/* Recharts Row — gerçek veriden */}
<div className="grid grid-cols-1 lg:grid-cols-3 gap-6">
{/* Monthly Revenue Chart */}
<div className="lg:col-span-2 bg-white p-5 rounded-2xl border border-slate-200 shadow-xs space-y-4">
<h3 className="font-extrabold text-sm text-slate-900 flex items-center gap-2">
<TrendingUp className="w-4 h-4 text-blue-600" /> Aylık İhale Kazanım ve Teklif Hacmi (TL)
</h3>
<div className="h-64 w-full">
<ResponsiveContainer width="100%" height="100%">
<BarChart data={monthlyData}>
<CartesianGrid strokeDasharray="3 3" vertical={false} stroke="#f1f5f9" />
<XAxis dataKey="month" tick={{ fontSize: 11 }} />
<YAxis tick={{ fontSize: 10 }} width={60} tickFormatter={(val) => `₺${val/1000}k`} />
<Tooltip formatter={(value) => [`₺${value.toLocaleString('tr-TR')}`, '']} />
<Bar dataKey="katilim" fill="#94a3b8" name="Toplam Verilen Teklif" radius={[4, 4, 0, 0]} />
<Bar dataKey="kazanim" fill="#2563eb" name="Kazanılan İhale Hacmi" radius={[4, 4, 0, 0]} />
</BarChart>
</ResponsiveContainer>
{monthlyData.length === 0 ? (
<div className="h-full flex flex-col items-center justify-center text-center border-2 border-dashed border-slate-200 rounded-xl">
<p className="text-sm font-bold text-slate-400">Henüz teklif/sonuç verisi yok</p>
<p className="text-xs text-slate-400 mt-1 max-w-xs">Kanban'da ihaleleri "teklif verildi / kazanıldı / kaybedildi" durumuna aldıkça aylık hacim grafiği oluşur.</p>
</div>
) : (
<ResponsiveContainer width="100%" height="100%">
<BarChart data={monthlyData}>
<CartesianGrid strokeDasharray="3 3" vertical={false} stroke="#f1f5f9" />
<XAxis dataKey="month" tick={{ fontSize: 11 }} />
<YAxis tick={{ fontSize: 10 }} width={60} tickFormatter={(val) => `₺${Math.round(val / 1000)}k`} />
<Tooltip formatter={(value) => [`₺${value.toLocaleString('tr-TR')}`, '']} />
<Bar dataKey="katilim" fill="#94a3b8" name="Toplam Verilen Teklif" radius={[4, 4, 0, 0]} />
<Bar dataKey="kazanim" fill="#2563eb" name="Kazanılan İhale Hacmi" radius={[4, 4, 0, 0]} />
</BarChart>
</ResponsiveContainer>
)}
</div>
</div>
{/* Sector Distribution Pie */}
<div className="bg-white p-5 rounded-2xl border border-slate-200 shadow-xs space-y-4">
<h3 className="font-extrabold text-sm text-slate-900">Sektörel İhale Kazanım Dağılımı</h3>
<div className="h-48 w-full">
<ResponsiveContainer width="100%" height="100%">
<PieChart>
<Pie data={pieData} dataKey="value" nameKey="name" cx="50%" cy="50%" innerRadius={40} outerRadius={70} paddingAngle={4}>
{pieData.map((entry, index) => (
<Cell key={`cell-${index}`} fill={entry.color} />
))}
</Pie>
<Tooltip formatter={(value) => [`%${value}`, 'Oran']} />
</PieChart>
</ResponsiveContainer>
</div>
<div className="space-y-1.5 pt-2">
{pieData.map(item => (
<div key={item.name} className="flex justify-between items-center text-xs font-semibold">
<span className="flex items-center gap-2">
<span className="w-2.5 h-2.5 rounded-full" style={{ backgroundColor: item.color }}></span>
<span>{item.name}</span>
</span>
<span className="font-bold text-slate-900">%{item.value}</span>
<h3 className="font-extrabold text-sm text-slate-900">Sektörel İhale Dağılımı</h3>
{pieData.length === 0 ? (
<div className="h-48 flex items-center justify-center text-center border-2 border-dashed border-slate-200 rounded-xl">
<p className="text-xs text-slate-400 max-w-[180px]">Sektör dağılımı, ihale verisi yüklendikçe hesaplanır.</p>
</div>
) : (
<>
<div className="h-48 w-full">
<ResponsiveContainer width="100%" height="100%">
<PieChart>
<Pie data={pieData} dataKey="value" nameKey="name" cx="50%" cy="50%" innerRadius={40} outerRadius={70} paddingAngle={4}>
{pieData.map((entry, index) => (
<Cell key={`cell-${index}`} fill={entry.color} />
))}
</Pie>
<Tooltip formatter={(value) => [`${value} ihale`, 'Adet']} />
</PieChart>
</ResponsiveContainer>
</div>
))}
</div>
<div className="space-y-1.5 pt-2">
{pieData.map((item) => (
<div key={item.name} className="flex justify-between items-center text-xs font-semibold">
<span className="flex items-center gap-2 min-w-0">
<span className="w-2.5 h-2.5 rounded-full shrink-0" style={{ backgroundColor: item.color }}></span>
<span className="truncate">{item.name}</span>
</span>
<span className="font-bold text-slate-900 shrink-0">%{pieToplam ? Math.round((item.value / pieToplam) * 100) : 0}</span>
</div>
))}
</div>
</>
)}
</div>
</div>
+53 -40
View File
@@ -1,17 +1,20 @@
import React, { useState } from 'react';
import { COMPETITOR_DATA } from '../../data/mockTenders';
import { FileCheck2, Search, Building2, TrendingUp, Award, Shield } from 'lucide-react';
import { useApp } from '../../context/AppContext';
import { firmStats, formatTL } from '../../services/analytics';
import { FileCheck2, Search, Award } from 'lucide-react';
export const ContractSearch = () => {
const { tenders } = useApp();
const [searchTerm, setSearchTerm] = useState('');
const filteredCompetitors = COMPETITOR_DATA.filter(c =>
c.name.toLowerCase().includes(searchTerm.toLowerCase())
const { firms } = firmStats(tenders);
const filtered = firms.filter((c) =>
c.name.toLocaleLowerCase('tr-TR').includes(searchTerm.toLocaleLowerCase('tr-TR'))
);
return (
<div className="space-y-4 my-4 animate-fade-in">
<div className="bg-white rounded-xl border border-slate-200 p-5 shadow-xs flex flex-col md:flex-row items-center justify-between gap-4">
<div className="flex items-center gap-3">
<div className="w-10 h-10 rounded-xl bg-indigo-600 text-white flex items-center justify-center shadow-md">
@@ -19,7 +22,7 @@ export const ContractSearch = () => {
</div>
<div>
<h1 className="text-xl font-black text-slate-900">Sözleşme Bedeli & Rakip Analizi</h1>
<p className="text-xs text-slate-500">Rakip firmaların kamu ihalelerinden aldığı toplam iş hacmini ve sözleşme bedellerini sorgulayın.</p>
<p className="text-xs text-slate-500">Kazanan firmaların sözleşme hacmini ve pazar payını canlı veriden sorgulayın.</p>
</div>
</div>
@@ -35,43 +38,53 @@ export const ContractSearch = () => {
</div>
</div>
{/* Competitor Cards */}
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
{filteredCompetitors.map((comp, idx) => (
<div key={idx} className="bg-white rounded-xl border border-slate-200 p-5 shadow-xs hover:shadow-md transition-all space-y-4">
<div className="flex items-start justify-between border-b border-slate-100 pb-3">
{filtered.length === 0 ? (
<div className="bg-white rounded-xl border border-dashed border-slate-300 p-10 text-center">
<Award className="w-8 h-8 text-slate-300 mx-auto mb-3" />
<p className="text-sm font-bold text-slate-500">Henüz kazanan firma verisi yok</p>
<p className="text-xs text-slate-400 mt-1 max-w-md mx-auto leading-relaxed">
Kazanan firma ve sözleşme bedeli verisi, doğrudan temin sonuçları ve EKAP sonuç ilanları
biriktikçe otomatik olarak burada listelenir.
</p>
</div>
) : (
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
{filtered.map((comp, idx) => (
<div key={idx} className="bg-white rounded-xl border border-slate-200 p-5 shadow-xs hover:shadow-md transition-all space-y-4">
<div className="flex items-start justify-between border-b border-slate-100 pb-3">
<div>
<span className="text-[10px] font-extrabold bg-indigo-100 text-indigo-800 px-2 py-0.5 rounded">
Sıra #{idx + 1}
</span>
<h3 className="font-extrabold text-base text-slate-900 mt-1">{comp.name}</h3>
</div>
<Award className="w-6 h-6 text-indigo-600 shrink-0" />
</div>
<div className="grid grid-cols-2 gap-3 text-xs">
<div className="bg-slate-50 p-3 rounded-lg border border-slate-200">
<span className="text-slate-400 block font-medium">Toplam Sözleşme</span>
<span className="text-sm font-black text-indigo-900 mt-0.5 block">{formatTL(comp.total)}</span>
</div>
<div className="bg-slate-50 p-3 rounded-lg border border-slate-200">
<span className="text-slate-400 block font-medium">Kazandığı İhale</span>
<span className="text-sm font-black text-emerald-700 mt-0.5 block">{comp.wins} İhale</span>
</div>
</div>
<div>
<span className="text-[10px] font-extrabold bg-indigo-100 text-indigo-800 px-2 py-0.5 rounded">
Sektör Sırası #{idx + 1}
</span>
<h3 className="font-extrabold text-base text-slate-900 mt-1">{comp.name}</h3>
</div>
<Award className="w-6 h-6 text-indigo-600 shrink-0" />
</div>
<div className="grid grid-cols-2 gap-3 text-xs">
<div className="bg-slate-50 p-3 rounded-lg border border-slate-200">
<span className="text-slate-400 block font-medium">Toplam İş Hacmi</span>
<span className="text-sm font-black text-indigo-900 mt-0.5 block">{comp.totalVolume}</span>
</div>
<div className="bg-slate-50 p-3 rounded-lg border border-slate-200">
<span className="text-slate-400 block font-medium">Kazandığı İhale</span>
<span className="text-sm font-black text-emerald-700 mt-0.5 block">{comp.winCount} Adet İhale</span>
<div className="flex justify-between text-xs font-semibold text-slate-700 mb-1">
<span>Pazar Payı (hacim)</span>
<span className="font-bold text-indigo-700">%{comp.share}</span>
</div>
<div className="w-full bg-slate-100 rounded-full h-2 overflow-hidden">
<div className="bg-indigo-600 h-2 rounded-full" style={{ width: `${Math.max(comp.share, 2)}%` }}></div>
</div>
</div>
</div>
<div>
<div className="flex justify-between text-xs font-semibold text-slate-700 mb-1">
<span>Tahmini Pazar Payı</span>
<span className="font-bold text-indigo-700">%{comp.share}</span>
</div>
<div className="w-full bg-slate-100 rounded-full h-2 overflow-hidden">
<div className="bg-indigo-600 h-2 rounded-full" style={{ width: `${comp.share}%` }}></div>
</div>
</div>
</div>
))}
</div>
))}
</div>
)}
</div>
);
+82 -3
View File
@@ -1,14 +1,50 @@
import React, { useState } from 'react';
import React, { useState, useEffect } from 'react';
import { useApp } from '../../context/AppContext';
import { Smartphone, Wifi, WifiOff, Download, Bell, CheckCircle2, ShieldCheck, Zap, Sparkles, Moon } from 'lucide-react';
import { Smartphone, Wifi, WifiOff, Download, Bell, CheckCircle2, Moon, Mail, Send } from 'lucide-react';
import confetti from 'canvas-confetti';
import { getToken } from '../../services/auth';
export const PwaSettings = () => {
const { userProfile, reminderSettings, setReminderSettings, requestPushPermission, notify, isQuietNow } = useApp();
const { userProfile, authUser, tenders, reminderSettings, setReminderSettings, requestPushPermission, notify, isQuietNow } = useApp();
const [offlineMode, setOfflineMode] = useState(true);
const [installed, setInstalled] = useState(false);
const [permission, setPermission] = useState(typeof Notification !== 'undefined' ? Notification.permission : 'unsupported');
// E-posta (Resend) durumu + test gönderimi
const [emailCfg, setEmailCfg] = useState(null); // null=bilinmiyor, true/false
const [emailSending, setEmailSending] = useState(false);
const [emailResult, setEmailResult] = useState(null);
useEffect(() => {
fetch('/api/notify/email/config')
.then((r) => r.json())
.then((d) => setEmailCfg(Boolean(d.configured)))
.catch(() => setEmailCfg(false));
}, []);
const sendTestEmail = async () => {
setEmailSending(true);
setEmailResult(null);
try {
const yeniler = tenders.filter((t) => t.isYeni).slice(0, 15);
const res = await fetch('/api/notify/email/test', {
method: 'POST',
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${getToken()}` },
body: JSON.stringify({ subject: 'İhaleist — bildirim testi', tenders: yeniler }),
});
const data = await res.json();
if (data.success) {
setEmailResult({ ok: true, msg: `E-posta gönderildi → ${data.to}` });
notify('E-posta gönderildi', `Test e-postası ${data.to} adresine iletildi.`);
} else {
setEmailResult({ ok: false, msg: data.error || 'Gönderilemedi' });
}
} catch (e) {
setEmailResult({ ok: false, msg: e.message });
} finally {
setEmailSending(false);
}
};
const handleEnablePush = async () => {
const p = await requestPushPermission();
setPermission(p);
@@ -134,6 +170,49 @@ export const PwaSettings = () => {
</div>
</div>
{/* E-posta Bildirimi (Resend) — gerçek gönderim */}
<div className="bg-white p-6 rounded-2xl border border-slate-200 shadow-xs space-y-4">
<div className="flex items-center justify-between border-b border-slate-100 pb-3">
<h3 className="font-extrabold text-sm text-slate-900 flex items-center gap-2">
<Mail className="w-4 h-4 text-blue-500" /> E-posta Bildirimi
</h3>
<span className={`font-extrabold text-[10px] px-2 py-0.5 rounded-full ${
emailCfg === true ? 'bg-emerald-100 text-emerald-800' : emailCfg === false ? 'bg-amber-100 text-amber-800' : 'bg-slate-100 text-slate-600'
}`}>
{emailCfg === true ? 'Aktif (Resend)' : emailCfg === false ? 'Yapılandırılmadı' : 'Kontrol ediliyor…'}
</span>
</div>
<p className="text-xs text-slate-600 leading-relaxed">
{emailCfg === false
? 'E-posta göndermek için sunucuya RESEND_API_KEY ekleyin (Coolify → Environment). Ayrıca gönderen domainini Resend’de DNS ile doğrulayın.'
: 'Takip kriterlerinize uyan ihaleler, hesabınızın e-posta adresine özet olarak gönderilir. Aşağıdan kendinize test gönderebilirsiniz.'}
</p>
<label className="flex items-center justify-between text-xs font-bold text-slate-800 cursor-pointer">
<span>E-posta bildirimleri açık</span>
<input type="checkbox" checked={reminderSettings.emailEnabled}
onChange={(e) => setReminderSettings((s) => ({ ...s, emailEnabled: e.target.checked }))}
className="w-4 h-4 accent-blue-600 rounded" />
</label>
<button
onClick={sendTestEmail}
disabled={emailSending || emailCfg !== true || !authUser}
className="w-full bg-blue-600 hover:bg-blue-500 disabled:opacity-40 text-white font-bold text-xs py-2.5 rounded-xl flex items-center justify-center gap-2"
title={!authUser ? 'Giriş yapın' : emailCfg !== true ? 'RESEND_API_KEY gerekli' : 'Kendinize test e-postası gönder'}
>
<Send className="w-3.5 h-3.5" />
{emailSending ? 'Gönderiliyor…' : 'Kendime Test E-postası Gönder'}
</button>
{emailResult && (
<p className={`text-[11px] ${emailResult.ok ? 'text-emerald-600' : 'text-red-600'}`}>
{emailResult.ok ? '✓ ' : '⚠ '}{emailResult.msg}
</p>
)}
</div>
{/* Install PWA Application */}
<div className="bg-linear-to-br from-slate-900 to-cyan-950 text-white p-6 rounded-2xl shadow-xs space-y-4 border border-cyan-800/40">
<div className="flex items-center justify-between">