import Link from 'next/link' import { usePathname } from 'next/navigation' import { Admonition } from 'ui-patterns/admonition' import { useMenuActiveRefId } from '~/hooks/useMenuState' import type { ICommonSection } from './Reference.types' export interface OldVersionAlertProps { sections: ICommonSection[] } const OldVersionAlert = ({ sections }: OldVersionAlertProps) => { const pathname = usePathname() const activeRefId = useMenuActiveRefId() const activeSection = sections.find(({ id }) => id === activeRefId) // Remove the version number from URL to get the latest const latestVersionUrl = pathname .split('/') .slice(0, -2) .concat(activeSection ? [activeSection.slug] : []) .join('/') return (