@@ -6,6 +6,7 @@ import { useEffect, useState, type FC } from 'react';
66import { ChevronSmallRightIcon } from '@storybook/icons' ;
77import type { TreeProps } from '@repo/utils' ;
88import { cn , docsVersions } from '@repo/utils' ;
9+ import { usePlausible } from 'next-plausible' ;
910import { usePathname , useSelectedLayoutSegment } from 'next/navigation' ;
1011import { getVersion } from '../../../lib/get-version' ;
1112import { VersionSelector } from './version-selector' ;
@@ -16,6 +17,8 @@ interface NavDocsProps {
1617 listOfTrees : TreeProps [ ] ;
1718}
1819
20+ const GET_STARTED_SLUGS = [ '/docs' , '/docs/' , '/docs/get-started' , '/docs/get-started/' ] ;
21+
1922export const NavDocs : FC < NavDocsProps > = ( { listOfTrees } ) => {
2023 const pathname = usePathname ( ) ;
2124 const segment = useSelectedLayoutSegment ( ) ;
@@ -66,6 +69,7 @@ export const NavDocs: FC<NavDocsProps> = ({ listOfTrees }) => {
6669
6770const Level1 = ( { lvl1 } : { lvl1 : TreeProps } ) => {
6871 const pathname = usePathname ( ) ;
72+ const plausible = usePlausible ( ) ;
6973 let slug = lvl1 . slug ;
7074 docsVersions . forEach ( ( version ) => {
7175 if (
@@ -87,6 +91,9 @@ const Level1 = ({ lvl1 }: { lvl1: TreeProps }) => {
8791 isActive && 'text-blue-500' ,
8892 ) }
8993 href = { lvl1 . slug }
94+ onClick = { GET_STARTED_SLUGS . includes ( lvl1 . slug )
95+ ? ( ) => { plausible ( 'GetStartedClick' , { props : { location : 'sidebar-nav' } } ) }
96+ : undefined }
9097 >
9198 { lvl1 . sidebar ?. title ?? lvl1 . title }
9299 </ Link >
0 commit comments