ifixkart-admin/components/integrations/IntegrationsHeaderNav.tsx

126 lines
4 KiB
TypeScript

'use client';
import React from 'react';
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import {
Layers,
MessageSquare,
Mail,
BarChart3,
Share2,
PhoneCall,
Truck,
CheckCircle2,
AlertCircle
} from 'lucide-react';
interface IntegrationsHeaderNavProps {
activeTab?: string;
badgeCounts?: Record<string, string>;
}
export const IntegrationsHeaderNav: React.FC<IntegrationsHeaderNavProps> = ({ activeTab }) => {
const pathname = usePathname();
const tabs = [
{
id: 'overview',
name: 'All Integrations',
href: '/integrations',
icon: Layers,
match: pathname === '/integrations',
},
{
id: 'whatsapp',
name: 'WhatsApp Hub',
description: 'OpenWA QR & WATI',
href: '/integrations/whatsapp',
icon: MessageSquare,
match: pathname.startsWith('/integrations/whatsapp'),
},
{
id: 'email',
name: 'Email Dispatcher',
description: 'ZeptoMail & SMTP',
href: '/integrations/email',
icon: Mail,
match: pathname.startsWith('/integrations/email'),
},
{
id: 'google-analytics',
name: 'Google Analytics GA4',
description: 'Live Telemetry',
href: '/integrations/google-analytics',
icon: BarChart3,
match: pathname.startsWith('/integrations/google-analytics') || pathname.startsWith('/analytics/google'),
},
{
id: 'meta-ads',
name: 'Meta Ads & Graph',
description: 'FB / IG Graph API',
href: '/integrations/meta-ads',
icon: Share2,
match: pathname.startsWith('/integrations/meta-ads'),
},
{
id: 'call',
name: 'Knowlarity Telephony',
description: 'Virtual IVR & Calls',
href: '/integrations/call',
icon: PhoneCall,
match: pathname.startsWith('/integrations/call'),
},
{
id: 'shipping',
name: 'Shiprocket Logistics',
description: 'Courier & Serviceability',
href: '/integrations/shipping',
icon: Truck,
match: pathname.startsWith('/integrations/shipping'),
},
];
return (
<div className="mb-6 space-y-4">
<div className="flex flex-col md:flex-row md:items-center justify-between gap-4 border-b border-gray-200 dark:border-gray-800 pb-4">
<div>
<div className="flex items-center gap-2">
<h1 className="text-2xl font-bold tracking-tight text-gray-900 dark:text-white">
Enterprise Integrations Hub
</h1>
<span className="inline-flex items-center gap-1 rounded-full bg-emerald-50 px-2 py-0.5 text-xs font-medium text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300 border border-emerald-200 dark:border-emerald-800">
<CheckCircle2 className="w-3 h-3 text-emerald-500" />
Live Active
</span>
</div>
<p className="text-sm text-gray-500 dark:text-gray-400 mt-1">
Centralized microservice connections, credential synchronization, and direct gateway actions.
</p>
</div>
</div>
{/* Tabs navigation */}
<div className="flex items-center gap-2 overflow-x-auto pb-2 scrollbar-none border-b border-gray-100 dark:border-gray-800">
{tabs.map((tab) => {
const Icon = tab.icon;
const isActive = tab.match || activeTab === tab.id;
return (
<Link
key={tab.id}
href={tab.href}
className={`flex items-center gap-2.5 px-4 py-2.5 rounded-lg text-sm font-medium transition-all whitespace-nowrap ${
isActive
? 'bg-blue-600 text-white shadow-sm shadow-blue-500/20'
: 'text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-800'
}`}
>
<Icon className={`w-4 h-4 ${isActive ? 'text-white' : 'text-gray-500 dark:text-gray-400'}`} />
<span>{tab.name}</span>
</Link>
);
})}
</div>
</div>
);
};