import React, { useState, useCallback } from 'react'; import Joyride, { ACTIONS, EVENTS, STATUS } from 'react-joyride'; const TOUR_KEY = 'userTourCompleted'; const steps = [ { target: '#tour-welcome-card', title: 'Welcome to Emerald Prime πŸ‘‹', content: 'This is your personal support hub. From here you can track all your tickets and access AI-powered help.', placement: 'bottom', disableBeacon: true, }, { target: '#tour-report-btn', title: 'Report a New Issue', content: 'Click here to submit a new support ticket. Our AI will triage it instantlyβ€”most issues are resolved in minutes.', placement: 'bottom', disableBeacon: true, }, { target: '#tour-quick-actions', title: 'Quick Actions', content: 'Jump straight to the most common issue types. Each tile routes your problem to the right team automatically.', placement: 'top', disableBeacon: true, }, { target: '#tour-recent-tickets', title: 'Your Recent Tickets', content: 'Keep tabs on all your open and resolved tickets in real-time. Click any row to view the full conversation thread.', placement: 'top', disableBeacon: true, }, ]; // ─── Custom Tooltip ──────────────────────────────────────────────────────────── function EmeraldTooltip({ continuous, index, step, backProps, closeProps, primaryProps, skipProps, tooltipProps, size, }) { return (
{/* Step counter pill */}
Step {index + 1} of {size}
{/* Title */}

{step.title}

{/* Body */}

{step.content}

{/* Progress dots */}
{Array.from({ length: size }).map((_, i) => (
))}
{/* Actions */}
{index > 0 && ( )} {continuous ? ( ) : ( )}
); } // ─── Main Component ───────────────────────────────────────────────────────────── const UserTour = () => { const [run, setRun] = useState(() => { return localStorage.getItem(TOUR_KEY) !== 'true'; }); const handleCallback = useCallback((data) => { const { action, status, type } = data; const isFinished = status === STATUS.FINISHED; const isSkipped = status === STATUS.SKIPPED; const isClosed = action === ACTIONS.CLOSE && type === EVENTS.STEP_AFTER; if (isFinished || isSkipped || isClosed) { localStorage.setItem(TOUR_KEY, 'true'); setRun(false); } }, []); return ( ); }; export default UserTour;