import classNames from 'classnames'; import * as React from 'react'; import { useDispatch } from 'react-redux'; import ReactSwipeableViews from 'react-swipeable-views'; import { endOnboarding } from 'soapbox/actions/onboarding'; import LandingGradient from 'soapbox/components/landing-gradient'; import { HStack } from 'soapbox/components/ui'; import AvatarSelectionStep from './steps/avatar-selection-step'; import BioStep from './steps/bio-step'; import CompletedStep from './steps/completed-step'; import CoverPhotoSelectionStep from './steps/cover-photo-selection-step'; import DisplayNameStep from './steps/display-name-step'; import SuggestedAccountsStep from './steps/suggested-accounts-step'; const OnboardingWizard = () => { const dispatch = useDispatch(); const [currentStep, setCurrentStep] = React.useState(0); const handleSwipe = (nextStep: number) => { setCurrentStep(nextStep); }; const handlePreviousStep = () => { setCurrentStep((prevStep) => Math.max(0, prevStep - 1)); }; const handleNextStep = () => { setCurrentStep((prevStep) => Math.min(prevStep + 1, steps.length - 1)); }; const handleComplete = () => { dispatch(endOnboarding()); }; const steps = [ , , , , , , ]; const handleKeyUp = ({ key }: KeyboardEvent): void => { switch (key) { case 'ArrowLeft': handlePreviousStep(); break; case 'ArrowRight': handleNextStep(); break; } }; const handleDotClick = (nextStep: number) => { setCurrentStep(nextStep); }; React.useEffect(() => { document.addEventListener('keyup', handleKeyUp); return () => { document.removeEventListener('keyup', handleKeyUp); }; }, []); return (
{steps.map((step, i) => (
{step}
))}
{steps.map((_, i) => (
); }; export default OnboardingWizard;