import { __ } from '@wordpress/i18n'
import classNames from 'classnames'
import { useGlobalStore } from '@onboarding/state/Global'
import { usePagesStore } from '@onboarding/state/Pages'
import { useUserSelectionStore } from '@onboarding/state/UserSelections'
import { LeftArrowIcon, RightArrowIcon } from '@onboarding/svg'
export const PageControl = () => {
const { previousPage, currentPageIndex, pages } = usePagesStore()
const { openExitModal, setExitButtonHovered } = useGlobalStore()
const onFirstPage = currentPageIndex === 0
const currentPageKey = Array.from(pages.keys())[currentPageIndex]
return (
{onFirstPage && (
)}
{onFirstPage || (
)}
{onFirstPage && (
)}
)
}
const NextButton = () => {
const { nextPage, currentPageIndex, pages } = usePagesStore()
const totalPages = usePagesStore((state) => state.count())
const canLaunch = useUserSelectionStore((state) => state.canLaunch())
const onLastPage = currentPageIndex === totalPages - 1
const currentPageKey = Array.from(pages.keys())[currentPageIndex]
const pageState = pages.get(currentPageKey).state()
if (canLaunch && onLastPage) {
return (
)
}
return (
)
}