feat: add PWA support with manifest configuration and offline connectivity indicator

This commit is contained in:
poyrazavsever
2026-06-06 21:53:06 +03:00
parent 83379a5edc
commit 4a52deec4d
6 changed files with 2221 additions and 1 deletions
+33
View File
@@ -0,0 +1,33 @@
"use client";
import { useEffect, useState } from "react";
import { WifiOff } from "lucide-react";
export function OfflineIndicator() {
const [isOnline, setIsOnline] = useState(true);
useEffect(() => {
// Sadece client-side'da çalışır
setIsOnline(navigator.onLine);
const handleOnline = () => setIsOnline(true);
const handleOffline = () => setIsOnline(false);
window.addEventListener("online", handleOnline);
window.addEventListener("offline", handleOffline);
return () => {
window.removeEventListener("online", handleOnline);
window.removeEventListener("offline", handleOffline);
};
}, []);
if (isOnline) return null;
return (
<div className="fixed bottom-4 right-4 z-50 flex items-center gap-2 rounded-lg bg-destructive px-4 py-2 text-sm font-medium text-destructive-foreground shadow-lg animate-in fade-in slide-in-from-bottom-4">
<WifiOff className="h-4 w-4" />
Çevrimdışı moddasınız. Değişiklikler senkronize edilmeyecek.
</div>
);
}