diff --git a/src/components/BreadCrumbs.tsx b/src/components/BreadCrumbs.tsx new file mode 100644 index 0000000..50a5a30 --- /dev/null +++ b/src/components/BreadCrumbs.tsx @@ -0,0 +1,44 @@ +import { ActionIcon, Anchor, Breadcrumbs, Card, Group } from "@mantine/core"; +import { IconChevronLeft } from "@tabler/icons-react"; +import { useNavigate } from "react-router-dom"; + +export default function BreadCrumbs({ dataLink, back, linkBack }: { dataLink: { title: string, link: string, active: boolean }[], back?: boolean, linkBack?: string }) { + const navigate = useNavigate(); + + return ( + + + { + back && + window.history.back()}> + + + } + + { + dataLink.map((item, index) => ( + item.active || item.link == "#" ? null : navigate(item.link)} + key={index} + > + {item.title} + + )) + } + + + + + ) +} \ No newline at end of file diff --git a/src/pages/scr/dashboard/dashboard_layout.tsx b/src/pages/scr/dashboard/dashboard_layout.tsx index 0a7b5ae..6e90d54 100644 --- a/src/pages/scr/dashboard/dashboard_layout.tsx +++ b/src/pages/scr/dashboard/dashboard_layout.tsx @@ -215,6 +215,8 @@ function NavigationDashboard() { const location = useLocation(); const [permissions, setPermissions] = useState([]); + console.log(location) + useEffect(() => { async function fetchPermissions() { const { data } = await apiFetch.api.user.find.get(); @@ -295,17 +297,21 @@ function NavigationDashboard() { label={ {item.label} - {isActive(item.path as keyof typeof clientRoute) && ( - - Active - - )} + {(isActive(item.path as keyof typeof clientRoute) || + (location.pathname == "/scr/dashboard/pelayanan-surat/detail-pelayanan" && item.path == "/scr/dashboard/pelayanan-surat/list-pelayanan") || + (location.pathname == "/scr/dashboard/pengaduan/detail" && item.path == "/scr/dashboard/pengaduan/list") + ) + && ( + + Active + + )} } description={item.description} diff --git a/src/pages/scr/dashboard/pelayanan-surat/detail_pelayanan_page.tsx b/src/pages/scr/dashboard/pelayanan-surat/detail_pelayanan_page.tsx index b51e64d..9970d37 100644 --- a/src/pages/scr/dashboard/pelayanan-surat/detail_pelayanan_page.tsx +++ b/src/pages/scr/dashboard/pelayanan-surat/detail_pelayanan_page.tsx @@ -1,3 +1,4 @@ +import BreadCrumbs from "@/components/BreadCrumbs"; import ModalFile from "@/components/ModalFile"; import ModalSurat from "@/components/ModalSurat"; import notification from "@/components/notificationGlobal"; @@ -49,6 +50,11 @@ import { useLocation } from "react-router-dom"; import useSwr from "swr"; export default function DetailPengajuanPage() { + const dataMenu = [ + { title: "Dashboard", link: "/scr/dashboard/dashboard-home", active: false }, + { title: "Pelayanan Surat", link: "/scr/dashboard/pelayanan-surat/list-pelayanan", active: false }, + { title: "Detail Pengajuan Surat", link: "#", active: true }, + ]; const { search } = useLocation(); const query = new URLSearchParams(search); const id = query.get("id"); @@ -67,6 +73,9 @@ export default function DetailPengajuanPage() { return ( + + + + + + ([]); + const dataMenu = [ + { title: "Dashboard", link: "/scr/dashboard/dashboard-home", active: false }, + { title: "Setting", link: "#", active: false }, + { title: type == "cat-pengaduan" ? "Kategori Pengaduan" : type == "cat-pelayanan" ? "Kategori Pelayanan Surat" : type ? _.upperFirst(type) : "Profile", link: "#", active: true }, + ]; useEffect(() => { async function fetchPermissions() { @@ -87,6 +94,9 @@ export default function DetailSettingPage() { return ( + + + + + +