teqo-backup/src/components/campaign/shared/CampaignWizardNavLink.tsx
Cursor Agent 28525aab4b
B135 — Voltar no wizard usa passo lógico anterior na cadeia (#289)
- wizardPreviousHref em wizardActionChain para todos os elos B98
- Avanço encadeado com router.push; Voltar no chrome com replace
- Testes unitários para href anterior e navegação pending

Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
2026-08-02 23:04:26 +00:00

35 lines
903 B
TypeScript

'use client'
import type { ComponentPropsWithoutRef } from 'react'
import {
CampaignTransitionAnchor,
useCampaignListTransition,
} from '@/components/campaign/shared/CampaignListPending'
import { cn } from '@/lib/utils'
/**
* Wizard route navigation with shared list pending: drives the layout boundary
* and locks sibling triggers while the RSC payload loads.
*/
export const CampaignWizardNavLink = ({
href,
replace = false,
className,
children,
...anchorProps
}: Omit<ComponentPropsWithoutRef<'a'>, 'href'> & { href: string; replace?: boolean }) => {
const { isPending } = useCampaignListTransition()
return (
<CampaignTransitionAnchor
href={href}
replace={replace}
className={cn(isPending && 'pointer-events-none', className)}
aria-busy={isPending || undefined}
{...anchorProps}
>
{children}
</CampaignTransitionAnchor>
)
}