/** * BoostMedia AI Content Generator Admin - SetupBanner Component * * Inline card banner shown at the top of setup pages during onboarding. * * @package BoostMedia_AI * @license GPL-2.0-or-later */ import { useState } from 'react' import { useNavigate } from 'react-router-dom' import { useOnboarding } from '../../hooks/useOnboarding' import { t } from '../../lib/i18n' import type { OnboardingState } from '../../types' interface SetupBannerProps { stepKey: keyof OnboardingState icon: string title: string description: string ctaLabel?: string ctaAction?: string | (() => void) nextLabel?: string nextPath?: string } export function SetupBanner({ stepKey, icon, title, description, ctaLabel, ctaAction, nextLabel, nextPath, }: SetupBannerProps) { const { state, markSeen } = useOnboarding() const navigate = useNavigate() const [dismissed, setDismissed] = useState(false) if (state[stepKey] === true || dismissed) return null const handleDismiss = () => { setDismissed(true) markSeen(stepKey) } const handleCta = () => { if (typeof ctaAction === 'function') { ctaAction() } else if (typeof ctaAction === 'string') { navigate(ctaAction) } } const handleNext = () => { if (nextPath) { handleDismiss() navigate(nextPath) } } return (
{icon}

{title}

{description}

{ctaLabel && ctaAction && ( )} {nextLabel && nextPath && ( )}
) }