'use client'; import { useState, useEffect } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { useRouter } from 'next/navigation'; import Link from 'next/link'; import { Home, Search, Rocket, ArrowLeft, ArrowRight } from 'lucide-react'; const STORAGE_KEY = 'sweethome_onboarding_completed'; const steps = [ { icon: Home, title: 'مرحباً بك في SweetHome', description: 'نحن هنا لمساعدتك في إيجاد العقار المثالي الذي تحلم به. اكتشف آلاف العقارات المتاحة للإيجار والبيع في جميع أنحاء سوريا.', gradient: 'from-amber-500 to-orange-600', }, { icon: Search, title: 'ابحث عن منزل أحلامك', description: 'استخدم محرك البحث الذكي لدينا للعثور على العقار المناسب. تصفح حسب الموقع، السعر، النوع، والمزيد من الفلاتر المتقدمة.', gradient: 'from-blue-500 to-indigo-600', }, { icon: Rocket, title: 'انطلق الآن', description: 'انشئ حسابك مجاناً وابدأ رحلة البحث عن منزلك الجديد. يمكنك حفظ العقارات المفضلة والتواصل مع المالكين مباشرة.', gradient: 'from-emerald-500 to-teal-600', }, ]; export default function OnboardingPage() { const router = useRouter(); const [currentStep, setCurrentStep] = useState(0); const [direction, setDirection] = useState(0); useEffect(() => { const completed = localStorage.getItem(STORAGE_KEY); if (completed === 'true') { router.replace('/'); } }, [router]); const goToStep = (index) => { setDirection(index > currentStep ? 1 : -1); setCurrentStep(index); }; const nextStep = () => { if (currentStep < steps.length - 1) { goToStep(currentStep + 1); } }; const prevStep = () => { if (currentStep > 0) { goToStep(currentStep - 1); } }; const handleFinish = () => { localStorage.setItem(STORAGE_KEY, 'true'); }; const step = steps[currentStep]; const isLastStep = currentStep === steps.length - 1; const isFirstStep = currentStep === 0; const IconComponent = step.icon; const slideVariants = { enter: (dir) => ({ x: dir > 0 ? 300 : -300, opacity: 0 }), center: { x: 0, opacity: 1 }, exit: (dir) => ({ x: dir > 0 ? -300 : 300, opacity: 0 }), }; return (
{[...Array(30)].map((_, i) => ( ))}
{step.title} {step.description}
{steps.map((_, index) => (
); }