diff --git a/app/[locale]/(public)/(polda)/polda/[polda_name]/page.tsx b/app/[locale]/(public)/(polda)/polda/[polda_name]/page.tsx index b8a66318..5d6c5501 100644 --- a/app/[locale]/(public)/(polda)/polda/[polda_name]/page.tsx +++ b/app/[locale]/(public)/(polda)/polda/[polda_name]/page.tsx @@ -17,6 +17,8 @@ import HeroNew from "@/components/landing-page/hero-new"; import Navbar from "@/components/landing-page/navbar"; import SearchSection from "@/components/landing-page/search-section"; import Footer from "@/components/landing-page/footer"; +import SearchSectionPolda from "@/components/landing-page/search-section-polda"; +import HeroNewPolda from "@/components/landing-page/hero-new-polda"; const page = () => { const params = useParams(); @@ -43,12 +45,10 @@ const page = () => { // //
- - +
- +
-
); }; diff --git a/app/[locale]/(public)/(satker)/satker/[satker_name]/page.tsx b/app/[locale]/(public)/(satker)/satker/[satker_name]/page.tsx index 186419a0..fb7892ab 100644 --- a/app/[locale]/(public)/(satker)/satker/[satker_name]/page.tsx +++ b/app/[locale]/(public)/(satker)/satker/[satker_name]/page.tsx @@ -1,20 +1,29 @@ "use client"; import ContentCategory from "@/components/landing-page/content-category"; +import Footer from "@/components/landing-page/footer"; import HeaderBannerSatker from "@/components/landing-page/header-banner-satker"; +import HeroNewSatker from "@/components/landing-page/hero-new-satker"; import NewContent from "@/components/landing-page/new-content"; +import SearchSectionSatker from "@/components/landing-page/search-section-satker"; import WelcomeSatker from "@/components/landing-page/welcome-satker"; import React from "react"; const page = () => { return ( + //
+ // + // + // + // + // + //
- - - - - -
+ +
+ +
+ ); }; diff --git a/components/landing-page/content-category.tsx b/components/landing-page/content-category.tsx index 2784174e..6277b169 100644 --- a/components/landing-page/content-category.tsx +++ b/components/landing-page/content-category.tsx @@ -55,9 +55,9 @@ const ContentCategory = (props: { group?: string; type: string }) => { const toBase64 = (str: string) => (typeof window === "undefined" ? Buffer.from(str).toString("base64") : window.btoa(str)); return ( -
+
-
+

{pathname?.split("/")[1] == "in" ? ( <> diff --git a/components/landing-page/hero-new-polda.tsx b/components/landing-page/hero-new-polda.tsx new file mode 100644 index 00000000..c54d57eb --- /dev/null +++ b/components/landing-page/hero-new-polda.tsx @@ -0,0 +1,370 @@ +import { formatDateToIndonesian, shimmer, toBase64 } from "@/utils/globals"; +import React, { useEffect, useRef, useState } from "react"; +import "swiper/css/bundle"; +import "swiper/css/navigation"; +import { getHeroData, listStaticBanner } from "@/service/landing/landing"; +import Link from "next/link"; +import { useParams, usePathname, useRouter } from "next/navigation"; +import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "@/components/ui/carousel"; +import { Skeleton } from "../ui/skeleton"; +import Image from "next/image"; +import Cookies from "js-cookie"; +import { Tabs, TabsContent, TabsList, TabsTrigger } from "../ui/tabs"; +import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "../ui/card"; +import { Label } from "../ui/label"; +import { Input } from "../ui/input"; +import { Button } from "../ui/button"; +import { Textarea } from "../ui/textarea"; +import { Checkbox } from "../ui/checkbox"; +import { Dialog, DialogClose, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "../ui/dialog"; +import { Autoplay, Navigation, Pagination } from "swiper/modules"; +import { Swiper, SwiperClass, SwiperSlide } from "swiper/react"; +import "swiper/css"; +import "swiper/css/navigation"; +import "swiper/css/pagination"; +import { ChevronLeft, ChevronRight } from "lucide-react"; + +type HeroModalProps = { + onClose: () => void; + group: string; + poldaName?: string; + satkerName?: string; +}; + +const HeroModal = ({ onClose, group, poldaName, satkerName }: HeroModalProps) => { + const [heroData, setHeroData] = useState(); + const params = useParams(); + const locale = params?.locale; + const swiperRef = useRef(null); + + useEffect(() => { + async function fetchCategories() { + const url = "https://netidhub.com/api/csrf"; + + try { + const response = await fetch(url); + + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + + const data = await response.json(); + return data; + } catch (error) { + console.error("Fetch error: ", error); + } + } + + fetchCategories(); + initFetch(); + }, []); + + useEffect(() => { + document.body.classList.add("overflow-hidden"); + + return () => { + document.body.classList.remove("overflow-hidden"); + }; + }, []); + + const initFetch = async () => { + if (group === "polda" && poldaName && String(poldaName).length > 1) { + const response = await listStaticBanner(poldaName); + + const banners = + response?.data?.data?.map((item: any) => { + const media = item?.mediaUpload; + if (media?.fileType) { + media.fileTypeId = media.fileType.id; + } + return media; + }) || []; + + console.log("banner Modal", banners); + setHeroData(banners); + } else { + console.log("Test"); + setHeroData([]); + } + }; + + return ( +
+
+ {heroData?.length > 0 && ( + <> + + + + )} + (swiperRef.current = swiper)} autoplay={{ delay: 3000 }} className="mySwiper w-full"> +
+ + + {heroData && heroData.length > 0 ? ( + heroData.map((list: any, index: number) => ( + +
+ gambar-utama + +
+
+ {list?.categoryName || "Liputan Kegiatan"} + + +

{list?.title}

+ + +

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

+
+
+
+ )) + ) : ( +
+ empty +
+ )} +
+ + +
+
+
+ ); +}; + +const ONE_MONTH = 30 * 24 * 60 * 60 * 1000; + +const HeroNewPolda = (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(() => { + setIsLoading(false); + }, 3000); + + return () => clearTimeout(timer); + }, []); + + useEffect(() => { + const roleId = Cookies.get("urie"); + if (!roleId) { + setShowModal(true); + } + initFetch(); + }, []); + + // useEffect(() => { + // const roleId = Cookies.get("urie"); + // const lastShown = Cookies.get("surveyLastShown"); + // const now = new Date().getTime(); + + // if (roleId && roleId !== "2") { + // if (!lastShown || now - parseInt(lastShown) > ONE_MONTH) { + // setShowSurveyModal(true); + // Cookies.set("surveyLastShown", now.toString(), { expires: 30 }); + // } + // } + + // initFetch(); + // }, []); + + useEffect(() => { + const roleId = Cookies.get("urie"); + const lastShown = Cookies.get("surveyLastShown"); + const now = new Date().getTime(); + + const allowedRoles = ["1", "2", "3"]; + + if (roleId && allowedRoles.includes(roleId)) { + if (!lastShown || now - parseInt(lastShown) > ONE_MONTH) { + setShowSurveyModal(true); + Cookies.set("surveyLastShown", now.toString(), { expires: 30 }); + } + } + + initFetch(); + }, []); + + useEffect(() => { + async function fetchCategories() { + const url = "https://netidhub.com/api/csrf"; + + try { + const response = await fetch(url); + + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + + const data = await response.json(); + return data; + } catch (error) { + console.error("Fetch error: ", error); + } + } + + fetchCategories(); + initFetch(); + }, []); + + const initFetch = async () => { + const response = await getHeroData(); + console.log(response); + let data = response?.data?.data?.content; + setHeroData(data); + + if (data && props.group === "polda" && poldaName && String(poldaName)?.length > 1) { + const resStatic = await listStaticBanner(poldaName); + + 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) => ` + + + + + + + + + + + +`; + + const toBase64 = (str: string) => (typeof window === "undefined" ? Buffer.from(str).toString("base64") : window.btoa(str)); + + return ( +
+
{showModal && setShowModal(false)} group="polda" />}
+ {isLoading ? ( +
+ +
+ + +
+
+ ) : ( +
+ + + {content?.map((list: any) => ( + +
+ gambar-utama +
+ + +
+ {list?.categoryName || "Liputan Kegiatan"} +

{list?.title}

+

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

+
+ +
+ + ))} + + + +
+ {heroData?.slice(0, 3).map((item: any) => ( +
  • +
    + {item?.title} +
    +
    + + {item?.categoryName} +

    {item?.title}

    +

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

    + +
    +
  • + ))} +
    +
    + )} +
    + ); +}; + +export default HeroNewPolda; diff --git a/components/landing-page/hero-new-satker.tsx b/components/landing-page/hero-new-satker.tsx new file mode 100644 index 00000000..8d39a52c --- /dev/null +++ b/components/landing-page/hero-new-satker.tsx @@ -0,0 +1,370 @@ +import { formatDateToIndonesian, shimmer, toBase64 } from "@/utils/globals"; +import React, { useEffect, useRef, useState } from "react"; +import "swiper/css/bundle"; +import "swiper/css/navigation"; +import { getHeroData, listStaticBanner } from "@/service/landing/landing"; +import Link from "next/link"; +import { useParams, usePathname, useRouter } from "next/navigation"; +import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "@/components/ui/carousel"; +import { Skeleton } from "../ui/skeleton"; +import Image from "next/image"; +import Cookies from "js-cookie"; +import { Tabs, TabsContent, TabsList, TabsTrigger } from "../ui/tabs"; +import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "../ui/card"; +import { Label } from "../ui/label"; +import { Input } from "../ui/input"; +import { Button } from "../ui/button"; +import { Textarea } from "../ui/textarea"; +import { Checkbox } from "../ui/checkbox"; +import { Dialog, DialogClose, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "../ui/dialog"; +import { Autoplay, Navigation, Pagination } from "swiper/modules"; +import { Swiper, SwiperClass, SwiperSlide } from "swiper/react"; +import "swiper/css"; +import "swiper/css/navigation"; +import "swiper/css/pagination"; +import { ChevronLeft, ChevronRight } from "lucide-react"; + +type HeroModalProps = { + onClose: () => void; + group: string; + poldaName?: string; + satkerName?: string; +}; + +const HeroModal = ({ onClose, group, poldaName, satkerName }: HeroModalProps) => { + const [heroData, setHeroData] = useState(); + const params = useParams(); + const locale = params?.locale; + const swiperRef = useRef(null); + + useEffect(() => { + async function fetchCategories() { + const url = "https://netidhub.com/api/csrf"; + + try { + const response = await fetch(url); + + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + + const data = await response.json(); + return data; + } catch (error) { + console.error("Fetch error: ", error); + } + } + + fetchCategories(); + initFetch(); + }, []); + + useEffect(() => { + document.body.classList.add("overflow-hidden"); + + return () => { + document.body.classList.remove("overflow-hidden"); + }; + }, []); + + const initFetch = async () => { + if (group === "satker" && satkerName && String(satkerName).length > 1) { + const response = await listStaticBanner(satkerName); + + const banners = + response?.data?.data?.map((item: any) => { + const media = item?.mediaUpload; + if (media?.fileType) { + media.fileTypeId = media.fileType.id; + } + return media; + }) || []; + + console.log("banner Modal", banners); + setHeroData(banners); + } else { + console.log("Test"); + setHeroData([]); + } + }; + + return ( +
    +
    + {heroData?.length > 0 && ( + <> + + + + )} + (swiperRef.current = swiper)} autoplay={{ delay: 3000 }} className="mySwiper w-full"> +
    + + + {heroData && heroData.length > 0 ? ( + heroData.map((list: any, index: number) => ( + +
    + gambar-utama + +
    +
    + {list?.categoryName || "Liputan Kegiatan"} + + +

    {list?.title}

    + + +

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

    +
    +
    +
    + )) + ) : ( +
    + empty +
    + )} +
    + + +
    +
    +
    + ); +}; + +const ONE_MONTH = 30 * 24 * 60 * 60 * 1000; + +const HeroNewSatker = (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(() => { + setIsLoading(false); + }, 3000); + + return () => clearTimeout(timer); + }, []); + + useEffect(() => { + const roleId = Cookies.get("urie"); + if (!roleId) { + setShowModal(true); + } + initFetch(); + }, []); + + // useEffect(() => { + // const roleId = Cookies.get("urie"); + // const lastShown = Cookies.get("surveyLastShown"); + // const now = new Date().getTime(); + + // if (roleId && roleId !== "2") { + // if (!lastShown || now - parseInt(lastShown) > ONE_MONTH) { + // setShowSurveyModal(true); + // Cookies.set("surveyLastShown", now.toString(), { expires: 30 }); + // } + // } + + // initFetch(); + // }, []); + + useEffect(() => { + const roleId = Cookies.get("urie"); + const lastShown = Cookies.get("surveyLastShown"); + const now = new Date().getTime(); + + const allowedRoles = ["1", "2", "3"]; + + if (roleId && allowedRoles.includes(roleId)) { + if (!lastShown || now - parseInt(lastShown) > ONE_MONTH) { + setShowSurveyModal(true); + Cookies.set("surveyLastShown", now.toString(), { expires: 30 }); + } + } + + initFetch(); + }, []); + + useEffect(() => { + async function fetchCategories() { + const url = "https://netidhub.com/api/csrf"; + + try { + const response = await fetch(url); + + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + + const data = await response.json(); + return data; + } catch (error) { + console.error("Fetch error: ", error); + } + } + + fetchCategories(); + initFetch(); + }, []); + + const initFetch = async () => { + const response = await getHeroData(); + console.log(response); + let data = response?.data?.data?.content; + setHeroData(data); + + if (data && props.group === "satker" && satkerName && String(satkerName)?.length > 1) { + const resStatic = await listStaticBanner(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) => ` + + + + + + + + + + + +`; + + const toBase64 = (str: string) => (typeof window === "undefined" ? Buffer.from(str).toString("base64") : window.btoa(str)); + + return ( +
    +
    {showModal && setShowModal(false)} group="satker" />}
    + {isLoading ? ( +
    + +
    + + +
    +
    + ) : ( +
    + + + {content?.map((list: any) => ( + +
    + gambar-utama +
    + + +
    + {list?.categoryName || "Liputan Kegiatan"} +

    {list?.title}

    +

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

    +
    + +
    + + ))} + + + +
    + {heroData?.slice(0, 3).map((item: any) => ( +
  • +
    + {item?.title} +
    +
    + + {item?.categoryName} +

    {item?.title}

    +

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

    + +
    +
  • + ))} +
    +
    + )} +
    + ); +}; + +export default HeroNewSatker; diff --git a/components/landing-page/navbar.tsx b/components/landing-page/navbar.tsx index 848c6136..a2ce1ec8 100644 --- a/components/landing-page/navbar.tsx +++ b/components/landing-page/navbar.tsx @@ -6,23 +6,8 @@ import { FiFile, FiImage, FiMusic, FiYoutube } from "react-icons/fi"; import { useParams, usePathname } from "next/navigation"; import { generateLocalizedPath } from "@/utils/globals"; import { Link } from "@/i18n/routing"; -import { - NavigationMenu, - NavigationMenuContent, - NavigationMenuItem, - NavigationMenuLink, - NavigationMenuList, - NavigationMenuTrigger, - navigationMenuTriggerStyle, -} from "@/components/ui/navigation-menu"; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuGroup, - DropdownMenuItem, - DropdownMenuSeparator, - DropdownMenuTrigger, -} from "../ui/dropdown-menu"; +import { NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, navigationMenuTriggerStyle } from "@/components/ui/navigation-menu"; +import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "../ui/dropdown-menu"; import Image from "next/image"; import { Icon } from "../ui/icon"; import { getCookiesDecrypt } from "@/lib/utils"; @@ -32,23 +17,11 @@ import { useTranslations } from "next-intl"; import { useRouter } from "@/i18n/routing"; import { Button } from "@/components/ui/button"; import LocalSwitcher from "../partials/header/locale-switcher"; -import { - Dialog, - DialogClose, - DialogContent, - DialogDescription, - DialogFooter, - DialogHeader, - DialogTitle, - DialogTrigger, -} from "@/components/ui/dialog"; +import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog"; import { getUserNotifications, listRole } from "@/service/landing/landing"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; -import { - Popover, - PopoverContent, - PopoverTrigger, -} from "@/components/ui/popover"; +import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; +import PoldaLogo from "./polda-logo"; type Detail = { id: number; @@ -90,11 +63,7 @@ const Navbar = () => { const [notificationsUpdate, setNotificationsUpdate] = useState([]); const [selectedTab, setSelectedTab] = useState("image"); - let prefixPath = poldaName - ? `/polda/${poldaName}` - : satkerName - ? `/satker/${satkerName}` - : "/"; + let prefixPath = poldaName ? `/polda/${poldaName}` : satkerName ? `/satker/${satkerName}` : "/"; let menu = ""; @@ -190,14 +159,9 @@ const Navbar = () => {
    - Media Hub Logo + Media Hub Logo + {/* */} {/* Nav Menu */}
    @@ -205,14 +169,7 @@ const Navbar = () => { - + { - router.push(prefixPath + "/image/filter")} - className="flex place-items-start gap-1 px-3 py-1 w-36" - > + router.push(prefixPath + "/image/filter")} className="flex place-items-start gap-1 px-3 py-1 w-36">

    {t("image")}

    - router.push(prefixPath + "/video/filter")} - className="flex items-start gap-1 py-1 px-3 " - > + router.push(prefixPath + "/video/filter")} className="flex items-start gap-1 py-1 px-3 "> {pathname?.split("/")[1] == "in" ? ( <>

    @@ -251,21 +202,13 @@ const Navbar = () => { )} - - router.push(prefixPath + "/document/filter") - } - className="flex place-items-start gap-1 py-1 px-3" - > + router.push(prefixPath + "/document/filter")} className="flex place-items-start gap-1 py-1 px-3">

    {t("text")}

    - router.push(prefixPath + "/audio/filter")} - className="flex place-items-start gap-1 py-1 px-3 " - > + router.push(prefixPath + "/audio/filter")} className="flex place-items-start gap-1 py-1 px-3 ">

    {t("audio")}{" "} @@ -277,14 +220,7 @@ const Navbar = () => { - + { - + { */}

    @@ -399,20 +322,9 @@ const Navbar = () => { placeholder={t("search")} className="pl-8 pr-4 py-1 w-28 text-[13px] border rounded-full focus:outline-none dark:text-white" /> */} - setOnSearch(e.target.value)} - type="text" - placeholder="Search..." - className="pl-8 pr-4 py-1 w-28 text-[13px] border rounded-full focus:outline-none dark:text-white" - /> + setOnSearch(e.target.value)} type="text" placeholder="Search..." className="pl-8 pr-4 py-1 w-28 text-[13px] border rounded-full focus:outline-none dark:text-white" /> - + { )}
    */} - {roleId === "5" || - roleId === "6" || - roleId === "7" || - roleId === "8" ? ( + {roleId === "5" || roleId === "6" || roleId === "7" || roleId === "8" ? ( <> {/* Inbox */} test()}> {" "} - + - - + + { {
    {notifications?.map((list: any) => ( - +
    - avatar -
    -
    - {list?.message} + avatar
    +
    {list?.message}
    - {`${new Date(list?.createdAt).getDate()}/${ - new Date(list?.createdAt).getMonth() + 1 - }/${new Date( - list?.createdAt - ).getFullYear()} ${new Date( - list?.createdAt - ).getHours()}:${new Date( + {`${new Date(list?.createdAt).getDate()}/${new Date(list?.createdAt).getMonth() + 1}/${new Date(list?.createdAt).getFullYear()} ${new Date(list?.createdAt).getHours()}:${new Date( list?.createdAt ).getMinutes()}`}{" "} @@ -567,10 +438,7 @@ const Navbar = () => { ))} -

    +

    {t("seeAll")}

    @@ -579,33 +447,15 @@ const Navbar = () => {
    {notificationsUpdate?.map((list: any) => ( - +
    - ... + ...
    -
    - {list?.message} -
    +
    {list?.message}
    - {`${new Date(list?.createdAt).getDate()}/${ - new Date(list?.createdAt).getMonth() + 1 - }/${new Date( - list?.createdAt - ).getFullYear()} ${new Date( - list?.createdAt - ).getHours()}:${new Date( + {`${new Date(list?.createdAt).getDate()}/${new Date(list?.createdAt).getMonth() + 1}/${new Date(list?.createdAt).getFullYear()} ${new Date(list?.createdAt).getHours()}:${new Date( list?.createdAt ).getMinutes()}`}{" "} @@ -614,10 +464,7 @@ const Navbar = () => { ))} -

    +

    {t("seeAll")}

    @@ -630,20 +477,10 @@ const Navbar = () => { {detail !== undefined ? (
    - {"Image"} + {"Image"}
    -
    - {detail?.fullname} -
    -

    - ({detail?.fullname}) -

    +
    {detail?.fullname}
    +

    ({detail?.fullname})

    @@ -667,11 +504,7 @@ const Navbar = () => { href: "/content-management/galery", }, ].map((item, index) => ( - + {item.name} @@ -683,11 +516,7 @@ const Navbar = () => {
    - @@ -697,42 +526,22 @@ const Navbar = () => { - ) : roleId === "2" || - roleId === "3" || - roleId === "4" || - roleId === "9" || - roleId === "10" || - roleId === "11" || - roleId === "12" || - roleId === "13" ? ( + ) : roleId === "2" || roleId === "3" || roleId === "4" || roleId === "9" || roleId === "10" || roleId === "11" || roleId === "12" || roleId === "13" ? ( <> {/* Inbox */} test()}> {" "} - + - - + + { { -
    +
    {notifications?.map((list: any) => (
    - ... + ...
    -
    - {list?.message} -
    +
    {list?.message}
    - {`${new Date(list?.createdAt).getDate()}/${ - new Date(list?.createdAt).getMonth() + 1 - }/${new Date( - list?.createdAt - ).getFullYear()} ${new Date( - list?.createdAt - ).getHours()}:${new Date( + {`${new Date(list?.createdAt).getDate()}/${new Date(list?.createdAt).getMonth() + 1}/${new Date(list?.createdAt).getFullYear()} ${new Date(list?.createdAt).getHours()}:${new Date( list?.createdAt ).getMinutes()}`}{" "} @@ -801,39 +591,17 @@ const Navbar = () => {

    -
    +
    {notificationsUpdate?.map((list: any) => ( - +
    - ... + ...
    -
    - {list?.message} -
    +
    {list?.message}
    - {`${new Date(list?.createdAt).getDate()}/${ - new Date(list?.createdAt).getMonth() + 1 - }/${new Date( - list?.createdAt - ).getFullYear()} ${new Date( - list?.createdAt - ).getHours()}:${new Date( + {`${new Date(list?.createdAt).getDate()}/${new Date(list?.createdAt).getMonth() + 1}/${new Date(list?.createdAt).getFullYear()} ${new Date(list?.createdAt).getHours()}:${new Date( list?.createdAt ).getMinutes()}`}{" "} @@ -855,20 +623,10 @@ const Navbar = () => { {detail !== undefined ? (
    - {"Image"} + {"Image"}
    -
    - {detail?.fullname} -
    -

    - ({detail?.fullname}) -

    +
    {detail?.fullname}
    +

    ({detail?.fullname})

    @@ -892,11 +650,7 @@ const Navbar = () => { href: "/dashboard", }, ].map((item, index) => ( - + {item.name} @@ -908,11 +662,7 @@ const Navbar = () => {
    - @@ -925,37 +675,22 @@ const Navbar = () => { ) : ( // Masuk and Daftar buttons for roleId === null
    - + {t("logIn")} - +
    -

    - {t("categoryReg")} -

    +

    {t("categoryReg")}

    {t("selectOne")}

    {role?.map((row: any) => (
    - setCategory(event.target.value)} - /> + setCategory(event.target.value)} /> @@ -964,11 +699,7 @@ const Navbar = () => {
    - + {t("next")}{" "} @@ -977,33 +708,14 @@ const Navbar = () => {
    )}
    - @@ -1018,14 +730,7 @@ const Navbar = () => {
    - + { - router.push(prefixPath + "/image/filter")} - className="flex place-items-start gap-1.5 p-2 w-36" - > + router.push(prefixPath + "/image/filter")} className="flex place-items-start gap-1.5 p-2 w-36">

    {t("image")}

    - router.push(prefixPath + "/video/filter")} - className="flex items-start gap-1.5 p-2 " - > + router.push(prefixPath + "/video/filter")} className="flex items-start gap-1.5 p-2 "> {pathname?.split("/")[1] == "in" ? ( <>

    @@ -1064,21 +763,13 @@ const Navbar = () => { )} - - router.push(prefixPath + "/document/filter") - } - className="flex place-items-start gap-1.5 p-2" - > + router.push(prefixPath + "/document/filter")} className="flex place-items-start gap-1.5 p-2">

    {t("text")}

    - router.push(prefixPath + "/audio/filter")} - className="flex place-items-start gap-1.5 p-2 " - > + router.push(prefixPath + "/audio/filter")} className="flex place-items-start gap-1.5 p-2 ">

    {t("audio")}{" "} @@ -1088,18 +779,9 @@ const Navbar = () => { - + - + { - + - + {

    */} @@ -1225,13 +892,7 @@ const Navbar = () => {
    - setOnSearch(e.target.value)} - type="text" - placeholder="Search..." - className="pl-8 pr-4 py-1 w-28 text-[13px] border rounded-full focus:outline-none dark:text-white" - />{" "} + setOnSearch(e.target.value)} type="text" placeholder="Search..." className="pl-8 pr-4 py-1 w-28 text-[13px] border rounded-full focus:outline-none dark:text-white" />{" "}
    @@ -1303,43 +964,22 @@ const Navbar = () => { )} */} - {roleId === "5" || - roleId === "6" || - roleId === "7" || - roleId === "8" ? ( + {roleId === "5" || roleId === "6" || roleId === "7" || roleId === "8" ? ( <> {/* Inbox */} test()}> {" "} - + - - + + - + { {
    {notifications?.map((list: any) => ( - +
    - ... -
    -
    - {list?.message} + ...
    +
    {list?.message}
    - {`${new Date(list?.createdAt).getDate()}/${ - new Date(list?.createdAt).getMonth() + 1 - }/${new Date( - list?.createdAt - ).getFullYear()} ${new Date( - list?.createdAt - ).getHours()}:${new Date( + {`${new Date(list?.createdAt).getDate()}/${new Date(list?.createdAt).getMonth() + 1}/${new Date(list?.createdAt).getFullYear()} ${new Date(list?.createdAt).getHours()}:${new Date( list?.createdAt ).getMinutes()}`}{" "} @@ -1404,10 +1022,7 @@ const Navbar = () => { ))} -

    +

    {t("seeAll")}

    @@ -1416,35 +1031,15 @@ const Navbar = () => {
    {notificationsUpdate?.map((list: any) => ( - +
    - ... + ...
    -
    - {list?.message} -
    +
    {list?.message}
    - {`${new Date( - list?.createdAt - ).getDate()}/${ - new Date(list?.createdAt).getMonth() + 1 - }/${new Date( - list?.createdAt - ).getFullYear()} ${new Date( - list?.createdAt - ).getHours()}:${new Date( + {`${new Date(list?.createdAt).getDate()}/${new Date(list?.createdAt).getMonth() + 1}/${new Date(list?.createdAt).getFullYear()} ${new Date(list?.createdAt).getHours()}:${new Date( list?.createdAt ).getMinutes()}`}{" "} @@ -1453,10 +1048,7 @@ const Navbar = () => { ))} -

    +

    {t("seeAll")}

    @@ -1469,20 +1061,10 @@ const Navbar = () => { {detail !== undefined ? (
    - {"Image"} + {"Image"}
    -
    - {detail?.fullname} -
    -

    - ({detail?.fullname}) -

    +
    {detail?.fullname}
    +

    ({detail?.fullname})

    @@ -1506,11 +1088,7 @@ const Navbar = () => { href: "/content-management/galery", }, ].map((item, index) => ( - + {item.name} @@ -1522,15 +1100,8 @@ const Navbar = () => {
    - @@ -1539,42 +1110,22 @@ const Navbar = () => { - ) : roleId === "2" || - roleId === "3" || - roleId === "4" || - roleId === "9" || - roleId === "10" || - roleId === "11" || - roleId === "12" || - roleId === "13" ? ( + ) : roleId === "2" || roleId === "3" || roleId === "4" || roleId === "9" || roleId === "10" || roleId === "11" || roleId === "12" || roleId === "13" ? ( <> {/* Inbox */} test()}> {" "} - + - - + + { { -
    +
    {notifications?.map((list: any) => (
    - ... + ...
    -
    - {list?.message} -
    +
    {list?.message}
    - {`${new Date(list?.createdAt).getDate()}/${ - new Date(list?.createdAt).getMonth() + 1 - }/${new Date( - list?.createdAt - ).getFullYear()} ${new Date( - list?.createdAt - ).getHours()}:${new Date( + {`${new Date(list?.createdAt).getDate()}/${new Date(list?.createdAt).getMonth() + 1}/${new Date(list?.createdAt).getFullYear()} ${new Date(list?.createdAt).getHours()}:${new Date( list?.createdAt ).getMinutes()}`}{" "} @@ -1643,39 +1175,17 @@ const Navbar = () => {

    -
    +
    {notificationsUpdate?.map((list: any) => ( - +
    - ... + ...
    -
    - {list?.message} -
    +
    {list?.message}
    - {`${new Date(list?.createdAt).getDate()}/${ - new Date(list?.createdAt).getMonth() + 1 - }/${new Date( - list?.createdAt - ).getFullYear()} ${new Date( - list?.createdAt - ).getHours()}:${new Date( + {`${new Date(list?.createdAt).getDate()}/${new Date(list?.createdAt).getMonth() + 1}/${new Date(list?.createdAt).getFullYear()} ${new Date(list?.createdAt).getHours()}:${new Date( list?.createdAt ).getMinutes()}`}{" "} @@ -1684,10 +1194,7 @@ const Navbar = () => { ))} -

    +

    {t("seeAll")}

    @@ -1700,20 +1207,10 @@ const Navbar = () => { {detail !== undefined ? (
    - {"Image"} + {"Image"}
    -
    - {detail?.fullname} -
    -

    - ({detail?.fullname}) -

    +
    {detail?.fullname}
    +

    ({detail?.fullname})

    @@ -1737,11 +1234,7 @@ const Navbar = () => { href: "/dashboard", }, ].map((item, index) => ( - + {item.name} @@ -1753,15 +1246,8 @@ const Navbar = () => {
    - @@ -1773,48 +1259,25 @@ const Navbar = () => { ) : ( // Masuk and Daftar buttons for roleId === null
    - + {t("logIn")} -
    -

    - {t("categoryReg")} -

    -

    - {t("selectOne")} -

    +

    {t("categoryReg")}

    +

    {t("selectOne")}

    {role?.map((row: any) => (
    - - setCategory(event.target.value) - } - /> -
    @@ -1822,11 +1285,7 @@ const Navbar = () => {
    - + {t("next")}{" "} diff --git a/components/landing-page/new-content.tsx b/components/landing-page/new-content.tsx index 7d534c13..e4f782ce 100644 --- a/components/landing-page/new-content.tsx +++ b/components/landing-page/new-content.tsx @@ -92,9 +92,9 @@ const NewContent = (props: { group: string; type: string }) => { const toBase64 = (str: string) => (typeof window === "undefined" ? Buffer.from(str).toString("base64") : window.btoa(str)); return ( -
    +
    -
    +

    {pathname?.split("/")[1] == "in" ? ( <> @@ -194,8 +194,8 @@ const NewContent = (props: { group: string; type: string }) => { ))}

    - - + + ) : (

    @@ -241,8 +241,8 @@ const NewContent = (props: { group: string; type: string }) => { ))}

    - - + + ) : (

    @@ -300,8 +300,8 @@ const NewContent = (props: { group: string; type: string }) => { ))}

    - - + + ) : (

    @@ -364,8 +364,8 @@ const NewContent = (props: { group: string; type: string }) => { ))}

    - - + + ) : (

    diff --git a/components/landing-page/polda-logo.tsx b/components/landing-page/polda-logo.tsx new file mode 100644 index 00000000..7ebd5434 --- /dev/null +++ b/components/landing-page/polda-logo.tsx @@ -0,0 +1,55 @@ +"use client"; + +import Image from "next/image"; +import { useParams } from "next/navigation"; + +const regions = [ + { name: "Polda Aceh", slug: "aceh", logo: "/logo/polda/polda-aceh.png" }, + { name: "Polda Bali", slug: "bali", logo: "/logo/polda/polda-bali.png" }, + { name: "Polda Bangka Belitung", slug: "bangka-belitung", logo: "/logo/polda/polda-bangkabelitung.png" }, + { name: "Polda Banten", slug: "banten", logo: "/logo/polda/polda-banten.png" }, + { name: "Polda Bengkulu", slug: "bengkulu", logo: "/logo/polda/polda-bengkulu.png" }, + { name: "Polda DIY", slug: "di-yogyakarta", logo: "/logo/polda/polda-jogja.png" }, + { name: "Polda Gorontalo", slug: "gorontalo", logo: "/logo/polda/polda-gorontalo.png" }, + { name: "Polda Jambi", slug: "jambi", logo: "/logo/polda/polda-jambi.png" }, + { name: "Polda Jawa Barat", slug: "jawa-barat", logo: "/logo/polda/polda-jawabarat.png" }, + { name: "Polda Jawa Tengah", slug: "jawa-tengah", logo: "/logo/polda/polda-jawatengah.png" }, + { name: "Polda Jawa Timur", slug: "jawa-timur", logo: "/logo/polda/polda-jawatimur.png" }, + { name: "Polda Kalimantan Barat", slug: "kalimantan-barat", logo: "/logo/polda/polda-kalbar.png" }, + { name: "Polda Kalimantan Selatan", slug: "kalimantan-selatan", logo: "/logo/polda/polda-kalsel.png" }, + { name: "Polda Kalimantan Tengah", slug: "kalimantan-tengah", logo: "/logo/polda/polda-kalteng.png" }, + { name: "Polda Kalimantan Timur", slug: "kalimantan-timur", logo: "/logo/polda/polda-kaltim.png" }, + { name: "Polda Kalimantan Utara", slug: "kaltara", logo: "/logo/polda/polda-kaltara.png" }, + { name: "Polda Kepulauan Riau", slug: "kepulauan-riau", logo: "/logo/polda/polda-kepri.png" }, + { name: "Polda Lampung", slug: "lampung", logo: "/logo/polda/polda-lampung.png" }, + { name: "Polda Maluku", slug: "maluku", logo: "/logo/polda/polda-maluku.png" }, + { name: "Polda Maluku Utara", slug: "maluku-utara", logo: "/logo/polda/polda-maluku-utara.png" }, + { name: "Polda Metro Jaya", slug: "metro-jaya", logo: "/logo/polda/polda-metro.png" }, + { name: "Polda NTB", slug: "ntb", logo: "/logo/polda/polda-ntb.png" }, + { name: "Polda NTT", slug: "ntt", logo: "/logo/polda/polda-ntt.png" }, + { name: "Polda Papua", slug: "papua", logo: "/logo/polda/polda-papua.png" }, + { name: "Polda Papua Barat", slug: "papua-barat", logo: "/logo/polda/polda-papua-barat.png" }, + { name: "Polda Riau", slug: "riau", logo: "/logo/polda/polda-riau.png" }, + { name: "Polda Sulawesi Barat", slug: "sulawesi-barat", logo: "/logo/polda/polda-sulbar.png" }, + { name: "Polda Sulawesi Selatan", slug: "sulawesi-selatan", logo: "/logo/polda/polda-sulsel.png" }, + { name: "Polda Sulawesi Tengah", slug: "sulawesi-tengah", logo: "/logo/polda/polda-sulawesi-tengah.png" }, + { name: "Polda Sulawesi Tenggara", slug: "sulawesi-tenggara", logo: "/logo/polda/polda-sulawesi-tenggara.png" }, + { name: "Polda Sulawesi Utara", slug: "sulawesi-utara", logo: "/logo/polda/polda-sulawesi-utara.png" }, + { name: "Polda Sumatera Barat", slug: "sumatera-barat", logo: "/logo/polda/polda-sumatera-barat.png" }, + { name: "Polda Sumatera Selatan", slug: "sumatera-selatan", logo: "/logo/polda/polda-sumsel.png" }, + { name: "Polda Sumatera Utara", slug: "sumatera-utara", logo: "/logo/polda/polda-sumut.png" }, +]; + +export default function PoldaLogo() { + const params = useParams(); + const poldaSlug = params?.slug ?? ""; // pastikan kamu di route [slug] atau [poldaSlug] + + const region = regions.find((r) => r.slug === poldaSlug); + const logoSrc = region?.logo ?? "/logo/polda/default.png"; + + return ( +

    + {region?.name +
    + ); +} diff --git a/components/landing-page/scrollable-content-polda.tsx b/components/landing-page/scrollable-content-polda.tsx index 04e85cec..42df5e59 100644 --- a/components/landing-page/scrollable-content-polda.tsx +++ b/components/landing-page/scrollable-content-polda.tsx @@ -54,15 +54,17 @@ const ScrollableContentPolda = () => {

    - {t("welcome")} DI POLDA {poldaName?.replace("-", " ")} + {t("welcome")} Polda {poldaName?.replace("-", " ")} - + {/*  {t("download")} {t("coverage")} - {" "} + {" "} */}

    -

    {t("officialCoverage")}

    +

    + {t("officialPolda")} {poldaName?.replace("-", " ")} +

    diff --git a/components/landing-page/scrollable-content-satker.tsx b/components/landing-page/scrollable-content-satker.tsx new file mode 100644 index 00000000..5e5f0ad0 --- /dev/null +++ b/components/landing-page/scrollable-content-satker.tsx @@ -0,0 +1,115 @@ +import search from "@/app/[locale]/(protected)/app/chat/components/search"; +import { useTranslations } from "next-intl"; +import { useParams, useRouter } from "next/navigation"; +import router from "next/router"; +import React, { useEffect, useState } from "react"; +import { Icon } from "@iconify/react/dist/iconify.js"; +import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "../ui/select"; +import Image from "next/image"; +import { getHeroData } from "@/service/landing/landing"; +import { title } from "process"; +import { htmlToString } from "@/utils/globals"; +import { Link } from "@/i18n/routing"; + +const ScrollableContentSatker = () => { + const [contentType, setContentType] = useState("all"); + const [search, setSearch] = useState(""); + const router = useRouter(); + const params = useParams(); + const locale = params?.locale; + const t = useTranslations("LandingPage"); + const satkerName: any = params?.satker_name; + const [content, setContent] = useState(); + useEffect(() => { + async function fetchCategories() { + const url = "https://netidhub.com/api/csrf"; + + try { + const response = await fetch(url); + + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + + const data = await response.json(); + return data; + } catch (error) { + console.error("Fetch error: ", error); + } + } + + fetchCategories(); + initFetch(); + }, []); + + const initFetch = async () => { + const response = await getHeroData(); + console.log(response); + let data = response?.data?.data?.content; + + setContent(data); + }; + return ( + <> +
    +

    + + {t("welcome")} Polda {satkerName?.replace("-", " ")} + + {/* +  {t("download")} {t("coverage")} + {" "} */} +

    +
    +
    +

    + {t("officialPolda")} {satkerName?.replace("-", " ")} +

    + +
    +
    + +
    + + + + + + setSearch(e.target.value)} /> +
    +
    + +
    +
    + + ); +}; + +export default ScrollableContentSatker; diff --git a/components/landing-page/search-section-polda.tsx b/components/landing-page/search-section-polda.tsx new file mode 100644 index 00000000..399333e7 --- /dev/null +++ b/components/landing-page/search-section-polda.tsx @@ -0,0 +1,58 @@ +import search from "@/app/[locale]/(protected)/app/chat/components/search"; +import { Select, SelectTrigger, SelectValue, SelectContent, SelectGroup, SelectItem } from "@radix-ui/react-select"; +import { Icon } from "lucide-react"; +import { useTranslations } from "next-intl"; +import { useRouter } from "next/navigation"; +import router from "next/router"; +import React, { useState } from "react"; +import ScrollableContent from "./search-section-new"; +import NewContent from "./new-content"; +import ContentCategory from "./content-category"; +import AreaCoverageWorkUnits from "./area-coverage-and-work-units"; +import EventCalender from "./event-calender"; +import UserSurveyBox from "./survey-box"; +import ScrollableContentPolda from "./scrollable-content-polda"; + +const LeftBanner = () => ( +
    + Banner Kiri 1 + Banner Kiri 2 +
    +); + +const RightBanner = () => ( +
    + Banner Kanan 1 + Banner Kanan 2 +
    +); + +const SearchSectionPolda = () => { + const [contentType, setContentType] = useState("all"); + const [search, setSearch] = useState(""); + const router = useRouter(); + const t = useTranslations("LandingPage"); + return ( +
    +
    + +
    + +
    + + + + + + + +
    + +
    + +
    +
    + ); +}; + +export default SearchSectionPolda; diff --git a/components/landing-page/search-section-satker.tsx b/components/landing-page/search-section-satker.tsx new file mode 100644 index 00000000..9d24a8a3 --- /dev/null +++ b/components/landing-page/search-section-satker.tsx @@ -0,0 +1,59 @@ +import search from "@/app/[locale]/(protected)/app/chat/components/search"; +import { Select, SelectTrigger, SelectValue, SelectContent, SelectGroup, SelectItem } from "@radix-ui/react-select"; +import { Icon } from "lucide-react"; +import { useTranslations } from "next-intl"; +import { useRouter } from "next/navigation"; +import router from "next/router"; +import React, { useState } from "react"; +import ScrollableContent from "./search-section-new"; +import NewContent from "./new-content"; +import ContentCategory from "./content-category"; +import AreaCoverageWorkUnits from "./area-coverage-and-work-units"; +import EventCalender from "./event-calender"; +import UserSurveyBox from "./survey-box"; +import ScrollableContentPolda from "./scrollable-content-polda"; +import ScrollableContentSatker from "./scrollable-content-satker"; + +const LeftBanner = () => ( +
    + Banner Kiri 1 + Banner Kiri 2 +
    +); + +const RightBanner = () => ( +
    + Banner Kanan 1 + Banner Kanan 2 +
    +); + +const SearchSectionSatker = () => { + const [contentType, setContentType] = useState("all"); + const [search, setSearch] = useState(""); + const router = useRouter(); + const t = useTranslations("LandingPage"); + return ( +
    +
    + +
    + +
    + + + + + + + +
    + +
    + +
    +
    + ); +}; + +export default SearchSectionSatker; diff --git a/components/landing-page/search-section.tsx b/components/landing-page/search-section.tsx index 6ae4e6c1..77232d03 100644 --- a/components/landing-page/search-section.tsx +++ b/components/landing-page/search-section.tsx @@ -39,10 +39,10 @@ const SearchSection = () => {
    - - - - + + + + diff --git a/messages/en.json b/messages/en.json index 651c8801..0de3e4ab 100644 --- a/messages/en.json +++ b/messages/en.json @@ -363,6 +363,7 @@ "download": "Download", "coverage": "Our Official Coverage", "officialCoverage": "Official coverage sourced from Polri activities at the National Police Headquarters and Regional Police throughout Indonesia", + "officialPolda": "Official Coverage Sourced From Police Activities At Polda", "allContent": "All Content", "searchCoverage": "Search Coverage", "newContent": "Latest Content", diff --git a/messages/in.json b/messages/in.json index cdc0a5e6..049deb37 100644 --- a/messages/in.json +++ b/messages/in.json @@ -363,6 +363,7 @@ "download": "DOWNLOAD", "coverage": "LIPUTAN RESMI KAMI", "officialCoverage": "Liputan resmi yang bersumber dari kegiatan Polri di Mabes dan Polda seluruh Indonesia", + "officialPolda": "Liputan Resmi Yang Bersumber Dari Kegiatan Polri Di Polda", "allContent": "Semua Konten", "searchCoverage": "Cari Liputan", "searchCoverageHere": "Cari Liputan Disini",