import React, { useState } from 'react'; import { useApp } from '../../context/AppContext'; import { Smartphone, Wifi, WifiOff, Download, Bell, CheckCircle2, ShieldCheck, Zap, Sparkles, Moon } from 'lucide-react'; import confetti from 'canvas-confetti'; export const PwaSettings = () => { const { userProfile, 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'); const handleEnablePush = async () => { const p = await requestPushPermission(); setPermission(p); if (p === 'granted') { setReminderSettings((s) => ({ ...s, pushEnabled: true })); notify('Bildirimler açıldı', 'Yeni ihale ve son tarih uyarıları buradan gelecek.'); confetti({ particleCount: 50 }); } }; const setQuiet = (patch) => setReminderSettings((s) => ({ ...s, ...patch })); const handleInstallPwa = () => { setInstalled(true); confetti({ particleCount: 70 }); }; return (
{/* Header Banner */}

Mobil PWA & Saha Ekibi Offline Modu

Saha satış temsilcileriniz için internet bağlantısı olmadığında dahi çevrimdışı çalışma ve anlık push bildirimi.

{/* Main Controls Grid */}
{/* Offline Cache Status */}

{offlineMode ? : } Çevrimdışı (Offline) Önbellek

Senkronize

İhale Kayıtları: 102 İhale Önbellekte

Şartname PDF'leri: 18 Belge Çevrimdışı

Son Senkronizasyon: Bugün 14:45

{/* Gerçek Tarayıcı Bildirimleri + Sessiz Saatler */}

Anlık Bildirimler

{permission === 'granted' ? 'İzin Verildi' : permission === 'denied' ? 'Reddedildi' : permission === 'unsupported' ? 'Desteklenmiyor' : 'İzin Bekliyor'}

Tarayıcı bildirimlerine izin verin; yeni ihale ve son tarih uyarıları gerçek bildirim olarak gelir.

{permission !== 'granted' ? ( ) : ( )} {/* Sessiz saatler — gerçek */}
{reminderSettings.quietEnabled && (
setQuiet({ quietStart: e.target.value })} className="bg-slate-50 border border-slate-300 rounded-lg px-2 py-1.5 flex-1" /> → setQuiet({ quietEnd: e.target.value })} className="bg-slate-50 border border-slate-300 rounded-lg px-2 py-1.5 flex-1" />
)} {reminderSettings.quietEnabled && (

{isQuietNow() ? '🔕 Şu an sessiz saatte — tarayıcı bildirimi gösterilmez, uyarılar listeye eklenir.' : '🔔 Şu an aktif — bildirimler gösterilir.'}

)}
{/* Install PWA Application */}

İhaleist Mobil / Masaüstü

PWA 2.0

İhaleist'i iOS, Android, Windows veya Mac cihazınıza bir tıklama ile uygulama olarak kurun.

); };