11import { Button } from '@/components/ui/button'
22import { Tooltip , TooltipContent , TooltipProvider , TooltipTrigger } from '@/components/ui/tooltip'
33import useDirDetection from '@/hooks/use-dir-detection'
4- import { LucideIcon , Plus } from 'lucide-react'
4+ import { getDocsUrl } from '@/utils/docs-url'
5+ import { LucideIcon , Plus , HelpCircle } from 'lucide-react'
56import { useTranslation } from 'react-i18next'
7+ import { useLocation } from 'react-router'
68
79interface PageHeaderProps {
810 title : string
@@ -11,15 +13,41 @@ interface PageHeaderProps {
1113 onButtonClick ?: ( ) => void
1214 buttonIcon ?: LucideIcon
1315 buttonTooltip ?: string
16+ tutorialUrl ?: string
1417}
1518
16- export default function PageHeader ( { title, description, buttonText, onButtonClick, buttonIcon : Icon = Plus , buttonTooltip } : PageHeaderProps ) {
19+ export default function PageHeader ( { title, description, buttonText, onButtonClick, buttonIcon : Icon = Plus , buttonTooltip, tutorialUrl } : PageHeaderProps ) {
1720 const { t } = useTranslation ( )
1821 const dir = useDirDetection ( )
22+ const location = useLocation ( )
23+
24+ // Generate tutorial URL if not provided
25+ const docsUrl = tutorialUrl || getDocsUrl ( location . pathname )
26+
1927 return (
2028 < div dir = { dir } className = "mx-auto flex w-full flex-row items-start justify-between gap-4 px-4 py-4 md:pt-6" >
2129 < div className = "flex flex-col gap-y-1" >
22- < h1 className = "text-lg font-medium sm:text-xl" > { t ( title ) } </ h1 >
30+ < div className = "flex items-center gap-2.5" >
31+ < h1 className = "text-lg font-medium sm:text-xl" > { t ( title ) } </ h1 >
32+ < TooltipProvider >
33+ < Tooltip >
34+ < TooltipTrigger asChild >
35+ < a
36+ href = { docsUrl }
37+ target = "_blank"
38+ rel = "noopener noreferrer"
39+ className = "inline-flex h-7 w-7 items-center justify-center rounded-md border-0 text-primary transition-colors hover:border-2 hover:border-primary/40 hover:bg-primary/5 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
40+ aria-label = { t ( 'tutorial' , { defaultValue : 'View tutorial' } ) }
41+ >
42+ < HelpCircle className = "h-4 w-4" />
43+ </ a >
44+ </ TooltipTrigger >
45+ < TooltipContent >
46+ < p > { t ( 'tutorial' , { defaultValue : 'View tutorial' } ) } </ p >
47+ </ TooltipContent >
48+ </ Tooltip >
49+ </ TooltipProvider >
50+ </ div >
2351 { description && < span className = "whitespace-normal text-xs text-muted-foreground sm:text-sm" > { t ( description ) } </ span > }
2452 </ div >
2553 { buttonText && onButtonClick && (
0 commit comments