import React, { useState, useEffect } from 'react'; import { Accessibility, ArrowLeft } from 'lucide-react'; import { Link } from 'react-router-dom'; import { pageContentService } from '../services/api'; import type { PageContent } from '../services/api/pageContentService'; import { useCompanySettings } from '../contexts/CompanySettingsContext'; import Loading from '../components/common/Loading'; const AccessibilityPage: React.FC = () => { const { settings } = useCompanySettings(); const [pageContent, setPageContent] = useState(null); const [loading, setLoading] = useState(true); useEffect(() => { const fetchPageContent = async () => { try { setLoading(true); const response = await pageContentService.getAccessibilityContent(); if (response.status === 'success' && response.data?.page_content) { const content = response.data.page_content; if (content.content) { const tempDiv = document.createElement('div'); tempDiv.innerHTML = content.content; const allElements = tempDiv.querySelectorAll('*'); allElements.forEach((el) => { const htmlEl = el as HTMLElement; const tagName = htmlEl.tagName.toLowerCase(); const currentColor = htmlEl.style.color; if (!currentColor || currentColor === 'black' || currentColor === '#000' || currentColor === '#000000') { if (['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(tagName)) { htmlEl.style.color = '#ffffff'; } else if (['strong', 'b'].includes(tagName)) { htmlEl.style.color = '#d4af37'; } else if (tagName === 'a') { htmlEl.style.color = '#d4af37'; } else { htmlEl.style.color = '#d1d5db'; } } }); content.content = tempDiv.innerHTML; } setPageContent(content); if (content.meta_title) { document.title = content.meta_title; } if (content.meta_description) { let metaDescription = document.querySelector('meta[name="description"]'); if (!metaDescription) { metaDescription = document.createElement('meta'); metaDescription.setAttribute('name', 'description'); document.head.appendChild(metaDescription); } metaDescription.setAttribute('content', content.meta_description); } } } catch (err: any) { console.error('Error fetching page content:', err); // If page is disabled (404), set pageContent to null to show disabled message if (err.response?.status === 404) { setPageContent(null); } } finally { setLoading(false); } }; fetchPageContent(); }, []); if (loading) { return ; } if (!pageContent) { return (

Accessibility

This page is currently unavailable.

Back to Home
); } return (
Back to Home

{pageContent.title || 'Accessibility'}

{pageContent.subtitle && (

{pageContent.subtitle}

)}
No content available.

' }} />
{settings.company_email && (

For accessibility inquiries, contact us at{' '} {settings.company_email}

)}
); }; export default AccessibilityPage;