124 lines
5.8 KiB
React
124 lines
5.8 KiB
React
import React from 'react';
|
||
import { AppProvider, useApp } from './context/AppContext';
|
||
import { KotaUyarisi } from './components/KotaUyarisi';
|
||
import { Header } from './components/Header';
|
||
import { LiveStatsBar } from './components/LiveStatsBar';
|
||
import { TopNavigation } from './components/TopNavigation';
|
||
import { SummaryCards } from './components/SummaryCards';
|
||
import { LeftSidebar } from './components/LeftSidebar';
|
||
import { TenderList } from './components/TenderList';
|
||
import { RightSidebar } from './components/RightSidebar';
|
||
import { DetailedSearchModal } from './components/DetailedSearchModal';
|
||
import { TenderDetailModal } from './components/TenderDetailModal';
|
||
import { CompanyScannerModal } from './components/CompanyScannerModal';
|
||
import { AiSpecAnalyzerModal } from './components/AiSpecAnalyzerModal';
|
||
import { UrunAramaModal } from './components/UrunAramaModal';
|
||
|
||
import { KullanimKilavuzu } from './components/KullanimKilavuzu';
|
||
import { MobilFiltreCekmecesi } from './components/MobilFiltreCekmecesi';
|
||
import { LoginPage } from './components/LoginPage';
|
||
import { LandingPage } from './components/LandingPage';
|
||
|
||
import { DeferredView } from './components/DeferredView';
|
||
|
||
const toolViews = {
|
||
smart_filter_builder: () => import('./components/SmartFilterBuilder').then(module => ({ default: module.SmartFilterBuilder })),
|
||
bulten: () => import('./components/tools/DailyBulletin').then(module => ({ default: module.DailyBulletin })),
|
||
sonuc: () => import('./components/tools/ResultSearch').then(module => ({ default: module.ResultSearch })),
|
||
takvim: () => import('./components/tools/TenderCalendar').then(module => ({ default: module.TenderCalendar })),
|
||
sozlesme: () => import('./components/tools/ContractSearch').then(module => ({ default: module.ContractSearch })),
|
||
kdv: () => import('./components/tools/VatCalculator').then(module => ({ default: module.VatCalculator })),
|
||
sinir: () => import('./components/tools/SinirDeger').then(module => ({ default: module.SinirDeger })),
|
||
fiyat: () => import('./components/tools/PriceAnalysis').then(module => ({ default: module.PriceAnalysis })),
|
||
kanban: () => import('./components/KanbanBoard').then(module => ({ default: module.KanbanBoard })),
|
||
rakip_radar: () => import('./components/tools/CompetitorRadar').then(module => ({ default: module.CompetitorRadar })),
|
||
dokuman_deposu: () => import('./components/tools/DocumentVault').then(module => ({ default: module.DocumentVault })),
|
||
analitik_dashboard: () => import('./components/tools/AnalyticsDashboard').then(module => ({ default: module.AnalyticsDashboard })),
|
||
kirmizi_bayrak: () => import('./components/tools/RedFlags').then(module => ({ default: module.RedFlags })),
|
||
ted_eu: () => import('./components/tools/TedTenders').then(module => ({ default: module.TedTenders })),
|
||
kik_kararlari: () => import('./components/tools/KikDecisions').then(module => ({ default: module.KikDecisions })),
|
||
planlar: () => import('./components/tools/Pricing').then(module => ({ default: module.Pricing })),
|
||
api_webhooks: () => import('./components/tools/ApiWebhooks').then(module => ({ default: module.ApiWebhooks })),
|
||
pwa_settings: () => import('./components/tools/PwaSettings').then(module => ({ default: module.PwaSettings })),
|
||
ai_ayarlari: () => import('./components/tools/AiModelSettings').then(module => ({ default: module.AiModelSettings })),
|
||
};
|
||
|
||
const MainContent = () => {
|
||
const { activeTab, isAdmin, saveError, savingCount } = useApp();
|
||
|
||
return (
|
||
<main className="w-full min-w-0 max-w-[1600px] mx-auto px-4 pb-12">
|
||
{/* 3-Column Main View */}
|
||
<KotaUyarisi />
|
||
{savingCount > 0 && <p role="status" className="p-3 bg-blue-50 text-blue-900">Kaydediliyor…</p>}
|
||
{saveError && <p role="alert" className="p-3 bg-red-50 text-red-900 border border-red-200 rounded-lg">{saveError} Değişiklik kaydedilmedi; tekrar deneyin.</p>}
|
||
|
||
{activeTab === 'list' && (
|
||
<>
|
||
<SummaryCards />
|
||
<MobilFiltreCekmecesi />
|
||
<div className="flex flex-col lg:flex-row gap-5 items-start">
|
||
{/* Masaüstünde sabit panel; mobilde çekmece (yukarıda) */}
|
||
<div className="hidden lg:block shrink-0"><LeftSidebar /></div>
|
||
<TenderList />
|
||
{/* Sağ panel küçük ekranda listeyi uzatıyordu */}
|
||
<div className="hidden xl:block shrink-0"><RightSidebar /></div>
|
||
</div>
|
||
</>
|
||
)}
|
||
|
||
{toolViews[activeTab] && (activeTab !== 'ai_ayarlari' || isAdmin) &&
|
||
<DeferredView key={activeTab} load={toolViews[activeTab]} />}
|
||
|
||
{/* Global Modals */}
|
||
<DetailedSearchModal />
|
||
<TenderDetailModal />
|
||
<CompanyScannerModal />
|
||
<AiSpecAnalyzerModal />
|
||
<UrunAramaModal />
|
||
<KullanimKilavuzu />
|
||
</main>
|
||
);
|
||
};
|
||
|
||
const Gate = () => {
|
||
const { authReady, isAuthenticated, handleLogin } = useApp();
|
||
const [showLogin, setShowLogin] = React.useState(() => window.location.hash === '#giris');
|
||
|
||
React.useEffect(() => {
|
||
const onHash = () => setShowLogin(window.location.hash === '#giris');
|
||
window.addEventListener('hashchange', onHash);
|
||
return () => window.removeEventListener('hashchange', onHash);
|
||
}, []);
|
||
|
||
if (!authReady) {
|
||
return (
|
||
<div className="min-h-screen bg-[#0f172a] flex items-center justify-center text-white/70">
|
||
Yükleniyor…
|
||
</div>
|
||
);
|
||
}
|
||
if (!isAuthenticated) {
|
||
if (!showLogin) {
|
||
return <LandingPage onGiris={() => { window.location.hash = '#giris'; setShowLogin(true); }} />;
|
||
}
|
||
return <LoginPage onLogin={handleLogin} />;
|
||
}
|
||
return (
|
||
<div className="min-h-screen bg-[#f3f5f8] text-slate-800 flex flex-col font-['Inter',sans-serif]">
|
||
<Header />
|
||
<LiveStatsBar />
|
||
<TopNavigation />
|
||
<MainContent />
|
||
</div>
|
||
);
|
||
};
|
||
|
||
export default function App() {
|
||
return (
|
||
<AppProvider>
|
||
<Gate />
|
||
</AppProvider>
|
||
);
|
||
}
|