import React, { useEffect } from 'react'; import Navbar from '@/src/components/Navbar.tsx'; import Sidebar from '@/src/components/Sidebar.tsx'; import Footer from '@/src/components/Footer.tsx'; import { CONTENT } from '../constants.ts'; import { useLanguage } from '@/src/contexts/LanguageContext.tsx'; import { useTheme } from '@/src/contexts/ThemeContext.tsx'; import { useLocation, Link } from 'react-router-dom'; import { ArrowRight, Anchor, Star, ChevronRight } from 'lucide-react'; const CruiseSpace: React.FC = () => { const { language } = useLanguage(); const { shipsPageImages } = useTheme(); // We explicitly type 'any' here or assume CONTENT structure is updated because // TS might not immediately pick up the new keys added to constants without a full types reload in this context. // In a real app, types.ts should be updated, but here we access the object properties. const t = CONTENT[language].shipsPage as any; const location = useLocation(); // Scroll to section on load or location change useEffect(() => { const SECTION_PREFIX = 'space-'; const SCROLL_DELAY = 300; // ms - delay to ensure DOM is fully rendered const params = new URLSearchParams(location.search); const section = params.get('section'); if (!section) { // Scroll to top when no section specified window.scrollTo({ top: 0, behavior: 'smooth' }); return; } // Construct element ID and scroll to target section const elementId = `${SECTION_PREFIX}${section}`; const element = document.getElementById(elementId); if (element) { // Delay to ensure DOM is fully rendered before scrolling const timeoutId = setTimeout(() => { element.scrollIntoView({ behavior: 'smooth', block: 'start' }); }, SCROLL_DELAY); // Cleanup timeout on unmount or search change return () => clearTimeout(timeoutId); } }, [location.search]); return (
{t.hero_desc}
{t.spaces.facilities.desc}
{item.desc}
{t.spaces.rooms.desc}
{room.desc}
{t.spaces.vip.desc}
{benefit}