import { getCategoryData, getPublicCategoryData } from "@/service/landing/landing"; import Link from "next/link"; import React, { useEffect, useState } from "react"; import { useTranslations } from "next-intl"; import { usePathname } from "next/navigation"; import { useParams } from "next/navigation"; import Image from "next/image"; import { Reveal } from "../Reveal"; import { Button } from "@/components/ui/button"; const ContentCategory = (props: { group?: string }) => { const [categories, setCategories] = useState(); const t = useTranslations("LandingPage"); const params = useParams(); const locale = params?.locale; const poldaName = params?.polda_name; const satkerName = params?.satker_name; const [searchTerm, setSearchTerm] = useState(""); const [seeAllValue, setSeeAllValue] = useState(false); const pathname = usePathname(); useEffect(() => { initFetch(); }, []); const initFetch = async () => { const response = await getPublicCategoryData( props.group == "mabes" ? "" : props.group == "polda" && poldaName && String(poldaName)?.length > 1 ? poldaName : props.group == "satker" && satkerName && String(satkerName)?.length > 1 ? "satker-" + satkerName : "", "", locale == "en" ? true : false ); console.log("category", response); setCategories(response?.data?.data?.content); }; const shimmer = (w: number, h: number) => ` `; const toBase64 = (str: string) => (typeof window === "undefined" ? Buffer.from(str).toString("base64") : window.btoa(str)); return (

{pathname?.split("/")[1] == "in" ? ( <> {t("category")}  {t("content")} ) : ( <> {t("content")}  {t("category")} )}

{categories?.map((category: any, index: number) => !seeAllValue ? ( index < 4 ? ( category

{category?.name}

) : ( "" ) ) : ( category

{category?.name}

) )}
); }; export default ContentCategory;