feat: integrate contextual links and fix coupons navigation

- Added DocLink component and mapped routes
- Fixed Coupons nav link to /marketing/coupons
- Updated Settings pages to show inline documentation links
This commit is contained in:
Dwindi Ramadhana
2026-02-05 22:51:44 +07:00
parent 5f08c18ec7
commit 7da4f0a167
11 changed files with 221 additions and 22 deletions

View File

@@ -0,0 +1,26 @@
import React from 'react';
import { useLocation } from 'react-router-dom';
import { BookOpen } from 'lucide-react';
import { getDocUrl } from '@/config/docRoutes';
import { Button } from '@/components/ui/button';
export function DocLink() {
const location = useLocation();
const docUrl = getDocUrl(location.pathname);
if (!docUrl) return null;
return (
<Button
variant="ghost"
size="icon"
className="h-8 w-8 ml-2 text-muted-foreground hover:text-primary"
asChild
>
<a href={docUrl} target="_blank" rel="noopener noreferrer" title="View Documentation">
<BookOpen className="h-4 w-4" />
<span className="sr-only">View Documentation</span>
</a>
</Button>
);
}

View File

@@ -7,6 +7,8 @@ interface PageHeaderProps {
hideOnDesktop?: boolean;
}
import { DocLink } from '@/components/DocLink';
export function PageHeader({ fullscreen = false, hideOnDesktop = false }: PageHeaderProps) {
const { title, action } = usePageHeader();
const location = useLocation();
@@ -24,8 +26,9 @@ export function PageHeader({ fullscreen = false, hideOnDesktop = false }: PageHe
return (
<div className={`sticky top-0 z-20 border-b bg-background ${hideOnDesktop ? 'md:hidden' : ''}`}>
<div className={`${containerClass} px-4 py-3 flex items-center justify-between min-w-0`}>
<div className="min-w-0 flex-1">
<div className="min-w-0 flex-1 flex items-center">
<h1 className="text-lg font-semibold truncate">{title}</h1>
<DocLink />
</div>
{action && <div className="flex-shrink-0 ml-4">{action}</div>}
</div>