"use client"; import { Link } from "@/i18n/routing"; import { getInfoProfile, getListPorvinces, getUsersTeams } from "@/service/landing/landing"; import { Icon } from "@iconify/react/dist/iconify.js"; import React, { useEffect, useState } from "react"; import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "@/components/ui/carousel"; import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { formatDateToIndonesian } from "@/utils/globals"; import { useParams } from "next/navigation"; import { Card, CardContent } from "@/components/ui/card"; const dummyContent = [ { title: "Operasi Zebra Nataru", thumbnail: "/assets/img-header-blog.png", createdAt: "17 Agustus 2025", timezone: "14:20 WIB", clickCount: "28" }, { title: "Operasi Zebra Nataru", thumbnail: "/assets/hot-topik-2.jpg", createdAt: "17 Agustus 2025", timezone: "14:20 WIB", clickCount: "28" }, { title: "Operasi Zebra Nataru", thumbnail: "/assets/hot-topik-1.jpg", createdAt: "17 Agustus 2025", timezone: "14:20 WIB", clickCount: "28" }, { title: "Operasi Zebra Nataru", thumbnail: "/assets/hot-topik-1.jpg", createdAt: "17 Agustus 2025", timezone: "14:20 WIB", clickCount: "28" }, { title: "Operasi Zebra Nataru", thumbnail: "/assets/hot-topik-1.jpg", createdAt: "17 Agustus 2025", timezone: "14:20 WIB", clickCount: "28" }, { title: "Operasi Zebra Nataru", thumbnail: "/assets/hot-topik-1.jpg", createdAt: "17 Agustus 2025", timezone: "14:20 WIB", clickCount: "28" }, ]; const ContentManagement = (props: { type: string }) => { const [profile, setProfile] = useState(); const [province, setProvince] = useState([]); const [, setUser] = useState(); const [selectedTab, setSelectedTab] = useState("video"); const params = useParams(); // const currentRoute = router.pathname; // const profilePicture = Cookies.get("profile_picture"); useEffect(() => { async function initState() { const response = await getInfoProfile(); setProfile(response?.data?.data); } async function getProvinces() { const response = await getListPorvinces(); // console.log(response?.data.data); setProvince(response?.data?.data); } // async function getDisticts() { // const response = await getListDistricts(); // console.log(response?.data.data); // setDistrict(response?.data.data); // } initState(); getProvinces(); // getDisticts(); }, []); useEffect(() => { async function initState() { if (profile != undefined) { const response = await getUsersTeams(profile?.instituteId); // console.log(response?.data?.data); setUser(response?.data?.data); } } initState(); }, [profile]); function addDefaultProfile(ev: any) { ev.target.src = "/assets/avatar-profile.png"; } const [hasMounted, setHasMounted] = useState(false); // Hooks useEffect(() => { setHasMounted(true); }, []); // Render if (!hasMounted) return null; return ( <>
{/* Header */}
avatar

{profile?.fullname}

{profile?.username}

Aktif Sejak {`${new Date(profile?.createdAt).getDate()}/${new Date(profile?.createdAt).getMonth() + 1}/${new Date(profile?.createdAt).getFullYear()} ${new Date(profile?.createdAt).getHours()}:${new Date( profile?.createdAt ).getMinutes()}`}

Pengaturan
{/* Konten Kiri */}

Tentang Saya

  • Email

    msabdayagra@gmail.com

    {/*

    {profile?.email}

    */}
  • No Handphone

    0812-7561-7204

    {/*

    {profile?.phoneNumber}

    */}
  • Alamat

    Jl. Besar Tembung no.12

    {/*

    {profile?.address}

    */}
  • Kategori

    POLRI

    {/*

    {profile?.institute?.categoryRole?.name}

    */}
  • Instansi/Perusahaan

    Div Humas Polri

    {/*

    {profile?.institute?.name}

    */}

Galeri Div Humas

Galeri Saya

Galeri Rewrite

Tim Pengguna

{/* Kontent Kanan */}

Galeri Div Humas

Audio Visual
|
Audio
|
Foto
|
Teks
{selectedTab == "video" ? ( dummyContent?.length > 0 ? (
{dummyContent?.map((video: any) => (
{formatDateToIndonesian(new Date(video?.createdAt))} {video?.timezone ? video?.timezone : "WIB"}| {video?.clickCount}{" "} {" "}
{video?.title}
))}
) : (

empty

) ) : selectedTab == "audio" ? ( dummyContent?.length > 0 ? (
{dummyContent?.map((audio: any) => (
{formatDateToIndonesian(new Date(audio?.createdAt))} {audio?.timezone ? audio?.timezone : "WIB"} | 518
{audio?.title}
#
{audio?.duration}
))}
) : (

empty

) ) : selectedTab == "image" ? ( dummyContent?.length > 0 ? (
{dummyContent?.map((video: any) => (
{formatDateToIndonesian(new Date(video?.createdAt))} {video?.timezone ? video?.timezone : "WIB"}| {video?.clickCount}{" "} {" "}
{video?.title}
))}
) : (

empty

) ) : dummyContent.length > 0 ? (
{dummyContent?.map((document: any) => (
{formatDateToIndonesian(new Date(document?.createdAt))} {document?.timezone ? document?.timezone : "WIB"} | 518
{document?.title}
Download Dokumen
))}
) : (

empty

)}
); }; export default ContentManagement;