"use client"; import { motion, useReducedMotion } from "motion/react"; import type { CardComponentProps } from "onborda"; import { useOnborda } from "onborda"; import { useTranslation } from "react-i18next"; import { Button } from "@/components/ui/button"; import { ONBOARDING_TOUR_CLOSED_EVENT, ONBOARDING_TOUR_FINISHED_EVENT, } from "@/lib/onboarding-signal"; // Custom Onborda card, themed with the app's CSS variables. Closing always // persists completion; finishing the last step also asks the page to celebrate. export function OnboardingCard({ step, currentStep, totalSteps, nextStep, prevStep, arrow, }: CardComponentProps) { const { t } = useTranslation(); const { closeOnborda } = useOnborda(); const reduceMotion = useReducedMotion(); const isFirst = currentStep === 0; const isLast = currentStep === totalSteps - 1; // This step is completed by clicking the highlighted element (the "New" // button), not by a "Next" button — advancing manually would jump to a step // whose target doesn't exist yet and block the button. So hide "Next" here. const requiresAction = step.selector === '[data-onborda="create-profile"]'; const closeTour = () => { closeOnborda(); window.dispatchEvent(new Event(ONBOARDING_TOUR_CLOSED_EVENT)); }; return (

{step.title}

{currentStep + 1}/{totalSteps}
{step.content}
{isLast ? ( ) : ( )}
{!isFirst && !isLast && ( )} {isLast ? ( ) : requiresAction ? null : ( )}
{arrow}
); }