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 (
{/* Hero Section */}
Ships Hero
{t.hero_sub}

{CONTENT[language].nav.menu[1].title}

{t.hero_desc}

{/* Section 1: Facilities */}

{t.spaces.facilities.title}

{t.spaces.facilities.desc}

{t.spaces.facilities.items.map((item: any, index: number) => (
{index + 1}

{item.title}

{item.desc}

))}
{/* Section 2: Room Types */}

{t.spaces.rooms.title}

{t.spaces.rooms.desc}

{t.spaces.rooms.types.map((room: any, index: number) => (
{room.name}
{room.area} {room.view}

{room.name}

{room.desc}

{room.area}
面积
{room.view}
景观
{t.view_itineraries}
))}
{/* Section 3: VIP Privileges */}
{/* Background */}
VIP

{t.spaces.vip.title}

{t.spaces.vip.desc}

{t.spaces.vip.benefits.map((benefit: string, index: number) => (

{benefit}

))}
{t.view_itineraries}
); }; export default CruiseSpace;