diff --git a/app/[locale]/(protected)/admin/settings/banner/component/banner-column.tsx b/app/[locale]/(protected)/admin/settings/banner/component/banner-column.tsx index d17bdc2f..899f2124 100644 --- a/app/[locale]/(protected)/admin/settings/banner/component/banner-column.tsx +++ b/app/[locale]/(protected)/admin/settings/banner/component/banner-column.tsx @@ -59,12 +59,12 @@ const columns: ColumnDef[] = [ ), }, { - accessorKey: "static", + accessorKey: "isStaticBanner", header: "Static Banner", cell: ({ row }) => ( ), }, diff --git a/app/[locale]/(protected)/admin/settings/banner/component/banner-table.tsx b/app/[locale]/(protected)/admin/settings/banner/component/banner-table.tsx index b0fedb12..d6d4ef40 100644 --- a/app/[locale]/(protected)/admin/settings/banner/component/banner-table.tsx +++ b/app/[locale]/(protected)/admin/settings/banner/component/banner-table.tsx @@ -96,22 +96,9 @@ const BannerListTable = () => { let temp: any; const response = await listBanner(); - temp = response?.data?.data; - const response2 = await listStaticBanner(); - console.log("sadadddd", response2?.data?.data.length); - for (let i = 0; i < response2?.data?.data.length; i++) { - for (let j = 0; j < temp.length; j++) { - console.log("temp", j, temp[j].id); - if (response2?.data?.data[i].mediaUploadId === temp[j].id) { - temp[j].staticPage = true; - } else { - temp[j].staticPage = false; - } - } - } - - console.log("tesmasdasdasdasd", temp); - setGetData(temp); + const data = response?.data?.data?.content; + console.log("banner", data); + setGetData(data); close(); } diff --git a/app/[locale]/(protected)/admin/settings/category/component/column.tsx b/app/[locale]/(protected)/admin/settings/category/component/column.tsx index 078b9248..7f41bda2 100644 --- a/app/[locale]/(protected)/admin/settings/category/component/column.tsx +++ b/app/[locale]/(protected)/admin/settings/category/component/column.tsx @@ -45,19 +45,17 @@ const columns: ColumnDef[] = [ ), }, { - accessorKey: "contentType", + accessorKey: "mediaTypesString", header: "Tipe Konten", cell: ({ row }) => ( - {row.getValue("contentType")} + {row.getValue("mediaTypesString")} ), }, { - accessorKey: "isInternational", + accessorKey: "publishedLocation", header: "Wilayah", cell: ({ row }) => ( - - {row.getValue("isInternational") ? "INT" : "ID"} - + {row.getValue("publishedLocation")} ), }, { diff --git a/app/[locale]/page.tsx b/app/[locale]/page.tsx index 7c19dc06..ca11da46 100644 --- a/app/[locale]/page.tsx +++ b/app/[locale]/page.tsx @@ -20,7 +20,7 @@ const Home = ({ params: { locale } }: { params: { locale: string } }) => {
- + diff --git a/components/landing-page/content-category.tsx b/components/landing-page/content-category.tsx index f8c93938..05386094 100644 --- a/components/landing-page/content-category.tsx +++ b/components/landing-page/content-category.tsx @@ -1,11 +1,20 @@ -import { getCategoryData, getPublicCategoryData } from "@/service/landing/landing"; +import { + getCategoryData, + getPublicCategoryData, +} from "@/service/landing/landing"; import React, { useEffect, useState } from "react"; import { Reveal } from "./Reveal"; import { useTranslations } from "next-intl"; import { usePathname } from "next/navigation"; import { useParams } from "next/navigation"; import Image from "next/image"; -import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "../ui/carousel"; +import { + Carousel, + CarouselContent, + CarouselItem, + CarouselNext, + CarouselPrevious, +} from "../ui/carousel"; import { useRouter } from "@/i18n/routing"; import { Button } from "../ui/button"; @@ -19,14 +28,26 @@ const ContentCategory = (props: { group?: string; type: string }) => { const satkerName = params?.satker_name; const router = useRouter(); - let prefixPath = poldaName ? `/polda/${poldaName}` : satkerName ? `/satker/${satkerName}` : "/"; + let prefixPath = poldaName + ? `/polda/${poldaName}` + : satkerName + ? `/satker/${satkerName}` + : "/"; 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 : "", + 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 ); @@ -52,7 +73,10 @@ const ContentCategory = (props: { group?: string; type: string }) => { `; - const toBase64 = (str: string) => (typeof window === "undefined" ? Buffer.from(str).toString("base64") : window.btoa(str)); + const toBase64 = (str: string) => + typeof window === "undefined" + ? Buffer.from(str).toString("base64") + : window.btoa(str); return (
@@ -60,12 +84,16 @@ const ContentCategory = (props: { group?: string; type: string }) => {

{pathname?.split("/")[1] == "in" ? ( <> - {t("category")}  + + {t("category")}  + {t("content")} ) : ( <> - {t("content")}  + + {t("content")}  + {t("category")} )} @@ -73,35 +101,51 @@ const ContentCategory = (props: { group?: string; type: string }) => {
- {(seeAllValue ? categories : categories?.slice(0, 4 ))?.map((category: any) => ( -
-
router.push(`${prefixPath}all/filter?category=${category?.id}`)} className="cursor-pointer relative group rounded-md overflow-hidden shadow-md hover:shadow-lg block"> - {/* Gambar */} - category + {(seeAllValue ? categories : categories?.slice(0, 4))?.map( + (category: any) => ( +
+
+ router.push( + `${prefixPath}all/filter?category=${category?.id}` + ) + } + className="cursor-pointer relative group rounded-md overflow-hidden shadow-md hover:shadow-lg block" + > + {/* Gambar */} + category - {/* Overlay gelap */} -
+ {/* Overlay gelap */} +
- {/* Judul */} -
-

{category?.name}

+ {/* Judul */} +
+

+ {category?.name} +

+
-
- ))} + ) + )}
{/* Tombol See More / See Less */} - {categories?.length > 8 && ( + {categories?.length > 10 && (
-
diff --git a/components/landing-page/hero.tsx b/components/landing-page/hero.tsx index 6ba7ae16..b1b7d48c 100644 --- a/components/landing-page/hero.tsx +++ b/components/landing-page/hero.tsx @@ -2,7 +2,7 @@ import { formatDateToIndonesian, shimmer, toBase64 } from "@/utils/globals"; import React, { useEffect, useState } from "react"; import "swiper/css/bundle"; import "swiper/css/navigation"; -import { getHeroData } from "@/service/landing/landing"; +import { getHeroData, listStaticBanner } from "@/service/landing/landing"; import Link from "next/link"; import { useParams, usePathname, useRouter } from "next/navigation"; import { @@ -190,16 +190,19 @@ const SurveyIntroModal = ({ onNext }: { onNext: () => void }) => { const ONE_MONTH = 30 * 24 * 60 * 60 * 1000; -const Hero: React.FC = () => { +const Hero = (props: { group?: string }) => { const router = useRouter(); const pathname = usePathname(); const params = useParams(); const locale = params?.locale; const [isLoading, setIsLoading] = useState(true); const [heroData, setHeroData] = useState(); + const [content, setContent] = useState(); const [showModal, setShowModal] = useState(false); const [showSurveyModal, setShowSurveyModal] = useState(false); const [showFormModal, setShowFormModal] = useState(false); + const poldaName = params?.polda_name; + const satkerName = params?.satker_name; useEffect(() => { const timer = setTimeout(() => { @@ -274,7 +277,28 @@ const Hero: React.FC = () => { const initFetch = async () => { const response = await getHeroData(); console.log(response); + let data = response?.data?.data?.content; setHeroData(response?.data?.data?.content); + if (data) { + const resStatic = await listStaticBanner( + props.group == "mabes" + ? "" + : props.group == "polda" && poldaName && String(poldaName)?.length > 1 + ? poldaName + : props.group == "satker" && + satkerName && + String(satkerName)?.length > 1 + ? "satker-" + satkerName + : "" + ); + for (let i = 0; i < resStatic?.data?.data?.length; i++) { + const media = resStatic?.data.data[i]?.mediaUpload; + media.fileTypeId = media.fileType?.id; + data = data.filter((item: any) => item.id != media.id); + data.splice(0, 0, media); + } + setContent(data); + } }; const shimmer = (w: number, h: number) => ` @@ -322,7 +346,7 @@ const Hero: React.FC = () => { ) : ( - {heroData?.map((list: any) => ( + {content?.map((list: any) => (