From e2c7647cdf54923e9307fdd936859888a73b87ee Mon Sep 17 00:00:00 2001 From: abiyasa05 Date: Fri, 29 Nov 2024 09:01:40 +0700 Subject: [PATCH] fix: update button on aspect management using shadcn --- .../_dashboardLayout/aspect/index.lazy.tsx | 58 ++++++++++--------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/apps/frontend/src/routes/_dashboardLayout/aspect/index.lazy.tsx b/apps/frontend/src/routes/_dashboardLayout/aspect/index.lazy.tsx index 9add598..b9d18a2 100644 --- a/apps/frontend/src/routes/_dashboardLayout/aspect/index.lazy.tsx +++ b/apps/frontend/src/routes/_dashboardLayout/aspect/index.lazy.tsx @@ -8,6 +8,7 @@ import { Flex } from "@mantine/core"; import createActionButtons from "@/utils/createActionButton"; import { TbEye, TbPencil, TbTrash } from "react-icons/tb"; import AspectDeleteModal from "@/modules/aspectManagement/modals/AspectDeleteModal"; +import { Button } from "@/shadcn/components/ui/button"; export const Route = createLazyFileRoute("/_dashboardLayout/aspect/")({ component: AspectPage, @@ -18,6 +19,13 @@ type DataType = ExtractQueryDataType; const columnHelper = createColumnHelper(); export default function AspectPage() { + // Function to update URL query string without refreshing + const updateQueryString = (key: string, value: string) => { + const searchParams = new URLSearchParams(window.location.search); + searchParams.set(key, value); + window.history.pushState({}, "", `?${searchParams.toString()}`); + }; + return ( props.row.index + 1, }), - // Aspect columns + // Aspect Columns columnHelper.display({ header: "Nama Aspek", cell: (props) => props.row.original.name || "Tidak ada Aspek", @@ -60,31 +68,29 @@ export default function AspectPage() { columnHelper.display({ header: "Aksi", cell: (props) => ( - - {createActionButtons([ - { - label: "Detail", - permission: true, - action: `?detail=${props.row.original.id}`, - color: "black", - icon: , - }, - { - label: "Ubah", - permission: true, - action: `?edit=${props.row.original.id}`, - color: "black", - icon: , - }, - { - label: "Hapus", - permission: true, - action: `?delete=${props.row.original.id}`, - color: "black", - icon: , - }, - ])} - +
+ + + +
), }), ]}