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'}

+
); @@ -47,10 +71,26 @@ export const PublicStatusPage = () => { if (error || !page) { return (
-
-

Page Not Found

-

{error || 'The requested status page could not be found.'}

- +
+
+ +
+
+

Status Page Not Found

+

+ {error || 'The requested status page could not be found or is not publicly accessible.'} +

+

Slug: {slug || 'No slug provided'}

+
+
+ + +
); @@ -62,7 +102,7 @@ export const PublicStatusPage = () => { {/* Main Content */} -
+
{/* Current Status */} @@ -78,7 +118,7 @@ export const PublicStatusPage = () => { {/* Footer */} -
+ {/* Custom CSS */} {page.custom_css && ( diff --git a/application/src/components/public/StatusPageHeader.tsx b/application/src/components/public/StatusPageHeader.tsx index ad2c041..76d758c 100644 --- a/application/src/components/public/StatusPageHeader.tsx +++ b/application/src/components/public/StatusPageHeader.tsx @@ -1,6 +1,7 @@ -import { StatusBadge } from '@/components/operational-page/StatusBadge'; import { OperationalPageRecord } from '@/types/operational.types'; +import { Shield, Globe, ExternalLink } from 'lucide-react'; +import { Button } from '@/components/ui/button'; interface StatusPageHeaderProps { page: OperationalPageRecord; @@ -8,23 +9,63 @@ interface StatusPageHeaderProps { export const StatusPageHeader = ({ page }: StatusPageHeaderProps) => { return ( -
-
+
+
- {page.logo_url && ( - Logo + {page.logo_url ? ( + {`${page.title} + ) : ( +
+ +
)}
-

{page.title}

-

- {page.description} -

+

{page.title}

+

{page.description}

- + +
+ {page.custom_domain && ( + + )} + +
+
+
+ Live Status +
+
+ Auto-updated every 30s +
+
+
+
+ + {/* Breadcrumb */} +
+ + Status Page + + {page.title}
-
+ ); }; \ No newline at end of file