feat(ui): complete phase 4 Poyraz UI foundation

This commit is contained in:
poyrazavsever
2026-07-16 23:20:30 +03:00
parent 5d863280bf
commit 561af11b70
58 changed files with 2555 additions and 7806 deletions
+13 -18
View File
@@ -1,26 +1,21 @@
"use client";
import { useEffect, useState } from "react";
import { useSyncExternalStore } 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);
};
}, []);
const isOnline = useSyncExternalStore(
(onStoreChange) => {
window.addEventListener("online", onStoreChange);
window.addEventListener("offline", onStoreChange);
return () => {
window.removeEventListener("online", onStoreChange);
window.removeEventListener("offline", onStoreChange);
};
},
() => navigator.onLine,
() => true,
);
if (isOnline) return null;