diff --git a/application/src/components/public/PublicStatusPage.tsx b/application/src/components/public/PublicStatusPage.tsx index 8cc686b..8f775f0 100644 --- a/application/src/components/public/PublicStatusPage.tsx +++ b/application/src/components/public/PublicStatusPage.tsx @@ -2,6 +2,7 @@ import { useState, useEffect } from 'react'; import { useParams } from 'react-router-dom'; import { Button } from '@/components/ui/button'; +import { RefreshCw, AlertCircle } from 'lucide-react'; import { usePublicStatusPageData } from './hooks/usePublicStatusPageData'; import { StatusPageHeader } from './StatusPageHeader'; import { CurrentStatusSection } from './CurrentStatusSection'; @@ -11,19 +12,36 @@ import { PublicStatusPageFooter } from './PublicStatusPageFooter'; export const PublicStatusPage = () => { const { slug } = useParams<{ slug: string }>(); + console.log('PublicStatusPage - slug from params:', slug); + const { page, components, services, uptimeData, loading, error } = usePublicStatusPageData(slug); + const [lastUpdated, setLastUpdated] = useState(new Date()); + + // Auto-refresh every 30 seconds + useEffect(() => { + const interval = setInterval(() => { + setLastUpdated(new Date()); + // The usePublicStatusPageData hook handles data refetching + }, 30000); + + return () => clearInterval(interval); + }, []); // Apply theme to document useEffect(() => { if (page) { const root = document.documentElement; + + // Remove any existing theme classes + root.classList.remove('dark', 'light'); + + // Apply the selected theme if (page.theme === 'dark') { root.classList.add('dark'); - root.classList.remove('light'); - } else { + } else if (page.theme === 'light') { root.classList.add('light'); - root.classList.remove('dark'); } + // For 'default' theme, don't add any class (uses system preference) } // Cleanup on unmount @@ -33,12 +51,18 @@ export const PublicStatusPage = () => { }; }, [page?.theme]); + console.log('PublicStatusPage state:', { loading, error, page: !!page, components: components.length, services: services.length }); + if (loading) { return (
Loading status page...
+Loading Status Page
+Fetching real-time system status...
+Slug: {slug || 'No slug provided'}
+{error || 'The requested status page could not be found.'}
- ++ {error || 'The requested status page could not be found or is not publicly accessible.'} +
+Slug: {slug || 'No slug provided'}
+- {page.description} -
+{page.description}