import React, { useState, useEffect } from 'react'; import Joyride, { STATUS } from 'react-joyride'; const OnboardingTour = () => { const [run, setRun] = useState(false); useEffect(() => { const isComplete = localStorage.getItem('emerald_onboarding_complete'); if (!isComplete) { // Small delay to ensure DOM is ready const timer = setTimeout(() => { setRun(true); }, 1000); return () => clearTimeout(timer); } }, []); const steps = [ { target: '#tour-welcome', content: 'Welcome to Emerald Prime. Our AI resolves most issues instantly.', placement: 'bottom', disableBeacon: true, }, { target: '#tour-create-ticket', content: 'Click here to report a new issue. The AI will analyze it immediately.', placement: 'bottom', }, { target: '#tour-quick-actions', content: 'Use these shortcuts for common problems like network or software issues.', placement: 'top', }, { target: '#tour-recent-tickets', content: 'This is where you track the progress of your support requests.', placement: 'top', }, ]; const handleJoyrideCallback = (data) => { const { status } = data; const finishedStatuses = [STATUS.FINISHED, STATUS.SKIPPED]; if (finishedStatuses.includes(status)) { setRun(false); localStorage.setItem('emerald_onboarding_complete', 'true'); } }; return ( ); }; export default OnboardingTour;