fix: Rakip Radar widget'ını gerçek firmStats'a bağla (son mock kaldırıldı)
RightSidebar teaser widget COMPETITOR_DATA mock yerine canlı firmStats(tenders) kullanıyor; veri yokken dürüst boş durum gösteriyor.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { useApp } from '../context/AppContext';
|
import { useApp } from '../context/AppContext';
|
||||||
import { MOCK_COMPANY_STATS, COMPETITOR_DATA } from '../data/mockTenders';
|
import { MOCK_COMPANY_STATS } from '../data/mockTenders';
|
||||||
|
import { firmStats } from '../services/analytics';
|
||||||
import { Briefcase, FileText, Calendar, History, Trophy, Eye, Kanban, Radar, ArrowRight, Users, Plus, Trash2 } from 'lucide-react';
|
import { Briefcase, FileText, Calendar, History, Trophy, Eye, Kanban, Radar, ArrowRight, Users, Plus, Trash2 } from 'lucide-react';
|
||||||
|
|
||||||
export const RightSidebar = () => {
|
export const RightSidebar = () => {
|
||||||
@@ -10,6 +11,7 @@ export const RightSidebar = () => {
|
|||||||
const [tmRole, setTmRole] = useState('Uzman');
|
const [tmRole, setTmRole] = useState('Uzman');
|
||||||
|
|
||||||
const trackedCount = tenders.filter(t => t.takipte).length;
|
const trackedCount = tenders.filter(t => t.takipte).length;
|
||||||
|
const topFirms = firmStats(tenders).firms.slice(0, 3);
|
||||||
|
|
||||||
const handleAddMember = (e) => {
|
const handleAddMember = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -91,20 +93,26 @@ export const RightSidebar = () => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="space-y-2.5 text-xs">
|
<div className="space-y-2.5 text-xs">
|
||||||
{COMPETITOR_DATA.slice(0, 3).map((comp, i) => (
|
{topFirms.length === 0 ? (
|
||||||
|
<p className="text-[11px] text-slate-400 py-2 leading-relaxed">
|
||||||
|
Kazanan firma verisi biriktikçe (doğrudan temin & sonuç ilanları) gerçek pazar payları burada listelenir.
|
||||||
|
</p>
|
||||||
|
) : (
|
||||||
|
topFirms.map((comp, i) => (
|
||||||
<div key={i} className="space-y-1">
|
<div key={i} className="space-y-1">
|
||||||
<div className="flex items-center justify-between text-[11px] font-semibold text-slate-700">
|
<div className="flex items-center justify-between text-[11px] font-semibold text-slate-700">
|
||||||
<span className="truncate max-w-[170px]">{comp.name}</span>
|
<span className="truncate max-w-[170px]">{comp.name}</span>
|
||||||
<span className="font-bold text-indigo-900">%{comp.share} ({comp.winCount} İhale)</span>
|
<span className="font-bold text-indigo-900">%{comp.share} ({comp.wins} İhale)</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="w-full bg-slate-100 rounded-full h-1.5 overflow-hidden">
|
<div className="w-full bg-slate-100 rounded-full h-1.5 overflow-hidden">
|
||||||
<div
|
<div
|
||||||
className="bg-indigo-600 h-1.5 rounded-full"
|
className="bg-indigo-600 h-1.5 rounded-full"
|
||||||
style={{ width: `${comp.share}%` }}
|
style={{ width: `${Math.max(comp.share, 3)}%` }}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
|||||||
Reference in New Issue
Block a user