import { useRouter } from 'next/router' import cx from 'classnames' import { ZapIcon, InfoIcon } from '@primer/octicons-react' import { Callout } from 'components/ui/Callout' import { Link } from 'components/Link' import { DefaultLayout } from 'components/DefaultLayout' import { ArticleTopper } from 'components/article/ArticleTopper' import { ArticleTitle } from 'components/article/ArticleTitle' import { useArticleContext } from 'components/context/ArticleContext' import { useTranslation } from 'components/hooks/useTranslation' import { LearningTrackNav } from './LearningTrackNav' import { ArticleContent } from './ArticleContent' import { ArticleGridLayout } from './ArticleGridLayout' // Mapping of a "normal" article to it's interactive counterpart const interactiveAlternatives: Record = { '/actions/guides/building-and-testing-nodejs': { href: '/actions/guides/building-and-testing-nodejs-or-python?langId=nodejs', }, '/actions/guides/building-and-testing-python': { href: '/actions/guides/building-and-testing-nodejs-or-python?langId=python', }, } export const ArticlePage = () => { const router = useRouter() const { title, intro, renderedPage, contributor, permissions, includesPlatformSpecificContent, defaultPlatform, product, miniTocItems, currentLearningTrack, } = useArticleContext() const { t } = useTranslation('pages') const currentPath = router.asPath.split('?')[0] return (
{title} {contributor && (

{t('contributor_callout')} {contributor.name}.

)} {intro && (
)} {permissions && (
)} {includesPlatformSpecificContent && ( )} {product && ( )} } toc={ <> {!!interactiveAlternatives[currentPath] && (
Try the new interactive article
)} {miniTocItems.length > 1 && ( <>

{t('miniToc')}

    {miniTocItems.map((item) => { return (
  • ) })}
)} } > {renderedPage} {currentLearningTrack?.trackName ? (
) : null}
) }