From 8e049a1ac974e219edb54f6465767da012613bd7 Mon Sep 17 00:00:00 2001 From: sabdayagra Date: Thu, 12 Dec 2024 22:27:00 +0700 Subject: [PATCH] connect api to indeks and Konten --- app/[locale]/(public)/audio/filter/page.tsx | 33 ++-- app/[locale]/(public)/audio/layout.tsx | 2 +- app/[locale]/(public)/contact/layout.tsx | 2 +- .../(public)/document/filter/page.tsx | 22 ++- app/[locale]/(public)/document/layout.tsx | 2 +- app/[locale]/(public)/faqs/layout.tsx | 2 +- app/[locale]/(public)/feedback/layout.tsx | 2 +- app/[locale]/(public)/image/filter/page.tsx | 98 +++++++--- app/[locale]/(public)/image/layout.tsx | 2 +- app/[locale]/(public)/indeks/layout.tsx | 2 +- app/[locale]/(public)/indeks/page.tsx | 169 ++++++++---------- app/[locale]/(public)/schedule/layout.tsx | 2 +- app/[locale]/(public)/video/filter/page.tsx | 33 ++-- app/[locale]/(public)/video/layout.tsx | 2 +- app/[locale]/page.tsx | 2 +- components/landing-page/Hero.tsx | 3 - components/landing-page/new-content.tsx | 2 +- service/landing/landing.ts | 10 +- 18 files changed, 225 insertions(+), 165 deletions(-) diff --git a/app/[locale]/(public)/audio/filter/page.tsx b/app/[locale]/(public)/audio/filter/page.tsx index 7031681b..29121fb7 100644 --- a/app/[locale]/(public)/audio/filter/page.tsx +++ b/app/[locale]/(public)/audio/filter/page.tsx @@ -1,17 +1,10 @@ "use client"; -import React, { useState } from "react"; +import React, { useEffect, useState } from "react"; import { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious } from "@/components/ui/pagination"; import { Checkbox } from "@/components/ui/checkbox"; import { Icon } from "@iconify/react/dist/iconify.js"; - -const dummyDescription = [ - { id: 1, title: "Kapolres Batam Berikan pengarahan pagi kepada para anggota dan staf yang terkait", date: "28 November 2024", time: "11.15 WIB", duration: "00:24:55" }, - { id: 2, title: "Kapolres Lahat Himbau Cipta Kondisi Cooling System Pasca Pemungutan Suara Pilkada 2024", date: "28 November 2024", time: "11.15 WIB", duration: "00:24:55" }, - { id: 3, title: "17 Ton Pupuk Bersubsidi yang Akan Diselewengkan ke Banyuasin Berhasil Digagalkan", date: "28 November 2024", time: "11.15 WIB", duration: "00:24:55" }, - { id: 4, title: "Kapolda Sumsel Apelkan 1471 Personel Persiapan Pengamanan Pengawalan Tahan Pungut dan Hitung Suara", date: "28 November 2024", time: "11.15 WIB", duration: "00:24:55" }, - { id: 5, title: "Polrestabes Palembang Berhasil Mengungkap Kasus Penganiayaan Berat di Ilir Barat II", date: "28 November 2024", time: "11.15 WIB", duration: "00:24:55" }, - { id: 6, title: "Tahapan Pilkada di Sumsel Berlangsung Kondusif", date: "28 November 2024", time: "11.15 WIB", duration: "00:24:55" }, -]; +import { getListContent } from "@/service/landing/landing"; +import { formatDateToIndonesian } from "@/utils/globals"; const categories = [ { id: 1, title: "HUT HUMAS KE - 73" }, @@ -33,6 +26,16 @@ const formatAudio = [ ]; const FilterPage = () => { + const [audioData, setAudioData] = useState(); + const [page, setPage] = useState(1); + useEffect(() => { + initFetch(); + }, []); + const initFetch = async () => { + const response = await getListContent({ page: page - 1, size: 12, sortBy: "createdAt", contentTypeId: "4" }); + console.log(response); + setAudioData(response?.data?.data?.content); + }; return (
{/* Header */} @@ -118,8 +121,8 @@ const FilterPage = () => {
{/* Card */}
- {dummyDescription.map((description) => ( - + {audioData?.map((audio: any) => ( +
{
- {description.date} | 518 + {formatDateToIndonesian(new Date(audio?.createdAt))} {audio?.timezone ? audio?.timezone : "WIB"} | 518
-
{description.title}
+
{audio?.title}
@@ -141,7 +144,7 @@ const FilterPage = () => {
# -
{description.duration}
+
{audio?.duration}
diff --git a/app/[locale]/(public)/audio/layout.tsx b/app/[locale]/(public)/audio/layout.tsx index 2cb8c934..b9f5668d 100644 --- a/app/[locale]/(public)/audio/layout.tsx +++ b/app/[locale]/(public)/audio/layout.tsx @@ -7,7 +7,7 @@ import DashCodeHeader from "@/components/partials/header"; import { auth } from "@/lib/auth"; import { redirect } from "@/components/navigation"; import Footer from "@/components/landing-page/footer"; -import Navbar from "@/components/landing-page/navbar"; +import Navbar from "@/components/landing-page/Navbar"; const layout = async ({ children }: { children: React.ReactNode }) => { return ( diff --git a/app/[locale]/(public)/contact/layout.tsx b/app/[locale]/(public)/contact/layout.tsx index 5eca8060..8dd8e8f6 100644 --- a/app/[locale]/(public)/contact/layout.tsx +++ b/app/[locale]/(public)/contact/layout.tsx @@ -6,7 +6,7 @@ import ThemeCustomize from "@/components/partials/customizer"; import DashCodeHeader from "@/components/partials/header"; import { auth } from "@/lib/auth"; import { redirect } from "@/components/navigation"; -import Navbar from "@/components/landing-page/navbar"; +import Navbar from "@/components/landing-page/Navbar"; import Footer from "@/components/landing-page/footer"; const layout = async ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(public)/document/filter/page.tsx b/app/[locale]/(public)/document/filter/page.tsx index 8af5ce0b..e7277763 100644 --- a/app/[locale]/(public)/document/filter/page.tsx +++ b/app/[locale]/(public)/document/filter/page.tsx @@ -1,8 +1,10 @@ "use client"; -import React, { useState } from "react"; +import React, { useEffect, useState } from "react"; import { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious } from "@/components/ui/pagination"; import { Checkbox } from "@/components/ui/checkbox"; import { Icon } from "@iconify/react/dist/iconify.js"; +import { getListContent } from "@/service/landing/landing"; +import { formatDateToIndonesian } from "@/utils/globals"; const dummyDescription = [ { id: 1, title: "Kapolres Batam Berikan pengarahan pagi kepada para anggota dan staf yang terkait", date: "28 November 2024", time: "11.15 WIB", duration: "00:24:55" }, @@ -44,6 +46,16 @@ const formatAudio = [ ]; const DocumentPage = () => { + const [documentData, setDocumentData] = useState(); + const [page, setPage] = useState(1); + useEffect(() => { + initFetch(); + }, []); + const initFetch = async () => { + const response = await getListContent({ page: page - 1, size: 12, sortBy: "createdAt", contentTypeId: "3" }); + console.log(response); + setDocumentData(response?.data?.data?.content); + }; return (
{/* Header */} @@ -130,8 +142,8 @@ const DocumentPage = () => { {/* Card */}
- {dummyDescription.map((description) => ( - + {documentData?.map((document: any) => ( +
{
- {description.date} | 518 + {formatDateToIndonesian(new Date(document?.createdAt))} {document?.timezone ? document?.timezone : "WIB"} | 518
-
{description.title}
+
{document?.title}
diff --git a/app/[locale]/(public)/document/layout.tsx b/app/[locale]/(public)/document/layout.tsx index 2cb8c934..b9f5668d 100644 --- a/app/[locale]/(public)/document/layout.tsx +++ b/app/[locale]/(public)/document/layout.tsx @@ -7,7 +7,7 @@ import DashCodeHeader from "@/components/partials/header"; import { auth } from "@/lib/auth"; import { redirect } from "@/components/navigation"; import Footer from "@/components/landing-page/footer"; -import Navbar from "@/components/landing-page/navbar"; +import Navbar from "@/components/landing-page/Navbar"; const layout = async ({ children }: { children: React.ReactNode }) => { return ( diff --git a/app/[locale]/(public)/faqs/layout.tsx b/app/[locale]/(public)/faqs/layout.tsx index 5eca8060..8dd8e8f6 100644 --- a/app/[locale]/(public)/faqs/layout.tsx +++ b/app/[locale]/(public)/faqs/layout.tsx @@ -6,7 +6,7 @@ import ThemeCustomize from "@/components/partials/customizer"; import DashCodeHeader from "@/components/partials/header"; import { auth } from "@/lib/auth"; import { redirect } from "@/components/navigation"; -import Navbar from "@/components/landing-page/navbar"; +import Navbar from "@/components/landing-page/Navbar"; import Footer from "@/components/landing-page/footer"; const layout = async ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(public)/feedback/layout.tsx b/app/[locale]/(public)/feedback/layout.tsx index 5eca8060..8dd8e8f6 100644 --- a/app/[locale]/(public)/feedback/layout.tsx +++ b/app/[locale]/(public)/feedback/layout.tsx @@ -6,7 +6,7 @@ import ThemeCustomize from "@/components/partials/customizer"; import DashCodeHeader from "@/components/partials/header"; import { auth } from "@/lib/auth"; import { redirect } from "@/components/navigation"; -import Navbar from "@/components/landing-page/navbar"; +import Navbar from "@/components/landing-page/Navbar"; import Footer from "@/components/landing-page/footer"; const layout = async ({ children }: { children: React.ReactNode }) => { diff --git a/app/[locale]/(public)/image/filter/page.tsx b/app/[locale]/(public)/image/filter/page.tsx index 535ab989..4a5f7774 100644 --- a/app/[locale]/(public)/image/filter/page.tsx +++ b/app/[locale]/(public)/image/filter/page.tsx @@ -1,22 +1,22 @@ "use client"; -import React, { useState } from "react"; +import React, { useEffect, useState } from "react"; import { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious } from "@/components/ui/pagination"; import { Card, CardContent } from "@/components/ui/card"; import { Checkbox } from "@/components/ui/checkbox"; import { Icon } from "@iconify/react/dist/iconify.js"; -import { generateLocalizedPath } from "@/utils/globals"; +import { formatDateToIndonesian, generateLocalizedPath } from "@/utils/globals"; import { useParams, usePathname, useRouter } from "next/navigation"; +import { getListContent } from "@/service/landing/landing"; +import { ColumnDef, ColumnFiltersState, PaginationState, SortingState, VisibilityState, flexRender, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table"; +import TablePagination from "@/components/table/table-pagination"; +import { Response } from "@dnd-kit/core/dist/sensors/types"; -const dummyImage = [ - { id: 1, thumbnail: "/assets/banner-sample.png", date: "17 MEI 2024", title: "Kapolres Batam Berikan pengarahan pagi kepada para anggota dan staf yang terkait", time: "18.00 WIB" }, - { id: 2, thumbnail: "/assets/banner-sample.png", date: "17 MEI 2024", title: "Kapolres Batam Berikan pengarahan pagi kepada para anggota dan staf yang terkait", time: "18.00 WIB" }, - { id: 3, thumbnail: "/assets/banner-sample.png", date: "17 MEI 2024", title: "Kapolres Batam Berikan pengarahan pagi kepada para anggota dan staf yang terkait", time: "18.00 WIB" }, - { id: 4, thumbnail: "/assets/banner-sample.png", date: "17 MEI 2024", title: "Kapolres Batam Berikan pengarahan pagi kepada para anggota dan staf yang terkait", time: "18.00 WIB" }, - { id: 5, thumbnail: "/assets/banner-sample.png", date: "17 MEI 2024", title: "Kapolres Batam Berikan pengarahan pagi kepada para anggota dan staf yang terkait", time: "18.00 WIB" }, - { id: 6, thumbnail: "/assets/banner-sample.png", date: "17 MEI 2024", title: "Kapolres Batam Berikan pengarahan pagi kepada para anggota dan staf yang terkait", time: "18.00 WIB" }, - { id: 7, thumbnail: "/assets/banner-sample.png", date: "17 MEI 2024", title: "Kapolres Batam Berikan pengarahan pagi kepada para anggota dan staf yang terkait", time: "18.00 WIB" }, - { id: 8, thumbnail: "/assets/banner-sample.png", date: "17 MEI 2024", title: "Kapolres Batam Berikan pengarahan pagi kepada para anggota dan staf yang terkait", time: "18.00 WIB" }, - { id: 9, thumbnail: "/assets/banner-sample.png", date: "17 MEI 2024", title: "Kapolres Batam Berikan pengarahan pagi kepada para anggota dan staf yang terkait", time: "18.00 WIB" }, +const columns: ColumnDef[] = [ + { + accessorKey: "no", + header: "No", + cell: ({ row }) => {row.getValue("no")}, + }, ]; const categories = [ @@ -43,6 +43,54 @@ const FilterPage = () => { const pathname = usePathname(); const params = useParams(); const locale = params?.locale; + const [totalData, setTotalData] = React.useState(1); + const [totalPage, setTotalPage] = useState(1); + const [dataTable, setDataTable] = React.useState([]); + const [sorting, setSorting] = React.useState([]); + const [columnFilters, setColumnFilters] = React.useState([]); + const [columnVisibility, setColumnVisibility] = React.useState({}); + const [rowSelection, setRowSelection] = React.useState({}); + const [pagination, setPagination] = React.useState({ + pageIndex: 0, + pageSize: 10, + }); + const [imageData, setImageData] = useState(); + const [page, setPage] = useState(1); + useEffect(() => { + initFetch(); + }, []); + const initFetch = async () => { + const response = await getListContent({ page: page - 1, size: 6, sortBy: "createdAt", contentTypeId: "1" }); + console.log(response); + + const data = response.data?.data; + const contentData = data?.content; + contentData.forEach((item: any, index: number) => { + item.no = (page - 1) * 6 + index + 1; + }); + setImageData(contentData); + }; + const table = useReactTable({ + data: imageData, + columns: columns, + onSortingChange: setSorting, + onColumnFiltersChange: setColumnFilters, + getCoreRowModel: getCoreRowModel(), + getPaginationRowModel: getPaginationRowModel(), + getSortedRowModel: getSortedRowModel(), + getFilteredRowModel: getFilteredRowModel(), + onColumnVisibilityChange: setColumnVisibility, + onRowSelectionChange: setRowSelection, + onPaginationChange: setPagination, + state: { + sorting, + columnFilters, + columnVisibility, + rowSelection, + pagination, + }, + }); + console.log("table", table); return (
@@ -50,18 +98,16 @@ const FilterPage = () => {

{" "} - Foto {">"} Semua Foto + Audio Visual {">"} Semua Audio Visual

|

-

Terdapat 32499 artikel berisi Foto yang dapat diunduh

+

Terdapat 324911 artikel berisi Audio Visual yang dapat diunduh

{/* Left */}
- {/* Sidebar Kiri */}

Filter

- {/* Pencarian */}
- {/* Tahun & Bulan */}
- {/* Tanggal */}
- {/* Kategori */}

Kategori

    @@ -124,22 +167,23 @@ const FilterPage = () => {

    Urutkan berdasarkan

- {dummyImage.map((image) => ( - - router.push(generateLocalizedPath(`/image/detail/${image.id}`, String(locale)))} className="flex flex-col text-xs lg:text-sm p-0"> - -
- {image.date} {image.time} | 518{" "} + {imageData?.map((image: any) => ( + + + +
+ {formatDateToIndonesian(new Date(image?.createdAt))} {image?.timezone ? image?.timezone : "WIB"}| + {image?.clickCount}{" "} {" "}
-
{image.title}
+
{image?.title}
))} diff --git a/app/[locale]/(public)/image/layout.tsx b/app/[locale]/(public)/image/layout.tsx index 2cb8c934..b9f5668d 100644 --- a/app/[locale]/(public)/image/layout.tsx +++ b/app/[locale]/(public)/image/layout.tsx @@ -7,7 +7,7 @@ import DashCodeHeader from "@/components/partials/header"; import { auth } from "@/lib/auth"; import { redirect } from "@/components/navigation"; import Footer from "@/components/landing-page/footer"; -import Navbar from "@/components/landing-page/navbar"; +import Navbar from "@/components/landing-page/Navbar"; const layout = async ({ children }: { children: React.ReactNode }) => { return ( diff --git a/app/[locale]/(public)/indeks/layout.tsx b/app/[locale]/(public)/indeks/layout.tsx index 2cb8c934..b9f5668d 100644 --- a/app/[locale]/(public)/indeks/layout.tsx +++ b/app/[locale]/(public)/indeks/layout.tsx @@ -7,7 +7,7 @@ import DashCodeHeader from "@/components/partials/header"; import { auth } from "@/lib/auth"; import { redirect } from "@/components/navigation"; import Footer from "@/components/landing-page/footer"; -import Navbar from "@/components/landing-page/navbar"; +import Navbar from "@/components/landing-page/Navbar"; const layout = async ({ children }: { children: React.ReactNode }) => { return ( diff --git a/app/[locale]/(public)/indeks/page.tsx b/app/[locale]/(public)/indeks/page.tsx index 8543e2a3..f1f2854f 100644 --- a/app/[locale]/(public)/indeks/page.tsx +++ b/app/[locale]/(public)/indeks/page.tsx @@ -1,107 +1,96 @@ "use client"; +import { getIndeksData } from "@/service/landing/landing"; +import { formatDateToIndonesian } from "@/utils/globals"; import Link from "next/link"; import { usePathname } from "next/navigation"; -import React from "react"; +import React, { useEffect, useState } from "react"; -interface ImageCardProps { - imageUrl: string; - label: string; - title: string; - date: string; -} - -const ImageCard: React.FC = ({ imageUrl, label, title, date }) => { - return ( -
- {title} -
- {label} -

{title}

- {date} -
-
- ); -}; - -const ImageGallery: React.FC = () => { +const Indeks: React.FC = () => { const pathname = usePathname(); - - const images = [ - { - imageUrl: "/assets/banner-sample.png", - label: "Giat Pimpinan", - title: "Foto Kapolri Dorong Transformasi Polri Presisi", - date: "2024-11-12 10:09:20 WIB", - }, - { - imageUrl: "/assets/hot-topik-1.jpg", - label: "Giat Polri", - title: "Foto Kapolri Tinjau Pengungsi Gunung", - date: "2024-11-19 09:35:27 WIB", - }, - { - imageUrl: "/assets/hot-topik-2.jpg", - label: "Giat Polri", - title: "Foto Kapolri dalam Acara Bersama TNI", - date: "2024-11-20 15:45:00 WIB", - }, - ]; - - const imageBottom = [ - { - id: 1, - imageUrl: "/assets/hot-topik-1.jpg", - title: "Foto Kakorlantas Polri Tekankan Intervensi", - description: - "Kepala Korps Lalu Lintas (Kakorlantas) Polri Irjen. Pol. Dr. Drs. Aan Suhanan, M.Si. memimpin apel pagi di NTMC pada Senin (2/12/2024) dan menekankan pentingnya pengelolaan ekstra dalam pengamanan Natal dan Tahun Baru 2024.", - }, - { - id: 2, - imageUrl: "/assets/hot-topik-1.jpg", - title: "Foto Kakorlantas Tinjau Jalur Tol, Jalur Wisata", - description: "Kakorlantas Polri Irjen.Pol. Dr. Drs. Aan Suhanan, M.Si. memimpin survei jalur tol dari Cikopo, Purwakarta hingga Kalikangkung, Jawa Tengah, untuk persiapan Operasi Lilin 2024.", - }, - { - id: 3, - imageUrl: "/assets/hot-topik-2.jpg", - title: "Foto Kapolri Pastikan Kesiapan Polri Kawal Pilkada", - description: "Kapolri Jenderal Polisi Drs. Listyo Sigit Prabowo, M.Si menegaskan kesiapan Polri dalam mengawal Pilkada Serentak 2024 yang digelar Rabu, 27 November 2024.", - }, - ]; + const [indeksData, setIndeksData] = useState(); + useEffect(() => { + initFetch(); + }, []); + const initFetch = async () => { + const response = await getIndeksData(); + console.log(response); + setIndeksData(response?.data?.data?.content); + }; return ( - <> - {/* Hero */} -
-
- -
-
- - -
-
- {/* Bottom */} -
-
- {imageBottom.map((image) => ( -
-
- -
-
- - {image.title} +
+ {/* Hero Left */} +
+
+ {indeksData?.map((indeks: any) => ( +
+ image +
+ {indeks?.categoryName} + +

{indeks?.title}

-

{image.description}

+

+ {formatDateToIndonesian(new Date(indeks?.createdAt))} {indeks?.timezone ? indeks?.timezone : "WIB"}|{" "} + + + {" "} + {indeks?.clickCount} +

))}
+ + {/* Hero Right */} + {/*
+ {indeksData?.map((indeksRight: any) => ( +
+ image +
+ {indeksRight?.categoryName} + +

{indeksRight?.title}

+ +

+ {formatDateToIndonesian(new Date(indeksRight?.createdAt))} {indeksRight?.timezone ? indeksRight?.timezone : "WIB"}|{" "} + + + {" "} + {indeksRight?.clickCount} +

+
+
+ ))} +
*/}
- + + {/* Bottom */} + {/*
+
+ {indeksData?.map((indeksBottom: any) => ( +
+ +
+

{indeksBottom?.date}

+ + {indeksBottom?.title} + +

{indeksBottom?.description}

+
+
+ ))} +
+
*/} +
); }; -export default ImageGallery; +export default Indeks; diff --git a/app/[locale]/(public)/schedule/layout.tsx b/app/[locale]/(public)/schedule/layout.tsx index 2cb8c934..b9f5668d 100644 --- a/app/[locale]/(public)/schedule/layout.tsx +++ b/app/[locale]/(public)/schedule/layout.tsx @@ -7,7 +7,7 @@ import DashCodeHeader from "@/components/partials/header"; import { auth } from "@/lib/auth"; import { redirect } from "@/components/navigation"; import Footer from "@/components/landing-page/footer"; -import Navbar from "@/components/landing-page/navbar"; +import Navbar from "@/components/landing-page/Navbar"; const layout = async ({ children }: { children: React.ReactNode }) => { return ( diff --git a/app/[locale]/(public)/video/filter/page.tsx b/app/[locale]/(public)/video/filter/page.tsx index 2436984f..36f5b145 100644 --- a/app/[locale]/(public)/video/filter/page.tsx +++ b/app/[locale]/(public)/video/filter/page.tsx @@ -1,9 +1,11 @@ "use client"; -import React, { useState } from "react"; +import React, { useEffect, useState } from "react"; import { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious } from "@/components/ui/pagination"; import { Card, CardContent } from "@/components/ui/card"; import { Checkbox } from "@/components/ui/checkbox"; import { Icon } from "@iconify/react/dist/iconify.js"; +import { getListContent, getVideoData } from "@/service/landing/landing"; +import { formatDateToIndonesian } from "@/utils/globals"; const dummyImage = [ { id: 1, thumbnail: "/assets/banner-sample.png", date: "17 MEI 2024", title: "Kapolres Batam Berikan pengarahan pagi kepada para anggota dan staf yang terkait", time: "18.00 WIB" }, @@ -39,6 +41,17 @@ const formatPicture = [ ]; const FilterPage = () => { + const [videoData, setVideoData] = useState(); + const [page, setPage] = useState(1); + useEffect(() => { + initFetch(); + }, []); + const initFetch = async () => { + const response = await getListContent({page: page-1, size: 12, sortBy: "createdAt", contentTypeId: "2", }); + console.log(response); + setVideoData(response?.data?.data?.content); + }; + return (
{/* Header */} @@ -48,15 +61,13 @@ const FilterPage = () => { Audio Visual {">"} Semua Audio Visual

|

-

Terdapat 32499 artikel berisi Audio Visual yang dapat diunduh

+

Terdapat 324911 artikel berisi Audio Visual yang dapat diunduh

{/* Left */}
-

Filter

-
-
-
-

Kategori

    @@ -124,17 +132,18 @@ const FilterPage = () => {
- {dummyImage.map((image) => ( - + {videoData?.map((video: any) => ( + - +
- {image.date} {image.time} | 518{" "} + {formatDateToIndonesian(new Date(video?.createdAt))} {video?.timezone ? video?.timezone : "WIB"}| + {video?.clickCount}{" "} {" "}
-
{image.title}
+
{video?.title}
))} diff --git a/app/[locale]/(public)/video/layout.tsx b/app/[locale]/(public)/video/layout.tsx index 2cb8c934..b9f5668d 100644 --- a/app/[locale]/(public)/video/layout.tsx +++ b/app/[locale]/(public)/video/layout.tsx @@ -7,7 +7,7 @@ import DashCodeHeader from "@/components/partials/header"; import { auth } from "@/lib/auth"; import { redirect } from "@/components/navigation"; import Footer from "@/components/landing-page/footer"; -import Navbar from "@/components/landing-page/navbar"; +import Navbar from "@/components/landing-page/Navbar"; const layout = async ({ children }: { children: React.ReactNode }) => { return ( diff --git a/app/[locale]/page.tsx b/app/[locale]/page.tsx index 1e479373..4adf2105 100644 --- a/app/[locale]/page.tsx +++ b/app/[locale]/page.tsx @@ -8,7 +8,7 @@ import Coverage from "@/components/landing-page/coverage"; import Hero from "@/components/landing-page/hero"; import Footer from "@/components/landing-page/footer"; import Division from "@/components/landing-page/division"; -import Navbar from "@/components/landing-page/navbar"; +import Navbar from "@/components/landing-page/Navbar"; const Home = ({ params: { locale } }: { params: { locale: string } }) => { return ( diff --git a/components/landing-page/Hero.tsx b/components/landing-page/Hero.tsx index 5de0e3a4..67bef1eb 100644 --- a/components/landing-page/Hero.tsx +++ b/components/landing-page/Hero.tsx @@ -6,8 +6,6 @@ import "swiper/css/navigation"; import { getHeroData } from "@/service/landing/landing"; import Link from "next/link"; import { useParams, usePathname, useRouter } from "next/navigation"; -import { Navigation, Pagination } from "swiper/modules"; -import { Card, CardContent } from "@/components/ui/card"; import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "@/components/ui/carousel"; const Hero: React.FC = () => { @@ -28,7 +26,6 @@ const Hero: React.FC = () => { return (
{/* Section Gambar Utama */} - {heroData?.map((list: any) => ( diff --git a/components/landing-page/new-content.tsx b/components/landing-page/new-content.tsx index 299f955d..5bcfa6a6 100644 --- a/components/landing-page/new-content.tsx +++ b/components/landing-page/new-content.tsx @@ -20,7 +20,7 @@ const NewContent = (props: { type: string }) => { initFetch(); }, [selectedTab]); const initFetch = async () => { - const request = { sortBy: props.type == "popular" ? "clickCount" : "createdAt", contentTypeId: selectedTab == "image" ? "1" : selectedTab == "video" ? "2" : selectedTab == "text" ? "3" : selectedTab == "audio" ? "4" : "" }; + const request = {page: 0, size: 5, sortBy: props.type == "popular" ? "clickCount" : "createdAt", contentTypeId: selectedTab == "image" ? "1" : selectedTab == "video" ? "2" : selectedTab == "text" ? "3" : selectedTab == "audio" ? "4" : "" }; const response = await getListContent(request); console.log("category", response); setNewContent(response?.data?.data?.content); diff --git a/service/landing/landing.ts b/service/landing/landing.ts index 32437893..2456d914 100644 --- a/service/landing/landing.ts +++ b/service/landing/landing.ts @@ -8,10 +8,16 @@ export async function getCategoryData() { return await httpGetInterceptor(`media/categories/list/publish?enablePage=1&sort=desc&sortBy=updatedAt&size=12&type=`); } -export async function getListContent(data: { sortBy: string; contentTypeId: string }) { - return await httpGetInterceptor(`media/public/list?enablePage=1&sort=desc&sortBy=${data.sortBy}&size=5&page=0&typeId=${data.contentTypeId}&title=&categoryId=&fileFormats=&tags=&group=&startDate=&endDate=&month=&year=`); +export async function getListContent(data: { sortBy: string; contentTypeId: string; size: number; page: number }) { + return await httpGetInterceptor( + `media/public/list?enablePage=1&sort=desc&sortBy=${data.sortBy}&size=${data.size}&page=${data.page}&typeId=${data.contentTypeId}&title=&categoryId=&fileFormats=&tags=&group=&startDate=&endDate=&month=&year=` + ); } export async function getPrivacy() { return await httpGetInterceptor(`general/privacy-policy/1`); } + +export async function getIndeksData() { + return await httpGetInterceptor(`blog/public/pagination?enablePage=1&page=0&size=20`); +}