'use client' import { useTranslation } from '../i18n/useTranslation'; import { Fragment } from 'react' import { Dialog, Transition } from '@headlessui/react' import { XMarkIcon, EnvelopeIcon, IdentificationIcon, UserIcon, DocumentTextIcon, ClockIcon, ArrowRightIcon, CheckCircleIcon, HandRaisedIcon, HeartIcon, CheckIcon } from '@heroicons/react/24/outline' interface TutorialStep { id: number title: string description: string details: string[] icon: React.ComponentType> buttonText: string buttonAction: () => void canProceed: boolean } interface TutorialModalProps { isOpen: boolean onClose: () => void currentStep: number steps: TutorialStep[] onNext: () => void onPrevious: () => void } export default function TutorialModal({ isOpen, onClose, currentStep, steps, onNext, onPrevious }: TutorialModalProps) { const { t } = useTranslation(); const step = steps[currentStep - 1] if (!step) return null const isLastStep = currentStep === steps.length const isFirstStep = currentStep === 1 // Helper function to check if step is completed const isStepCompleted = (stepId: number) => { if (stepId === 2) return step.buttonText.includes("✅") // Email verified if (stepId === 3) return step.buttonText.includes("✅") // ID uploaded if (stepId === 4) return step.buttonText.includes("✅") // Profile completed if (stepId === 5) return step.buttonText.includes("✅") // Agreement signed return false } // Get clean button text without emoji const getCleanButtonText = (text: string) => { return text.replace(/✅/g, '').trim().replace(/!$/, '') } const stepCompleted = isStepCompleted(step.id) const buttonText = stepCompleted ? getCleanButtonText(step.buttonText) : step.buttonText return (
{/* CHANGED: mobile uses max-height + scrolling */}
{/* Background Gradient */} {/* Close Button */} {/* CHANGED: content scrolls on mobile */}
{/* Icon */}
{/* CHANGED: allow wrapping on mobile (remove nowrap) */}

{step.title}

{/* CHANGED: no fixed height clipping on mobile */}

{step.description}

{/* Details */}
    {step.details.map((detail, index) => (
  • {detail}
  • ))}
{/* Progress indicator */}
Step {currentStep} of {steps.length} {Math.round((currentStep / steps.length) * 100)}% Complete
{/* Action Buttons */}
{/* Navigation Buttons */} {(!isFirstStep || !isLastStep) && (
{!isLastStep && ( )}
)}
{/* CHANGED: hide unused visual section on mobile */}
{/* {t('autofix.kcc1c5596')} */}
) } // Tutorial step data export const createTutorialSteps = ( emailVerified: boolean, idUploaded: boolean, additionalInfo: boolean, contractSigned: boolean, userType: string, onVerifyEmail: () => void, onUploadId: () => void, onCompleteInfo: () => void, onSignContract: () => void, onCloseTutorial: () => void, onNext: () => void ): TutorialStep[] => [ { id: 1, title: "Hello there! 👋 Welcome to Profit Planet", description: "We're so happy you've decided to join us! This quick tutorial will guide you through setting up your account in just a few simple steps. Let's make this journey together - it'll only take a few minutes!", details: [ "We'll walk you through each step personally", "Everything is designed to be simple and clear", "You can skip steps if you want to come back later", "Our team is here to help if you need anything" ], icon: HandRaisedIcon, buttonText: "Let's get started! 🚀", buttonAction: onNext, canProceed: true }, { id: 2, title: "Let's verify your email address 📧", description: "First things first - we'd love to make sure we can reach you! Please check your email inbox for a friendly message from us and the verification code.", details: [ "Check your email inbox for our welcome message", "Copy & paste the verification code into the field", "Don't see it? Check your spam folder - sometimes it hides there", "Need a new email? Just click below and we'll send another" ], icon: EnvelopeIcon, buttonText: emailVerified ? "Email verified! ✅" : "Verify my email", buttonAction: emailVerified ? onNext : onVerifyEmail, canProceed: true }, { id: 3, title: "Time to upload your ID 📋", description: "Now we need to get to know you better! Please upload a clear photo of your official ID. Don't worry - this information is completely secure and helps us keep everyone safe.", details: [ "Take a clear, well-lit photo of your ID document", "Make sure all text is easily readable", "Passport, driver's license, or national ID all work perfectly", "We protect your privacy - this is just for verification" ], icon: IdentificationIcon, buttonText: idUploaded ? "ID uploaded! ✅" : "Upload my ID", buttonAction: idUploaded ? onNext : onUploadId, canProceed: true }, { id: 4, title: "Complete your profile 👤", description: `Almost there! Now let's fill out your ${userType === 'personal' ? 'personal' : 'company'} profile. This helps us customize your experience and ensure everything runs smoothly.`, details: userType === 'personal' ? [ "Share your full name and date of birth with us", "Add your current address (we keep this private)", "Include a phone number so we can reach you if needed", "All information is required for account security" ] : [ "Tell us about your company and business details", "Add your business address and contact information", "Upload any business documents we might need", "Make sure everything matches your official records" ], icon: UserIcon, buttonText: additionalInfo ? "Profile completed! ✅" : "Complete my profile", buttonAction: additionalInfo ? onNext : onCompleteInfo, canProceed: true }, { id: 5, title: "Ready to sign your contract! 📝", description: "Perfect! You've completed all the preparation steps. Now it's time to review and sign your personalized contract to finalize your account setup.", details: [ "Review the terms and conditions carefully", "Your contract has been prepared based on your information", "Digital signature makes the process quick and secure", "This is the final step to activate your account" ], icon: DocumentTextIcon, buttonText: contractSigned ? "Contract signed! ✅" : "Review & sign contract", buttonAction: contractSigned ? onNext : onSignContract, canProceed: emailVerified && idUploaded && additionalInfo }, { id: 6, title: "You're all set! 🎉 Welcome to the family", description: "Congratulations! Our team will now review your information and have you approved very soon!", details: [ "Our team will carefully review everything you've submitted", "This usually takes just 1-2 business days", "We'll send you a celebratory email once you're approved", "In the meantime, feel free to explore your dashboard" ], icon: HeartIcon, buttonText: "Perfect! I understand 💫", buttonAction: onCloseTutorial, canProceed: true } ]