/* eslint-disable react-hooks/exhaustive-deps */ 'use client'; import colors from '@/con/colors'; import { ScrollArea, Stack, Tabs, TabsList, TabsPanel, TabsTab, Title, Tooltip } from '@mantine/core'; import { IconChartBar, IconUsers } from '@tabler/icons-react'; import { usePathname, useRouter } from 'next/navigation'; import React, { useEffect, useState } from 'react'; function LayoutTabsIKM({ children }: { children: React.ReactNode }) { const router = useRouter() const pathname = usePathname() const tabs = [ { label: "Grafik Kepuasan Masyarakat", description: "Lihat dan kelola Grafik Kepuasan Masyarakat", value: "grafikkepuasannamasyarakat", href: "/admin/ppid/indeks-kepuasan-masyarakat/grafik-kepuasan-masyarakat", icon: }, { label: "Responden", description: "Kelola dan tinjau data responden", value: "responden", href: "/admin/ppid/indeks-kepuasan-masyarakat/responden", icon: }, ]; const curentTab = tabs.find(tab => tab.href === pathname) const [activeTab, setActiveTab] = useState(curentTab?.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 ( Indeks Kepuasan Masyarakat {tabs.map((e, i) => ( {e.label} ))} {tabs.map((e, i) => ( {/* Konten dummy, bisa diganti tergantung routing */} <> ))} {children} ); } export default LayoutTabsIKM;