import React, { useState, useEffect, createContext, useContext } from 'react';
import { initializeApp } from 'firebase/app';
import { getAuth, signInAnonymously, onAuthStateChanged, signInWithCustomToken } from 'firebase/auth';
import { getFirestore, initializeFirestore } from 'firebase/firestore';
import {
Plane, Search, Instagram, MapPin,
ArrowRight, User, ShieldCheck, Moon, Sun, Globe,
MessageSquare, Loader2, Sparkles, X,
MoveRight, Layers, TrainFront, Hotel, Map as MapIcon,
Award, CheckCircle2, Twitter, Mail, Phone, Crown,
CreditCard, Landmark, RefreshCcw
} from 'lucide-react';
// Firebase Configuration
const firebaseConfig = JSON.parse(__firebase_config);
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);
const db = initializeFirestore(app, { experimentalForceLongPolling: true });
const apiKey = "";
const ThemeContext = createContext();
// --- 3D Background Logo Component (Smaller and more subtle) ---
const FloatingBackgroundLogo = () => {
return (
{/* Top Right Element - Scaled Down */}
{/* Bottom Left Element - Scaled Down */}
);
};
// --- Logo Component ---
const RahseparLogo = ({ className = "h-10" }) => (
);
// --- Translations Object ---
const translations = {
fa: {
home: "خانه", magazine: "مجله سفر", finance: "بانک و صرافی", destinations: "مقاصد",
login: "ورود", heroTitle1: "رهسپار", heroTitle2: "سفرهای هوشمند",
aiPlaceholder: "برنامه سفر رویایی خود را بنویسید (ویژه مشترکین VIP)...",
aiProcess: "پردازش هوشمند", flight: "پرواز", train: "قطار", hotel: "هتل", tour: "تور",
fromTo: "مبدا / مقصد", date: "تاریخ سفر", reserve: "رزرو و پرداخت",
paymentTitle: "انتخاب روش پرداخت", paymentDesc: "لطفاً بانک یا صرافی مورد نظر خود را برای تسویه حساب انتخاب کنید.",
footerDesc: "سامانه هوشمند و بینالمللی برنامهریزی سفر با تمرکز بر خدمات لوکس و اختصاصی.",
globalContact: "مرکز تماس جهانی (نیرمی)",
magTitle: "مجله تخصصی رهسپار",
magSubtitle: "تجربه، تخصص و اعتماد در دنیای گردشگری (EEAT)",
dir: "rtl"
},
en: {
home: "Home", magazine: "Magazine", finance: "Finance", destinations: "Destinations",
login: "Login", heroTitle1: "Rahsepar", heroTitle2: "Smart Travels",
aiPlaceholder: "Write your dream trip plan (VIP Only)...",
aiProcess: "AI Process", flight: "Flight", train: "Train", hotel: "Hotel", tour: "Tour",
fromTo: "Origin / Destination", date: "Travel Date", reserve: "Book & Pay",
paymentTitle: "Select Payment Method", paymentDesc: "Please select your preferred bank or exchange for settlement.",
footerDesc: "International smart travel planning system focusing on luxury services.",
globalContact: "Global Call Center (Nirami)",
magTitle: "Rahsepar Magazine",
magSubtitle: "Experience, Expertise, and Trust in Travel",
dir: "ltr"
}
};
const AppProvider = ({ children }) => {
const [isDark, setIsDark] = useState(false);
const [lang, setLang] = useState('fa');
const [isVip, setIsVip] = useState(true);
const toggleTheme = () => setIsDark(!isDark);
return (
{children}
);
};
const MainContent = () => {
const { isDark, toggleTheme, lang, setLang, isVip } = useContext(ThemeContext);
const t = translations[lang] || translations.fa;
const [scrolled, setScrolled] = useState(false);
const [activeTab, setActiveTab] = useState('flight');
const [showLangMenu, setShowLangMenu] = useState(false);
const [showPayment, setShowPayment] = useState(false);
const [searchPrompt, setSearchPrompt] = useState("");
const [aiRecommendation, setAiRecommendation] = useState("");
const [isSearching, setIsSearching] = useState(false);
useEffect(() => {
const handleScroll = () => setScrolled(window.scrollY > 50);
window.addEventListener('scroll', handleScroll, { passive: true });
return () => window.removeEventListener('scroll', handleScroll);
}, []);
const handleAiSearch = async (e) => {
e.preventDefault();
if (!searchPrompt.trim() || !isVip) return;
setIsSearching(true);
setAiRecommendation("");
try {
const result = await fetchGeminiText(`Recommend travel: "${searchPrompt}". Respond in ${lang}. Focus on luxury travel.`);
setAiRecommendation(result);
} catch (e) {
setAiRecommendation("خطا در برقراری ارتباط با هوش مصنوعی.");
} finally { setIsSearching(false); }
};
const fetchGeminiText = async (prompt) => {
const response = await fetch(`https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-preview-09-2025:generateContent?key=${apiKey}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ contents: [{ parts: [{ text: prompt }] }] })
});
const data = await response.json();
return data.candidates?.[0]?.content?.parts?.[0]?.text;
};
return (
{/* Navigation */}
{/* Hero Section */}
{t.heroTitle1}
{t.heroTitle2}
{/* AI Search */}
{isVip ? (
setSearchPrompt(e.target.value)}
placeholder={t.aiPlaceholder}
className="flex-1 bg-transparent border-none outline-none text-white text-base font-bold placeholder:text-white/40 px-4"
/>
) : (
دسترسی ویژه VIP
)}
{aiRecommendation &&
{aiRecommendation}
}
{/* Tabs */}
{[
{ id: 'flight', icon: Plane, label: t.flight },
{ id: 'train', icon: TrainFront, label: t.train },
{ id: 'hotel', icon: Hotel, label: t.hotel },
{ id: 'tour', icon: MapIcon, label: t.tour }
].map(tab => (
))}
{/* Search Box */}
{/* Magazine Section - Persianized */}
{t.magTitle}
{t.magSubtitle}
{[
{ title: "سفر با کشتی تفریحی در سواحل مدیترانه", author: "کاپیتان رابرتز", tag: "تخصص", img: "https://images.unsplash.com/photo-1544620347-c4fd4a3d5957?w=600&q=80" },
{ title: "قطارهای لوکس شرق؛ بازگشت به دوران طلایی", author: "تیم تحریریه", tag: "تجربه", img: "https://images.unsplash.com/photo-1474487548417-781cb71495f3?w=600&q=80" },
{ title: "جواهرات پنهان نئوم؛ آینده گردشگری عربستان", author: "واحد منطقهای", tag: "اعتبار", img: "https://images.unsplash.com/photo-1512453979798-5ea266f8880c?w=600&q=80" }
].map((p, i) => (
{p.tag}
{p.title}
{p.author}
))}
{/* Payment Modal */}
{showPayment && (
{t.paymentTitle}
{t.paymentDesc}
)}
{/* Footer */}
);
};
const App = () => (
);
export default App;