/* eslint-disable react-hooks/exhaustive-deps */ 'use client' import { usePathname, useRouter } from 'next/navigation'; import React, { useEffect, useState } from 'react'; import { Stack, Tabs, TabsList, TabsPanel, TabsTab, Title, Tooltip, ScrollArea, } from '@mantine/core'; import { IconBulb, IconUsers, IconBrandFacebook } from '@tabler/icons-react'; import colors from '@/con/colors'; function LayoutTabs({ children }: { children: React.ReactNode }) { const router = useRouter(); const pathname = usePathname(); const tabs = [ { label: "Program Inovasi", value: "program-inovasi", href: "/admin/landing-page/profile/program-inovasi", icon: , tooltip: "Lihat dan kelola program inovasi desa", }, { label: "Pejabat Desa", value: "pejabat-desa", href: "/admin/landing-page/profile/pejabat-desa", icon: , tooltip: "Kelola data pejabat desa", }, { label: "Media Sosial", value: "media-sosial", href: "/admin/landing-page/profile/media-sosial", icon: , tooltip: "Atur tautan media sosial desa", }, ]; const currentTab = tabs.find((tab) => tab.href === pathname); const [activeTab, setActiveTab] = useState( currentTab?.value || tabs[0].value ); const handleTabChange = (value: string | null) => { const tab = tabs.find((t) => t.value === value); if (tab) { router.push(tab.href); } setActiveTab(value); }; useEffect(() => { const match = tabs.find((tab) => tab.href === pathname); if (match) { setActiveTab(match.value); } }, [pathname]); return ( Profil Desa {/* ✅ Scroll horizontal wrapper */} {tabs.map((tab, i) => ( {tab.label} ))} {tabs.map((tab, i) => ( {children} ))} ); } export default LayoutTabs;