diff --git a/src/components/DesaSetting.tsx b/src/components/DesaSetting.tsx index b5361b1..39bf3f4 100644 --- a/src/components/DesaSetting.tsx +++ b/src/components/DesaSetting.tsx @@ -207,7 +207,7 @@ export default function DesaSetting({ - {list?.map((v: any) => ( + {list.length > 0 && list?.map((v: any) => ( {v.name} diff --git a/src/components/KategoriPelayananSurat.tsx b/src/components/KategoriPelayananSurat.tsx index f39ba3e..6c0b5a2 100644 --- a/src/components/KategoriPelayananSurat.tsx +++ b/src/components/KategoriPelayananSurat.tsx @@ -4,19 +4,17 @@ import { Button, Divider, Flex, - Grid, Group, - Input, List, Modal, Stack, Table, Text, Title, - Tooltip, + Tooltip } from "@mantine/core"; import { useDisclosure, useShallowEffect } from "@mantine/hooks"; -import { IconEdit, IconEye, IconPlus, IconTrash } from "@tabler/icons-react"; +import { IconEye, IconTrash } from "@tabler/icons-react"; import type { JsonValue } from "generated/prisma/runtime/library"; import { useState } from "react"; import useSWR from "swr"; @@ -625,7 +623,7 @@ export default function KategoriPelayananSurat({ - {list?.map((v: any) => ( + {list.length > 0 && list?.map((v: any) => ( {v.name} diff --git a/src/pages/scr/dashboard/dashboard_layout.tsx b/src/pages/scr/dashboard/dashboard_layout.tsx index 6e90d54..046c5ce 100644 --- a/src/pages/scr/dashboard/dashboard_layout.tsx +++ b/src/pages/scr/dashboard/dashboard_layout.tsx @@ -73,7 +73,7 @@ export default function DashboardLayout() { ([]); - console.log(location) - useEffect(() => { async function fetchPermissions() { const { data } = await apiFetch.api.user.find.get(); @@ -292,14 +290,19 @@ function NavigationDashboard() { .map((item) => ( {item.label} - {(isActive(item.path as keyof typeof clientRoute) || + {( + 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") + (location.pathname == "/scr/dashboard/pengaduan/detail" && item.path == "/scr/dashboard/pengaduan/list") || + (location.pathname == "/scr/dashboard/warga/detail-warga" && item.path == "/scr/dashboard/warga/list-warga") ) && ( { + console.log('jalan', viewImg) if (viewImg) { setOpenedPreviewFile(true); } @@ -374,6 +375,7 @@ function DetailDataPengajuan({ open={openedPreviewFile && !_.isEmpty(viewImg.file)} onClose={() => { setOpenedPreviewFile(false); + setViewImg({ file: "", folder: "" }) }} folder={viewImg.folder} fileName={viewImg.file} diff --git a/src/pages/scr/dashboard/setting/detail_setting_page.tsx b/src/pages/scr/dashboard/setting/detail_setting_page.tsx index b16fc8c..6434491 100644 --- a/src/pages/scr/dashboard/setting/detail_setting_page.tsx +++ b/src/pages/scr/dashboard/setting/detail_setting_page.tsx @@ -18,12 +18,13 @@ import { import type { JsonValue } from "generated/prisma/runtime/library"; import _ from "lodash"; import { useEffect, useState } from "react"; -import { useLocation } from "react-router-dom"; +import { useLocation, useNavigate } from "react-router-dom"; export default function DetailSettingPage() { const { search } = useLocation(); const query = new URLSearchParams(search); const type = query.get("type"); + const navigate = useNavigate(); const [permissions, setPermissions] = useState([]); const dataMenu = [ { title: "Dashboard", link: "/scr/dashboard/dashboard-home", active: false }, @@ -114,7 +115,7 @@ export default function DetailSettingPage() { .map((item) => ( {navigate("?type=" + item.path)}} label={item.label} leftSection={item.icon} active={