import { useEffect, useState } from 'react' import classNames from 'classnames' import { Helmet } from 'react-helmet' import { Button } from '@/components/ui' import { APP_NAME } from '@/constants/app.constant' import { ROUTES_ENUM } from '@/routes/route.constant' import { pollUntilServerReady } from '@/services/setup.service' import { useStoreState } from '@/store' /** * Uygulama konfigürasyonu alınamadığında gösterilir (tipik olarak veritabanı erişilemez * durumdayken). * * Kullanıcı bilinçli olarak kurulum sihirbazına yönlendirilmez — çalışan bir sistemde * geçici bir arıza kimseyi kurulum ekranına düşürmemeli. Bunun yerine durum açıkça * belirtilir, sunucu arka planda izlenir ve toparlandığı anda sayfa kendini yeniler. */ const ServiceUnavailable = () => { const isDark = useStoreState((state) => state.theme.mode) === 'dark' const [attempt, setAttempt] = useState(0) // Sunucu toparlandığında kullanıcının sayfayı elle yenilemesi gerekmesin. useEffect(() => { const cancel = pollUntilServerReady( () => window.location.reload(), (currentAttempt) => setAttempt(currentAttempt), ) return cancel }, []) return (
{/* Başlık */}
{`${APP_NAME} {APP_NAME} Offline
{/* Gövde */}
Service temporarily unavailable

The application configuration could not be loaded. The server is running, but it cannot reach its database right now. Your data is not affected — the application will come back automatically once the database is available again.

{attempt > 0 ? `Rechecking the connection… (attempt ${attempt})` : 'Waiting to recheck the connection…'}
{/* Aksiyonlar */}
Administrators can run a database migration from the setup page.
) } export default ServiceUnavailable