From c1aec7f31617cccc9229cb79d04a62b780c4d292 Mon Sep 17 00:00:00 2001 From: Sabda Yagra Date: Tue, 5 Aug 2025 22:54:26 +0700 Subject: [PATCH 1/2] fixing --- components/landing-page/navbar.tsx | 28 ++-- components/landing-page/new-content.tsx | 206 +++++++++++++++--------- 2 files changed, 144 insertions(+), 90 deletions(-) diff --git a/components/landing-page/navbar.tsx b/components/landing-page/navbar.tsx index 00c8f3e1..834fa234 100644 --- a/components/landing-page/navbar.tsx +++ b/components/landing-page/navbar.tsx @@ -250,34 +250,38 @@ const Navbar = () => { - - - - + diff --git a/components/landing-page/new-content.tsx b/components/landing-page/new-content.tsx index 3bbc213a..cfbe8fb7 100644 --- a/components/landing-page/new-content.tsx +++ b/components/landing-page/new-content.tsx @@ -128,7 +128,10 @@ const NewContent = (props: { group: string; type: string }) => {

{pathname?.split("/")[1] == "in" ? ( <> - {t("content", { defaultValue: "Content" })}  + + {t("content", { defaultValue: "Content" })} + +   {props.type == "popular" ? "Terpopuler" : props.type == "latest" @@ -153,10 +156,22 @@ const NewContent = (props: { group: string; type: string }) => { {[ - { label: t("image", { defaultValue: "Image" }), value: "image" }, - { label: t("video", { defaultValue: "Video" }), value: "video" }, - { label: t("text", { defaultValue: "Text" }), value: "document" }, - { label: t("audio", { defaultValue: "Audio" }), value: "audio" }, + { + label: t("image", { defaultValue: "Image" }), + value: "image", + }, + { + label: t("video", { defaultValue: "Video" }), + value: "video", + }, + { + label: t("text", { defaultValue: "Text" }), + value: "document", + }, + { + label: t("audio", { defaultValue: "Audio" }), + value: "audio", + }, ].map((tab) => ( { className="md:basis-1/2 lg:basis-1/3" >
- router.push( - prefixPath + `/image/detail/${image?.slug}` - ) - } - className="cursor-pointer relative group overflow-hidden bg-white dark:bg-black dark:border dark:border-gray-500 rounded-xl shadow-md hover:shadow-lg transition-shadow duration-300" + // onClick={() => + // router.push( + // prefixPath + `/image/detail/${image?.slug}` + // ) + // } + className="relative group overflow-hidden bg-white dark:bg-black dark:border dark:border-gray-500 rounded-xl shadow-md hover:shadow-lg transition-shadow duration-300" > {/* Image with motion effect */} { whileHover={{ scale: 0.95 }} transition={{ duration: 0.3 }} > - image + + {" "} + image + {/* Badge category */} @@ -248,15 +270,15 @@ const NewContent = (props: { group: string; type: string }) => { {image?.categoryName?.toUpperCase() ?? "Giat Pimpinan"}

-

- {image?.title} -

+

+ {image?.title} +

+
{/* Optional metadata area (uncomment if needed) */} {/* @@ -271,7 +293,7 @@ const NewContent = (props: { group: string; type: string }) => { ))} -
+
{Array.from({ length: count }).map((_, index) => ( - + {/* @@ -152,6 +152,33 @@ const columns: ColumnDef[] = [ Delete + */} + + + + + View + + + + {levelNumber === "1" && ( + <> + + + + Edit + + + + handleDeleteAdvertisements(row.original.id)} + className="p-2 border-b text-destructive bg-destructive/30 focus:bg-destructive focus:text-destructive-foreground rounded-none" + > + + Delete + + + )} ); diff --git a/app/[locale]/(protected)/admin/settings/iklan/component/table.tsx b/app/[locale]/(protected)/admin/settings/iklan/component/table.tsx index 87fc408b..7d3ba29b 100644 --- a/app/[locale]/(protected)/admin/settings/iklan/component/table.tsx +++ b/app/[locale]/(protected)/admin/settings/iklan/component/table.tsx @@ -39,7 +39,7 @@ import { UploadIcon, UserIcon, } from "lucide-react"; -import { cn } from "@/lib/utils"; +import { cn, getCookiesDecrypt } from "@/lib/utils"; import { DropdownMenu, DropdownMenuContent, @@ -94,6 +94,9 @@ const AdvertisementsList = () => { const [statusFilter, setStatusFilter] = React.useState([]); const [page, setPage] = React.useState(1); const [totalPage, setTotalPage] = React.useState(1); + const roleId = getCookiesDecrypt("urie"); + const levelNumber = getCookiesDecrypt("ulne"); + const userLevelId = getCookiesDecrypt("ulie"); const table = useReactTable({ data: dataTable, columns, @@ -203,23 +206,27 @@ const AdvertisementsList = () => { return ( <>
-
- - {dataTable.length == 4 && ( -

- Jumlah Iklan Sudah Maksimal (4) -

- )} -
+ {levelNumber === "1" && ( +
+ + + + {dataTable.length == 4 && ( +

+ Jumlah Iklan Sudah Maksimal (4) +

+ )} +
+ )} + {/* */}
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 3cdc0f66..15de93c8 100644 --- a/app/[locale]/(protected)/contributor/content/spit/table-spit/columns.tsx +++ b/app/[locale]/(protected)/contributor/content/spit/table-spit/columns.tsx @@ -8,7 +8,7 @@ import { Trash2, } from "lucide-react"; import { Button } from "@/components/ui/button"; -import { Checkbox } from "@/components/ui/checkbox"; +import { Checkbox } from "@/components/ui/checkbox"; import { DropdownMenu, DropdownMenuContent, @@ -20,6 +20,7 @@ import { Link } from "@/components/navigation"; import { useTranslations } from "next-intl"; import withReactContent from "sweetalert2-react-content"; import Swal from "sweetalert2"; +import { useState } from "react"; const useTableColumns = () => { const t = useTranslations("Table"); @@ -37,7 +38,6 @@ const useTableColumns = () => { onCheckedChange={(val) => table.toggleAllPageRowsSelected(!!val)} aria-label="Pilih semua pada halaman ini" /> - ), cell: ({ row }) => ( { enableHiding: false, cell: ({ row }) => { const isDisabled = row.original.isPublish; + const [open, setOpen] = useState(false); + + const handleClick = (e: React.MouseEvent) => { + if (e.ctrlKey) { + console.log("Ctrl + Click detected"); + } + // Paksa buka menu meskipun ctrl ditekan + setOpen(true); + }; + return ( - +