'use client' import { ChevronDown, Globe } from 'lucide-react' import Image from 'next/image' import Link from 'next/link' import { useEffect, useRef, useState } from 'react' import { type DashboardLanguage, useDashboardI18n, } from '@/components/I18nProvider' import { marketplaceUrl } from '@/lib/urls' const DASHBOARD_LOGO_SRC = '/dashboard/rentalcardrive.png' type FooterItem = { label: string href?: string } const localeOptions: Array<{ value: DashboardLanguage; label: string }> = [ { value: 'en', label: 'Global (English)' }, { value: 'ar', label: 'NorthAfrica (Arabic)' }, { value: 'fr', label: 'Europ (French)' }, ] function getFooterContent(language: DashboardLanguage): { primary: FooterItem[] secondary: FooterItem[] localeLabel: string rightsLabel: string } { switch (language) { case 'fr': return { primary: [ { label: 'À propos de nous', href: `${marketplaceUrl}/footer/about-us` }, { label: 'Conditions d’utilisation', href: `${marketplaceUrl}/footer/terms-of-service` }, { label: 'Sécurité', href: `${marketplaceUrl}/footer/security` }, { label: 'Conformité', href: `${marketplaceUrl}/footer/compliance` }, { label: 'Politique de confidentialité', href: `${marketplaceUrl}/footer/privacy-policy` }, { label: 'Politique relative aux cookies', href: `${marketplaceUrl}/footer/cookie-policy` }, ], secondary: [ { label: 'Newsletter', href: `${marketplaceUrl}/footer/newsletter` }, { label: 'Contacter les ventes', href: `${marketplaceUrl}/footer/contact-sales` }, { label: 'Nos bureaux', href: `${marketplaceUrl}/footer/our-offices` }, ], localeLabel: 'Europ (French)', rightsLabel: 'Tous droits réservés.', } case 'ar': return { primary: [ { label: 'من نحن', href: `${marketplaceUrl}/footer/about-us` }, { label: 'شروط الاستخدام', href: `${marketplaceUrl}/footer/terms-of-service` }, { label: 'الأمان', href: `${marketplaceUrl}/footer/security` }, { label: 'الامتثال', href: `${marketplaceUrl}/footer/compliance` }, { label: 'سياسة الخصوصية', href: `${marketplaceUrl}/footer/privacy-policy` }, { label: 'سياسة ملفات تعريف الارتباط', href: `${marketplaceUrl}/footer/cookie-policy` }, ], secondary: [ { label: 'النشرة الإخبارية', href: `${marketplaceUrl}/footer/newsletter` }, { label: 'تواصل مع المبيعات', href: `${marketplaceUrl}/footer/contact-sales` }, { label: 'مكاتبنا', href: `${marketplaceUrl}/footer/our-offices` }, ], localeLabel: 'NorthAfrica (Arabic)', rightsLabel: 'جميع الحقوق محفوظة.', } case 'en': default: return { primary: [ { label: 'About Us', href: `${marketplaceUrl}/footer/about-us` }, { label: 'Terms of Service', href: `${marketplaceUrl}/footer/terms-of-service` }, { label: 'Security', href: `${marketplaceUrl}/footer/security` }, { label: 'Compliance', href: `${marketplaceUrl}/footer/compliance` }, { label: 'Privacy Policy', href: `${marketplaceUrl}/footer/privacy-policy` }, { label: 'Cookie Policy', href: `${marketplaceUrl}/footer/cookie-policy` }, ], secondary: [ { label: 'Newsletter', href: `${marketplaceUrl}/footer/newsletter` }, { label: 'Contact Sales', href: `${marketplaceUrl}/footer/contact-sales` }, { label: 'Our Offices', href: `${marketplaceUrl}/footer/our-offices` }, ], localeLabel: 'Global (English)', rightsLabel: 'All rights reserved.', } } } export default function PublicShell({ children }: { children: React.ReactNode }) { const { language, setLanguage, theme, setTheme } = useDashboardI18n() const localeMenuRef = useRef(null) const [localeMenuOpen, setLocaleMenuOpen] = useState(false) const dict = { en: { home: 'Home', marketplace: 'Marketplace', signIn: 'Sign in', createAccount: 'Create account', preferences: 'Workspace preferences', theme: 'Theme', light: 'Light', medium: 'Medium', dark: 'Dark', }, fr: { home: 'Accueil', marketplace: 'Marketplace', signIn: 'Connexion', createAccount: 'Créer un compte', preferences: 'Preferences espace', theme: 'Mode', light: 'Clair', medium: 'Moyen', dark: 'Sombre', }, ar: { home: 'الرئيسية', marketplace: 'السوق', signIn: 'تسجيل الدخول', createAccount: 'إنشاء حساب', preferences: 'تفضيلات المساحة', theme: 'الوضع', light: 'فاتح', medium: 'متوسط', dark: 'داكن', }, }[language] const footerContent = getFooterContent(language) const availableLocaleOptions = localeOptions.filter((option) => option.value !== language) useEffect(() => { function handlePointerDown(event: MouseEvent) { if (!localeMenuRef.current?.contains(event.target as Node)) { setLocaleMenuOpen(false) } } document.addEventListener('mousedown', handlePointerDown) return () => document.removeEventListener('mousedown', handlePointerDown) }, []) return (
RentalDriveGo RentalDriveGo
{dict.theme} {(['light', 'medium', 'dark'] as const).map((value) => { const active = value === theme return ( ) })}
{children}
{footerContent.secondary.map((item) => (
))}
{localeMenuOpen ? (
{availableLocaleOptions.map((option) => ( ))}
) : null}

© {new Date().getFullYear()} RentalDriveGo. {footerContent.rightsLabel}

) } function FooterNavItem({ item }: { item: FooterItem }) { const className = 'px-3 text-stone-600 transition hover:text-stone-950 dark:text-stone-300 dark:hover:text-white' if (item.href) { return ( {item.label} ) } return {item.label} }