From 895cef6c758203d2bfb911532ed04f967902112e Mon Sep 17 00:00:00 2001 From: Sabda Yagra Date: Thu, 31 Jul 2025 12:36:17 +0700 Subject: [PATCH] fixing --- .../content/spit/table-spit/columns.tsx | 38 ++++++++++++++----- app/[locale]/(public)/image/filter/page.tsx | 12 +++++- app/[locale]/(public)/video/filter/page.tsx | 12 +++++- 3 files changed, 51 insertions(+), 11 deletions(-) diff --git a/app/[locale]/(protected)/contributor/content/spit/table-spit/columns.tsx b/app/[locale]/(protected)/contributor/content/spit/table-spit/columns.tsx index e61ae545..3cdc0f66 100644 --- a/app/[locale]/(protected)/contributor/content/spit/table-spit/columns.tsx +++ b/app/[locale]/(protected)/contributor/content/spit/table-spit/columns.tsx @@ -8,6 +8,7 @@ import { Trash2, } from "lucide-react"; import { Button } from "@/components/ui/button"; +import { Checkbox } from "@/components/ui/checkbox"; import { DropdownMenu, DropdownMenuContent, @@ -21,9 +22,33 @@ import withReactContent from "sweetalert2-react-content"; import Swal from "sweetalert2"; const useTableColumns = () => { - const t = useTranslations("Table"); // Panggil di dalam hook + const t = useTranslations("Table"); const MySwal = withReactContent(Swal); + const columns: ColumnDef[] = [ + { + id: "select", + header: ({ table }) => ( + table.toggleAllPageRowsSelected(!!val)} + aria-label="Pilih semua pada halaman ini" + /> + + ), + cell: ({ row }) => ( + row.toggleSelected(!!val)} + aria-label="Pilih baris" + /> + ), + enableSorting: false, + enableHiding: false, + }, { accessorKey: "no", header: t("no", { defaultValue: "No" }), @@ -56,7 +81,6 @@ const useTableColumns = () => { {row.getValue("contentTag")} ), }, - { accessorKey: "contentType", header: t("type-content", { defaultValue: "Type Content" }), @@ -73,7 +97,6 @@ const useTableColumns = () => { ), }, - { accessorKey: "isPublish", header: "Status", @@ -95,7 +118,6 @@ const useTableColumns = () => { ); }, }, - { accessorKey: "contentCreatedDate", header: t("upload-date", { defaultValue: "Upload Date" }), @@ -104,7 +126,6 @@ const useTableColumns = () => { | string | number | undefined; - const formattedDate = createdAt && !isNaN(new Date(createdAt).getTime()) ? format(new Date(createdAt), "dd-MM-yyyy HH:mm:ss") @@ -118,8 +139,7 @@ const useTableColumns = () => { header: "Actions", enableHiding: false, cell: ({ row }) => { - const isDisabled = row.original.isPublish; // Check the isPublish value - + const isDisabled = row.original.isPublish; return ( @@ -128,7 +148,7 @@ const useTableColumns = () => { className={`bg-transparent ring-offset-transparent hover:bg-transparent hover:ring-0 hover:ring-transparent ${ isDisabled ? "cursor-not-allowed opacity-50" : "" }`} - disabled={isDisabled} // Disable button if isPublish is true + disabled={isDisabled} > Open menu @@ -142,7 +162,7 @@ const useTableColumns = () => { className={`p-2 border-b text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none ${ isDisabled ? "cursor-not-allowed opacity-50" : "" }`} - disabled={isDisabled} // Disable dropdown item if isPublish is true + disabled={isDisabled} > Pindah Ke Mediahub diff --git a/app/[locale]/(public)/image/filter/page.tsx b/app/[locale]/(public)/image/filter/page.tsx index e7d11047..8af75edd 100644 --- a/app/[locale]/(public)/image/filter/page.tsx +++ b/app/[locale]/(public)/image/filter/page.tsx @@ -823,7 +823,7 @@ const FilterPage = () => { {/* */}
- { width: "100%", height: "100%", }} + /> */} + {image?.title}
diff --git a/app/[locale]/(public)/video/filter/page.tsx b/app/[locale]/(public)/video/filter/page.tsx index 3aa985dd..3b7b0fae 100644 --- a/app/[locale]/(public)/video/filter/page.tsx +++ b/app/[locale]/(public)/video/filter/page.tsx @@ -833,7 +833,7 @@ const FilterPage = () => { {/* */}
- { width: "100%", height: "100%", }} + /> */} + {video?.title}