[QUDO-103] feat:update landing page newmediahub
|
|
@ -13,24 +13,19 @@ import { ReactLenis } from "@studio-freight/react-lenis";
|
|||
import MountedProvider from "@/providers/mounted.provider";
|
||||
import NewsTicker from "@/components/landing-page/news-tickers";
|
||||
import AreaCoverageWorkUnits from "@/components/landing-page/area-coverage-and-work-units";
|
||||
import HeroNew from "@/components/landing-page/hero-new";
|
||||
|
||||
const Home = ({ params: { locale } }: { params: { locale: string } }) => {
|
||||
return (
|
||||
<MountedProvider isProtected={false}>
|
||||
<ReactLenis root>
|
||||
<div className="pb-14">
|
||||
<div className="">
|
||||
<Navbar />
|
||||
<Hero group="mabes" />
|
||||
<HeroNew group="mabes" />
|
||||
<div className="flex-1 ">
|
||||
<SearchSection />
|
||||
<NewContent group="mabes" type="latest" />
|
||||
<NewContent group="mabes" type="popular" />
|
||||
{/* <PopularContent /> */}
|
||||
<ContentCategory group="mabes" type="popular" />
|
||||
{/* <Coverage /> */}
|
||||
{/* <Division /> */}
|
||||
<AreaCoverageWorkUnits />
|
||||
</div>
|
||||
<Footer />
|
||||
<NewsTicker />
|
||||
</div>
|
||||
</ReactLenis>
|
||||
</MountedProvider>
|
||||
|
|
|
|||
|
|
@ -30,12 +30,11 @@ const AreaCoverageWorkUnits = () => {
|
|||
};
|
||||
}, [openPolda, openSatker]);
|
||||
return (
|
||||
<div className="mx-auto px-4 lg:px-12 py-6">
|
||||
<h2 className="text-center text-2xl font-bold text-gray-800 dark:text-white mb-4">
|
||||
<div className="mx-auto px-4 lg:px-8 py-6">
|
||||
<h2 className="text-start text-lg md:text-xl font-bold text-[#bb3523] border-b-2 border-[#bb3523] mb-4 uppercase">
|
||||
Liputan <span className="text-[#bb3523]">Wilayah</span> &{" "}
|
||||
<span className="text-[#bb3523]">Satker</span>
|
||||
</h2>
|
||||
<div className="h-1 w-[250px] bg-[#bb3523] mx-auto mb-6 rounded"></div>
|
||||
<div className="flex flex-col justify-center lg:flex-row gap-8 ">
|
||||
{/* POLDA */}
|
||||
<Dialog open={openPolda} onOpenChange={setOpenPolda}>
|
||||
|
|
|
|||
|
|
@ -79,27 +79,26 @@ const ContentCategory = (props: { group?: string; type: string }) => {
|
|||
: window.btoa(str);
|
||||
|
||||
return (
|
||||
<div className="px-4 lg:px-24 py-10">
|
||||
<div className="px-4 py-10">
|
||||
<Reveal>
|
||||
<h2 className="text-center text-xl lg:text-3xl font-bold text-[#bb3523] mb-4">
|
||||
<div className="flex flex-col p-4">
|
||||
<h2 className="text-start text-lg md:text-xl font-bold text-[#bb3523] border-b-2 border-[#bb3523] mb-4 uppercase">
|
||||
{pathname?.split("/")[1] == "in" ? (
|
||||
<>
|
||||
<span className="text-black dark:text-white">
|
||||
<span className="text-[#bb3523] dark:text-white">
|
||||
{t("category")}
|
||||
</span>
|
||||
{t("content")}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<span className="text-black dark:text-white">
|
||||
<span className="text-[#bb3523] dark:text-white">
|
||||
{t("content")}
|
||||
</span>
|
||||
{t("category")}
|
||||
</>
|
||||
)}
|
||||
</h2>
|
||||
<div className="h-1 w-52 bg-[#bb3523] mx-auto mb-6 rounded"></div>
|
||||
|
||||
<div className="grid grid-cols-2 md:grid-cols-2 lg:grid-cols-4 gap-4">
|
||||
{(seeAllValue ? categories : categories?.slice(0, 4))?.map(
|
||||
(category: any) => (
|
||||
|
|
@ -140,7 +139,7 @@ const ContentCategory = (props: { group?: string; type: string }) => {
|
|||
</div>
|
||||
|
||||
{/* Tombol See More / See Less */}
|
||||
{categories?.length > 10 && (
|
||||
{categories?.length > 8 && (
|
||||
<div className="flex items-center flex-row justify-center mt-6">
|
||||
<Button
|
||||
onClick={() => setSeeAllValue(!seeAllValue)}
|
||||
|
|
@ -163,6 +162,7 @@ const ContentCategory = (props: { group?: string; type: string }) => {
|
|||
{t("seeAll")}
|
||||
</div>
|
||||
</div> */}
|
||||
</div>
|
||||
</Reveal>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,91 @@
|
|||
import React from "react";
|
||||
|
||||
const EventCalender = () => {
|
||||
return (
|
||||
<div className="mt-8 rounded-lg bg-white dark:bg-zinc-900 p-4 shadow">
|
||||
<h2 className="text-lg font-bold text-red-600 border-b border-red-600 mb-4 pb-2">
|
||||
KALENDER ACARA
|
||||
</h2>
|
||||
<div className="flex flex-col md:flex-row gap-4">
|
||||
<div className="w-full md:w-1/2">
|
||||
<div className="bg-gray-100 dark:bg-zinc-800 p-4 rounded-md ">
|
||||
<div className="text-center font-semibold mb-2">Mei 2025</div>
|
||||
<div className="grid grid-cols-7 gap-1 text-sm text-center">
|
||||
{["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"].map((d) => (
|
||||
<div key={d} className="font-medium">
|
||||
{d}
|
||||
</div>
|
||||
))}
|
||||
{[...Array(35)].map((_, i) => (
|
||||
<div
|
||||
key={i}
|
||||
className={`p-1 rounded ${
|
||||
[6, 7, 15].includes(i) ? "bg-red-600 text-white" : ""
|
||||
}`}
|
||||
>
|
||||
{i >= 2 && i - 1}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-4 mt-3">
|
||||
<div className="flex items-center bg-gray-200 rounded-xl shadow-sm p-2">
|
||||
<img
|
||||
src="/images/all-img/calendar1.png"
|
||||
alt="HUT Polwan"
|
||||
className="w-24 h-20 object-cover rounded"
|
||||
/>
|
||||
<div className="flex justify-between items-center w-full ml-3">
|
||||
<div className="text-sm font-semibold line-clamp-2">
|
||||
HUT Polwan ke-76, Kapolri...
|
||||
</div>
|
||||
<div className="text-sm font-semibold whitespace-nowrap ml-3">
|
||||
16 Mei - 16 Mei
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center bg-gray-200 rounded-xl shadow-sm p-2">
|
||||
<img
|
||||
src="/images/all-img/calendar2.png"
|
||||
alt="Olahraga"
|
||||
className="w-24 h-20 object-cover rounded"
|
||||
/>
|
||||
<div className="flex justify-between items-center w-full ml-3">
|
||||
<div className="text-sm font-semibold line-clamp-2 uppercase">
|
||||
Olahraga Bersama Pad...
|
||||
</div>
|
||||
<div className="text-sm font-semibold whitespace-nowrap ml-3">
|
||||
22 Mei - 22 Mei
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Detail Acara */}
|
||||
<div className="w-full md:w-1/2 space-y-4">
|
||||
<div className="bg-gray-100 dark:bg-zinc-800 rounded-md p-2 mt-4">
|
||||
<img
|
||||
src="/images/all-img/calendar1.png"
|
||||
alt="Detail Event"
|
||||
className="rounded mb-2"
|
||||
/>
|
||||
<p className="text-sm font-semibold mb-1">
|
||||
HUT Polwan ke-76, Kapolri Apresiasi Prestasi yang Diberikan
|
||||
</p>
|
||||
<p className="text-xs text-gray-500 mb-1">
|
||||
Kapolri Jenderal Pol. Listyo Sigit Prabowo memberikan apresiasi
|
||||
kepada polisi wanita yang berprestasi...
|
||||
</p>
|
||||
<a href="#" className="text-xs text-blue-500">
|
||||
Lihat Selengkapnya
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default EventCalender;
|
||||
|
|
@ -0,0 +1,423 @@
|
|||
import { formatDateToIndonesian, shimmer, toBase64 } from "@/utils/globals";
|
||||
import React, { useEffect, 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, Pagination } from "swiper/modules";
|
||||
import { Swiper, SwiperSlide } from "swiper/react";
|
||||
import "swiper/css";
|
||||
import "swiper/css/pagination";
|
||||
import FormSurvey from "./survey";
|
||||
|
||||
const HeroModal = ({ onClose }: { onClose: () => void }) => {
|
||||
const [heroData, setHeroData] = useState<any>();
|
||||
const params = useParams();
|
||||
const locale = params?.locale;
|
||||
|
||||
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 () => {
|
||||
const response = await getHeroData();
|
||||
console.log(response);
|
||||
setHeroData(response?.data?.data?.content);
|
||||
};
|
||||
return (
|
||||
<div className="fixed inset-0 flex items-center justify-center backdrop-brightness-50 z-50 ">
|
||||
<div className="relative dark:bg-gray-900 rounded-lg w-[90%] md:w-[600px] p-4 shadow-none">
|
||||
<Swiper
|
||||
pagination={{ dynamicBullets: true }}
|
||||
modules={[Pagination, Autoplay]}
|
||||
className="mySwiper w-full"
|
||||
>
|
||||
{heroData?.map((list: any, index: number) => (
|
||||
<SwiperSlide key={list?.id}>
|
||||
<div className="relative h-[310px] lg:h-[420px]">
|
||||
<button
|
||||
onClick={onClose}
|
||||
className="absolute top-3 right-3 text-gray-700 dark:text-gray-300 hover:text-black dark:hover:text-white border border-white bg-white rounded-full h-8 w-8"
|
||||
>
|
||||
✕
|
||||
</button>
|
||||
<Image
|
||||
src={list?.thumbnailLink}
|
||||
alt="gambar-utama"
|
||||
width={1920}
|
||||
height={1080}
|
||||
placeholder={`data:image/svg+xml;base64,${toBase64(
|
||||
shimmer(700, 475)
|
||||
)}`}
|
||||
className="w-full h-[310px] lg:h-[420px] rounded-lg object-cover"
|
||||
/>
|
||||
|
||||
<div className="absolute bottom-0 left-0 right-0 bg-black/30 backdrop-brightness-50 text-white pb-4 px-4 pt-8 rounded-bl-2xl rounded-tr-2xl mx-3 mb-2">
|
||||
<div className="absolute top-0 left-0 bottom-0 w-2 bg-[#bb3523] rounded-bl-lg"></div>
|
||||
<span className="absolute top-0 left-0 mt-2 mb-3 mx-3 bg-[#bb3523] text-white text-xs font-semibold uppercase px-2 py-1 rounded">
|
||||
{list?.categoryName || "Liputan Kegiatan"}
|
||||
</span>
|
||||
|
||||
<Link href={`${locale}/image/detail/${list?.slug}`}>
|
||||
<h2 className="text-lg leading-tight">{list?.title}</h2>
|
||||
</Link>
|
||||
|
||||
<p className="text-xs flex items-center gap-1 mt-2 opacity-80">
|
||||
{formatDateToIndonesian(new Date(list?.createdAt))}{" "}
|
||||
{list?.timezone || "WIB"} |{" "}
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="1em"
|
||||
height="1em"
|
||||
viewBox="0 0 24 24"
|
||||
className="inline-block"
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M11.5 18c4 0 7.46-2.22 9.24-5.5C18.96 9.22 15.5 7 11.5 7s-7.46 2.22-9.24 5.5C4.04 15.78 7.5 18 11.5 18m0-12c4.56 0 8.5 2.65 10.36 6.5C20 16.35 16.06 19 11.5 19S3 16.35 1.14 12.5C3 8.65 6.94 6 11.5 6m0 2C14 8 16 10 16 12.5S14 17 11.5 17S7 15 7 12.5S9 8 11.5 8m0 1A3.5 3.5 0 0 0 8 12.5a3.5 3.5 0 0 0 3.5 3.5a3.5 3.5 0 0 0 3.5-3.5A3.5 3.5 0 0 0 11.5 9"
|
||||
/>
|
||||
</svg>
|
||||
{list?.clickCount}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</SwiperSlide>
|
||||
))}
|
||||
<style jsx global>{`
|
||||
.swiper-pagination-bullet {
|
||||
background: white !important;
|
||||
opacity: 0.7;
|
||||
}
|
||||
.swiper-pagination-bullet-active {
|
||||
background: white !important;
|
||||
opacity: 1;
|
||||
}
|
||||
`}</style>
|
||||
</Swiper>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const ONE_MONTH = 30 * 24 * 60 * 60 * 1000;
|
||||
|
||||
const HeroNew = (props: { group?: string }) => {
|
||||
const router = useRouter();
|
||||
const pathname = usePathname();
|
||||
const params = useParams();
|
||||
const locale = params?.locale;
|
||||
const [isLoading, setIsLoading] = useState<any>(true);
|
||||
const [heroData, setHeroData] = useState<any>();
|
||||
const [content, setContent] = useState<any>();
|
||||
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(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) => `
|
||||
<svg width="${w}" height="${h}" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<defs>
|
||||
<linearGradient id="g">
|
||||
<stop stop-color="#bcbcbd" offset="20%" />
|
||||
<stop stop-color="#f9fafb" offset="50%" />
|
||||
<stop stop-color="#bcbcbd" offset="70%" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<rect width="${w}" height="${h}" fill="#bcbcbd" />
|
||||
<rect id="r" width="${w}" height="${h}" fill="url(#g)" />
|
||||
<animate xlink:href="#r" attributeName="x" from="-${w}" to="${w}" dur="1s" repeatCount="indefinite" />
|
||||
</svg>`;
|
||||
|
||||
const toBase64 = (str: string) =>
|
||||
typeof window === "undefined"
|
||||
? Buffer.from(str).toString("base64")
|
||||
: window.btoa(str);
|
||||
|
||||
return (
|
||||
<div className="flex items-start justify-center mx-auto w-auto">
|
||||
<div className="relative">
|
||||
{showModal && <HeroModal onClose={() => setShowModal(false)} />}
|
||||
|
||||
{/* {showFormModal && <FormSurvey />} */}
|
||||
</div>
|
||||
{isLoading ? (
|
||||
<div className="flex flex-col space-y-3 mx-auto w-full lg:w-2/3">
|
||||
<Skeleton className="h-[310px] lg:h-[420px]" />
|
||||
<div className="space-y-2">
|
||||
<Skeleton className="h-4 w-[250px]" />
|
||||
<Skeleton className="h-4 w-[200px]" />
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<Carousel className="lg:w-full lg:h-full ">
|
||||
<CarouselContent>
|
||||
{content?.map((list: any) => (
|
||||
<CarouselItem key={list?.id}>
|
||||
<div className="relative h-[310px] lg:h-[700px] mt-1">
|
||||
<Image
|
||||
src={list?.thumbnailLink}
|
||||
alt="gambar-utama"
|
||||
width={1920}
|
||||
height={1080}
|
||||
placeholder={`data:image/svg+xml;base64,${toBase64(
|
||||
shimmer(700, 475)
|
||||
)}`}
|
||||
className="w-full h-[320px] lg:h-[700px] object-cover"
|
||||
/>
|
||||
<div className="absolute inset-0 bg-black bg-opacity-40" />
|
||||
|
||||
<Link
|
||||
href={
|
||||
Number(list?.fileTypeId) == 1
|
||||
? `${locale}/image/detail/${list?.slug}`
|
||||
: Number(list?.fileTypeId) == 2
|
||||
? `${locale}/video/detail/${list?.slug}`
|
||||
: Number(list?.fileTypeId) == 3
|
||||
? `${locale}/document/detail/${list?.slug}`
|
||||
: `${locale}/audio/detail/${list?.slug}`
|
||||
}
|
||||
>
|
||||
<div className="absolute bottom-20 left-32 w-[60%] lg:w-[45%] text-white px-4 pt-10 pb-4">
|
||||
<span className="absolute top-0 left-0 mb-4 mx-3 text-red-600 text-lg font-bold uppercase px-1 py-2 rounded">
|
||||
{list?.categoryName || "Liputan Kegiatan"}
|
||||
</span>
|
||||
|
||||
<h2 className="text-xl font-bold leading-tight">
|
||||
{list?.title}
|
||||
</h2>
|
||||
|
||||
<p className="text-base flex items-center gap-1 mt-2 opacity-80">
|
||||
{formatDateToIndonesian(new Date(list?.createdAt))}{" "}
|
||||
{list?.timezone || "WIB"} | 👁 {list?.clickCount}
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
<div className="hidden lg:flex flex-col gap-3 absolute bottom-4 right-4 w-[520px] bg-black/40 p-4 rounded-lg z-50">
|
||||
{heroData?.slice(0, 3).map((item: any) => (
|
||||
<li
|
||||
key={item?.id}
|
||||
className="flex gap-4 flex-row lg:w-full mx-2"
|
||||
>
|
||||
<div className="flex-shrink-0 w-32 rounded-lg">
|
||||
<Image
|
||||
placeholder={`data:image/svg+xml;base64,${toBase64(
|
||||
shimmer(700, 475)
|
||||
)}`}
|
||||
width={720}
|
||||
height={480}
|
||||
src={item?.thumbnailLink}
|
||||
alt={item?.title}
|
||||
className="w-full h-[100px] object-cover rounded-lg"
|
||||
/>
|
||||
</div>
|
||||
<div className="w-[280px] lg:w-[200px]">
|
||||
<Link
|
||||
href={
|
||||
Number(list?.fileTypeId) == 1
|
||||
? `${locale}/image/detail/${list?.slug}`
|
||||
: Number(list?.fileTypeId) == 2
|
||||
? `${locale}/video/detail/${list?.slug}`
|
||||
: Number(list?.fileTypeId) == 3
|
||||
? `${locale}/document/detail/${list?.slug}`
|
||||
: `${locale}/audio/detail/${list?.slug}`
|
||||
}
|
||||
>
|
||||
<span className=" py-1 rounded-lg flex text-red-600 font-bold uppercase w-fit">
|
||||
{item?.categoryName}
|
||||
</span>
|
||||
|
||||
<h3 className="text-base text-white font-bold h-6 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible">
|
||||
{item?.title}
|
||||
</h3>
|
||||
|
||||
<p className="text-[10px] flex flex-row items-center gap-1 text-white mt-1">
|
||||
{formatDateToIndonesian(
|
||||
new Date(item?.createdAt)
|
||||
)}{" "}
|
||||
{item?.timezone ? item?.timezone : "WIB"} |{" "}
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="1.2em"
|
||||
height="1.2em"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M11.5 18c4 0 7.46-2.22 9.24-5.5C18.96 9.22 15.5 7 11.5 7s-7.46 2.22-9.24 5.5C4.04 15.78 7.5 18 11.5 18m0-12c4.56 0 8.5 2.65 10.36 6.5C20 16.35 16.06 19 11.5 19S3 16.35 1.14 12.5C3 8.65 6.94 6 11.5 6m0 2C14 8 16 10 16 12.5S14 17 11.5 17S7 15 7 12.5S9 8 11.5 8m0 1A3.5 3.5 0 0 0 8 12.5a3.5 3.5 0 0 0 3.5 3.5a3.5 3.5 0 0 0 3.5-3.5A3.5 3.5 0 0 0 11.5 9"
|
||||
/>
|
||||
</svg>{" "}
|
||||
{item?.clickCount}
|
||||
</p>
|
||||
</Link>
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</CarouselItem>
|
||||
))}
|
||||
</CarouselContent>
|
||||
</Carousel>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default HeroNew;
|
||||
|
|
@ -494,6 +494,7 @@ const Hero = (props: { group?: string }) => {
|
|||
<TabsContent value="polda">
|
||||
{heroData
|
||||
?.filter((item: any) => item.isPublishOnPolda === true)
|
||||
|
||||
.map((item: any, index: any) => (
|
||||
<li
|
||||
key={item?.id}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,13 @@
|
|||
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "@/components/ui/carousel";
|
||||
import {
|
||||
Carousel,
|
||||
CarouselContent,
|
||||
CarouselItem,
|
||||
CarouselNext,
|
||||
CarouselPrevious,
|
||||
} from "@/components/ui/carousel";
|
||||
import { useParams, usePathname } from "next/navigation";
|
||||
import { Icon } from "@iconify/react/dist/iconify.js";
|
||||
import { formatDateToIndonesian, secondToTimes } from "@/utils/globals";
|
||||
|
|
@ -25,7 +31,11 @@ const NewContent = (props: { group: string; type: string }) => {
|
|||
const satkerName = params?.satker_name;
|
||||
const t = useTranslations("LandingPage");
|
||||
|
||||
let prefixPath = poldaName ? `/polda/${poldaName}` : satkerName ? `/satker/${satkerName}` : "/";
|
||||
let prefixPath = poldaName
|
||||
? `/polda/${poldaName}`
|
||||
: satkerName
|
||||
? `/satker/${satkerName}`
|
||||
: "/";
|
||||
|
||||
useEffect(() => {
|
||||
const timer = setTimeout(() => {
|
||||
|
|
@ -45,8 +55,26 @@ const NewContent = (props: { group: string; type: string }) => {
|
|||
page: 0,
|
||||
size: 5,
|
||||
sortBy: props.type == "popular" ? "clickCount" : "createdAt",
|
||||
contentTypeId: selectedTab == "image" ? "1" : selectedTab == "video" ? "2" : selectedTab == "text" ? "3" : selectedTab == "audio" ? "4" : "",
|
||||
group: props.group == "mabes" ? "" : props.group == "polda" && poldaName && String(poldaName)?.length > 1 ? poldaName : props.group == "satker" && satkerName && String(satkerName)?.length > 1 ? "satker-" + satkerName : "",
|
||||
contentTypeId:
|
||||
selectedTab == "image"
|
||||
? "1"
|
||||
: selectedTab == "video"
|
||||
? "2"
|
||||
: selectedTab == "text"
|
||||
? "3"
|
||||
: selectedTab == "audio"
|
||||
? "4"
|
||||
: "",
|
||||
group:
|
||||
props.group == "mabes"
|
||||
? ""
|
||||
: props.group == "polda" && poldaName && String(poldaName)?.length > 1
|
||||
? poldaName
|
||||
: props.group == "satker" &&
|
||||
satkerName &&
|
||||
String(satkerName)?.length > 1
|
||||
? "satker-" + satkerName
|
||||
: "",
|
||||
isInt: locale == "en" ? true : false,
|
||||
};
|
||||
const response = await getListContent(request);
|
||||
|
|
@ -68,56 +96,62 @@ const NewContent = (props: { group: string; type: string }) => {
|
|||
<animate xlink:href="#r" attributeName="x" from="-${w}" to="${w}" dur="1s" repeatCount="indefinite" />
|
||||
</svg>`;
|
||||
|
||||
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 (
|
||||
<div className="px-4 lg:px-16 py-4">
|
||||
<div className="px-4 py-4">
|
||||
<Reveal>
|
||||
<div className="flex flex-col p-4">
|
||||
<div className="mx-auto w-full justify-start flex px-10 flex-col lg:flex-row gap-5 mb-4">
|
||||
<h2 className="flex items-center text-xl lg:text-2xl w-fit font-bold bg-[#bb3523] px-4 py-1 rounded-lg text-white">
|
||||
<h2 className="flex items-center text-lg md:text-xl font-bold text-[#bb3523] border-b-2 border-[#bb3523] mb-4 uppercase">
|
||||
{pathname?.split("/")[1] == "in" ? (
|
||||
<>
|
||||
<span className="text-black ">{t("content")}</span>
|
||||
{props.type == "popular" ? "Terpopuler" : props.type == "latest" ? t("new") : "Serupa"}
|
||||
<span className="text-[#bb3523] ">{t("content")}</span>
|
||||
{props.type == "popular"
|
||||
? "Terpopuler"
|
||||
: props.type == "latest"
|
||||
? t("new")
|
||||
: "Serupa"}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<span className="text-black ">{props.type == "popular" ? "Popular" : props.type == "latest" ? t("new") : "Serupa"}</span>
|
||||
<span className="text-[#bb3523] ">
|
||||
{props.type == "popular"
|
||||
? "Popular"
|
||||
: props.type == "latest"
|
||||
? t("new")
|
||||
: "Serupa"}
|
||||
</span>
|
||||
|
||||
{t("content")}
|
||||
</>
|
||||
)}
|
||||
</h2>
|
||||
<div className="mx-auto w-full justify-start flex px-10 flex-col lg:flex-row gap-5 mb-4">
|
||||
<Tabs value={selectedTab} onValueChange={setSelectedTab}>
|
||||
<TabsList className="grid grid-cols-2 lg:flex lg:flex-row ">
|
||||
<TabsList className="flex gap-2 bg-transparent p-0">
|
||||
{[
|
||||
{ label: "video", value: "video" },
|
||||
{ label: "Audio", value: "audio" },
|
||||
{ label: "Foto", value: "image" },
|
||||
{ label: "Teks", value: "text" },
|
||||
].map((tab) => (
|
||||
<TabsTrigger
|
||||
value="image"
|
||||
className="relative text-xs md:text-xl font-bold text-black dark:text-white dark:bg-transparent before:absolute before:top-full before:left-0 before:h-px before:w-full data-[state=active]:before:bg-primary"
|
||||
key={tab.value}
|
||||
value={tab.value}
|
||||
className={`
|
||||
rounded-md px-4 py-2 text-sm transition-all
|
||||
bg-[#f5f5f5] text-[#666] hover:bg-[#e0e0e0]
|
||||
data-[state=active]:bg-[#bb0000]
|
||||
data-[state=active]:text-white
|
||||
data-[state=active]:font-bold
|
||||
`}
|
||||
>
|
||||
{t("image")}
|
||||
</TabsTrigger>
|
||||
<div className="text-[#bb3523] text-lg hidden md:inline-block">|</div>
|
||||
<TabsTrigger
|
||||
value="video"
|
||||
className="relative text-xs md:text-xl font-bold text-black dark:text-white dark:bg-transparent before:absolute before:top-full before:left-0 before:h-px before:w-full data-[state=active]:before:bg-primary"
|
||||
>
|
||||
{t("video")}
|
||||
</TabsTrigger>
|
||||
<div className="text-[#bb3523] text-lg hidden md:inline-block">|</div>
|
||||
<TabsTrigger
|
||||
value="text"
|
||||
className="relative text-xs md:text-xl font-bold text-black dark:text-white dark:bg-transparent before:absolute before:top-full before:left-0 before:h-px before:w-full data-[state=active]:before:bg-primary"
|
||||
>
|
||||
{t("text")}
|
||||
</TabsTrigger>
|
||||
<div className="text-[#bb3523] text-lg hidden md:inline-block">|</div>
|
||||
<TabsTrigger
|
||||
value="audio"
|
||||
className="relative text-xs md:text-xl font-bold text-black dark:text-white dark:bg-transparent before:absolute before:top-full before:left-0 before:h-px before:w-full data-[state=active]:before:bg-primary"
|
||||
>
|
||||
{t("audio")}
|
||||
{tab.label}
|
||||
</TabsTrigger>
|
||||
))}
|
||||
</TabsList>
|
||||
</Tabs>
|
||||
</div>
|
||||
|
|
@ -135,10 +169,22 @@ const NewContent = (props: { group: string; type: string }) => {
|
|||
<Carousel className="w-full mx-auto">
|
||||
<CarouselContent>
|
||||
{newContent?.map((image: any) => (
|
||||
<CarouselItem key={image?.id} className="md:basis-1/2 lg:basis-1/3">
|
||||
<div onClick={() => router.push(prefixPath + `/image/detail/${image?.slug}`)} className="cursor-pointer relative group overflow-hidden shadow-md hover:shadow-lg">
|
||||
<CarouselItem
|
||||
key={image?.id}
|
||||
className="md:basis-1/2 lg:basis-1/3"
|
||||
>
|
||||
<div
|
||||
onClick={() =>
|
||||
router.push(
|
||||
prefixPath + `/image/detail/${image?.slug}`
|
||||
)
|
||||
}
|
||||
className="cursor-pointer relative group overflow-hidden shadow-md hover:shadow-lg"
|
||||
>
|
||||
<Image
|
||||
placeholder={`data:image/svg+xml;base64,${toBase64(shimmer(700, 475))}`}
|
||||
placeholder={`data:image/svg+xml;base64,${toBase64(
|
||||
shimmer(700, 475)
|
||||
)}`}
|
||||
width={2560}
|
||||
height={1440}
|
||||
alt="image"
|
||||
|
|
@ -146,9 +192,20 @@ const NewContent = (props: { group: string; type: string }) => {
|
|||
className="w-full rounded-lg h-48 lg:h-60 object-cover group-hover:scale-100 transition-transform duration-300"
|
||||
/>
|
||||
<div className="absolute bottom-0 left-0 right-0 bg-gray-500/55 border-l-4 border-[#bb3523] rounded-lg backdrop-blur-sm text-white p-2">
|
||||
<p className="text-sm lg:text-base mb-2 font-semibold h-6 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible">{image?.title}</p>
|
||||
<p className="text-sm lg:text-base mb-2 font-semibold h-6 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible">
|
||||
{image?.title}
|
||||
</p>
|
||||
<p className="flex flex-row items-center text-[10px] gap-1">
|
||||
{formatDateToIndonesian(new Date(image?.createdAt))} {image?.timezone ? image?.timezone : "WIB"} | <Icon icon="formkit:eye" width="15" height="15" /> {image.clickCount}{" "}
|
||||
{formatDateToIndonesian(
|
||||
new Date(image?.createdAt)
|
||||
)}{" "}
|
||||
{image?.timezone ? image?.timezone : "WIB"} |{" "}
|
||||
<Icon
|
||||
icon="formkit:eye"
|
||||
width="15"
|
||||
height="15"
|
||||
/>{" "}
|
||||
{image.clickCount}{" "}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -160,7 +217,13 @@ const NewContent = (props: { group: string; type: string }) => {
|
|||
</Carousel>
|
||||
) : (
|
||||
<p className="flex items-center justify-center">
|
||||
<Image width={1920} height={1080} src="/assets/empty-data.png" alt="empty" className="h-52 w-52 my-4" />
|
||||
<Image
|
||||
width={1920}
|
||||
height={1080}
|
||||
src="/assets/empty-data.png"
|
||||
alt="empty"
|
||||
className="h-52 w-52 my-4"
|
||||
/>
|
||||
</p>
|
||||
)
|
||||
) : selectedTab == "audio" ? (
|
||||
|
|
@ -168,14 +231,27 @@ const NewContent = (props: { group: string; type: string }) => {
|
|||
<Carousel className="w-full max-w-7xl mx-auto">
|
||||
<CarouselContent>
|
||||
{newContent?.map((audio: any) => (
|
||||
<CarouselItem key={audio?.id} className="md:basis-1/2 lg:basis-1/3 ">
|
||||
<CarouselItem
|
||||
key={audio?.id}
|
||||
className="md:basis-1/2 lg:basis-1/3 "
|
||||
>
|
||||
<div className="flex flex-row gap-6">
|
||||
<div
|
||||
onClick={() => router.push(prefixPath + `/audio/detail/${audio?.slug}`)}
|
||||
onClick={() =>
|
||||
router.push(
|
||||
prefixPath + `/audio/detail/${audio?.slug}`
|
||||
)
|
||||
}
|
||||
className="cursor-pointer flex flex-row sm:flex-row items-center bg-white dark:bg-gray-800 shadow-md border rounded-lg p-4 my-3 gap-4 w-full "
|
||||
>
|
||||
<div className="flex items-center justify-center bg-red-500 text-white rounded-lg lg:w-24 h-8 lg:h-16 w-10 p-3">
|
||||
<svg width="32" height="34" viewBox="0 0 32 34" fill="null" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg
|
||||
width="32"
|
||||
height="34"
|
||||
viewBox="0 0 32 34"
|
||||
fill="null"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M23.404 0.452014C23.7033 0.35857 24.0204 0.336816 24.3297 0.388509C24.639 0.440203 24.9318 0.563895 25.1845 0.749599C25.4371 0.935304 25.6426 1.17782 25.7843 1.45756C25.9259 1.73731 25.9998 2.04644 26 2.36001V14.414C25.3462 14.2296 24.6766 14.1064 24 14.046V8.36001L10 12.736V27C10 28.1264 9.6197 29.2197 8.92071 30.1029C8.22172 30.9861 7.24499 31.6075 6.14877 31.8663C5.05255 32.125 3.90107 32.0061 2.88089 31.5287C1.86071 31.0514 1.03159 30.2435 0.52787 29.2361C0.024152 28.2286 -0.124656 27.0806 0.105556 25.9781C0.335768 24.8755 0.931513 23.883 1.79627 23.1613C2.66102 22.4396 3.74413 22.031 4.87009 22.0017C5.99606 21.9724 7.09893 22.3242 8.00001 23V6.73601C7.99982 6.30956 8.13596 5.8942 8.38854 5.55059C8.64112 5.20698 8.99692 4.9531 9.40401 4.82601L23.404 0.452014ZM10 10.64L24 6.26601V2.36001L10 6.73601V10.64ZM5.00001 24C4.20436 24 3.44129 24.3161 2.87869 24.8787C2.31608 25.4413 2.00001 26.2044 2.00001 27C2.00001 27.7957 2.31608 28.5587 2.87869 29.1213C3.44129 29.6839 4.20436 30 5.00001 30C5.79566 30 6.55872 29.6839 7.12133 29.1213C7.68394 28.5587 8.00001 27.7957 8.00001 27C8.00001 26.2044 7.68394 25.4413 7.12133 24.8787C6.55872 24.3161 5.79566 24 5.00001 24ZM32 25C32 27.387 31.0518 29.6761 29.364 31.364C27.6761 33.0518 25.387 34 23 34C20.6131 34 18.3239 33.0518 16.636 31.364C14.9482 29.6761 14 27.387 14 25C14 22.6131 14.9482 20.3239 16.636 18.6361C18.3239 16.9482 20.6131 16 23 16C25.387 16 27.6761 16.9482 29.364 18.6361C31.0518 20.3239 32 22.6131 32 25ZM27.47 24.128L21.482 20.828C21.3298 20.7443 21.1583 20.7016 20.9846 20.7043C20.8108 20.707 20.6408 20.7549 20.4912 20.8433C20.3416 20.9317 20.2176 21.0576 20.1315 21.2086C20.0453 21.3595 20 21.5302 20 21.704V28.304C20 28.4778 20.0453 28.6486 20.1315 28.7995C20.2176 28.9504 20.3416 29.0763 20.4912 29.1647C20.6408 29.2531 20.8108 29.301 20.9846 29.3037C21.1583 29.3064 21.3298 29.2638 21.482 29.18L27.47 25.88C27.6268 25.7937 27.7575 25.6669 27.8486 25.5128C27.9397 25.3587 27.9877 25.183 27.9877 25.004C27.9877 24.825 27.9397 24.6493 27.8486 24.4952C27.7575 24.3412 27.6268 24.2143 27.47 24.128Z"
|
||||
fill="white"
|
||||
|
|
@ -185,11 +261,27 @@ const NewContent = (props: { group: string; type: string }) => {
|
|||
|
||||
<div className="flex flex-col flex-1">
|
||||
<div className="text-gray-500 dark:text-gray-400 flex flex-row text-sm text-center items-center">
|
||||
{formatDateToIndonesian(new Date(audio?.createdAt))} {audio?.timezone ? audio?.timezone : "WIB"} | <Icon icon="formkit:eye" width="15" height="15" />
|
||||
{formatDateToIndonesian(
|
||||
new Date(audio?.createdAt)
|
||||
)}{" "}
|
||||
{audio?.timezone ? audio?.timezone : "WIB"}{" "}
|
||||
| {" "}
|
||||
<Icon
|
||||
icon="formkit:eye"
|
||||
width="15"
|
||||
height="15"
|
||||
/>
|
||||
{audio?.clickCount}{" "}
|
||||
</div>
|
||||
<div className="font-semibold text-gray-900 dark:text-white mt-1 text-sm h-5 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible">{audio?.title}</div>
|
||||
<p className="text-sm"> {audio?.duration ? secondToTimes(Number(audio?.duration)) : "00:00:00"}</p>
|
||||
<div className="font-semibold text-gray-900 dark:text-white mt-1 text-sm h-5 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible">
|
||||
{audio?.title}
|
||||
</div>
|
||||
<p className="text-sm">
|
||||
{" "}
|
||||
{audio?.duration
|
||||
? secondToTimes(Number(audio?.duration))
|
||||
: "00:00:00"}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -201,7 +293,13 @@ const NewContent = (props: { group: string; type: string }) => {
|
|||
</Carousel>
|
||||
) : (
|
||||
<p className="flex items-center justify-center">
|
||||
<Image width={1920} height={1080} src="/assets/empty-data.png" alt="empty" className="h-52 w-52 my-4" />
|
||||
<Image
|
||||
width={1920}
|
||||
height={1080}
|
||||
src="/assets/empty-data.png"
|
||||
alt="empty"
|
||||
className="h-52 w-52 my-4"
|
||||
/>
|
||||
</p>
|
||||
)
|
||||
) : selectedTab == "video" ? (
|
||||
|
|
@ -209,10 +307,22 @@ const NewContent = (props: { group: string; type: string }) => {
|
|||
<Carousel className="w-full max-w-7xl mx-auto">
|
||||
<CarouselContent>
|
||||
{newContent?.map((video: any) => (
|
||||
<CarouselItem key={video?.id} className="md:basis-1/2 lg:basis-1/3">
|
||||
<div onClick={() => router.push(prefixPath + `/video/detail/${video?.slug}`)} className="cursor-pointer relative group rounded-md overflow-hidden shadow-md hover:shadow-lg">
|
||||
<CarouselItem
|
||||
key={video?.id}
|
||||
className="md:basis-1/2 lg:basis-1/3"
|
||||
>
|
||||
<div
|
||||
onClick={() =>
|
||||
router.push(
|
||||
prefixPath + `/video/detail/${video?.slug}`
|
||||
)
|
||||
}
|
||||
className="cursor-pointer relative group rounded-md overflow-hidden shadow-md hover:shadow-lg"
|
||||
>
|
||||
<Image
|
||||
placeholder={`data:image/svg+xml;base64,${toBase64(shimmer(700, 475))}`}
|
||||
placeholder={`data:image/svg+xml;base64,${toBase64(
|
||||
shimmer(700, 475)
|
||||
)}`}
|
||||
alt="video"
|
||||
width={2560}
|
||||
height={1440}
|
||||
|
|
@ -220,9 +330,20 @@ const NewContent = (props: { group: string; type: string }) => {
|
|||
className="w-full h-40 lg:h-60 object-cover rounded-lg group-hover:scale-100 transition-transform duration-300"
|
||||
/>
|
||||
<div className="absolute bottom-0 rounded-lg left-0 right-0 border-l-4 border-[#bb3523] bg-gray-600 text-white p-2">
|
||||
<p className="text-sm lg:text-base mb-2 font-semibold h-6 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible">{video?.title}</p>
|
||||
<p className="text-sm lg:text-base mb-2 font-semibold h-6 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible">
|
||||
{video?.title}
|
||||
</p>
|
||||
<p className="flex flex-row items-center text-[10px] gap-1">
|
||||
{formatDateToIndonesian(new Date(video?.createdAt))} {video?.timezone ? video?.timezone : "WIB"}| <Icon icon="formkit:eye" width="15" height="15" /> {video?.clickCount}{" "}
|
||||
{formatDateToIndonesian(
|
||||
new Date(video?.createdAt)
|
||||
)}{" "}
|
||||
{video?.timezone ? video?.timezone : "WIB"}|{" "}
|
||||
<Icon
|
||||
icon="formkit:eye"
|
||||
width="15"
|
||||
height="15"
|
||||
/>{" "}
|
||||
{video?.clickCount}{" "}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -234,18 +355,40 @@ const NewContent = (props: { group: string; type: string }) => {
|
|||
</Carousel>
|
||||
) : (
|
||||
<p className="flex items-center justify-center">
|
||||
<Image width={1920} height={1080} src="/assets/empty-data.png" alt="empty" className="h-52 w-52 my-4" />
|
||||
<Image
|
||||
width={1920}
|
||||
height={1080}
|
||||
src="/assets/empty-data.png"
|
||||
alt="empty"
|
||||
className="h-52 w-52 my-4"
|
||||
/>
|
||||
</p>
|
||||
)
|
||||
) : newContent.length > 0 ? (
|
||||
<Carousel className="w-full max-w-7xl mx-auto">
|
||||
<CarouselContent>
|
||||
{newContent?.map((text: any) => (
|
||||
<CarouselItem key={text?.id} className="md:basis-1/2 lg:basis-1/3">
|
||||
<CarouselItem
|
||||
key={text?.id}
|
||||
className="md:basis-1/2 lg:basis-1/3"
|
||||
>
|
||||
<div className="md:basis-1/2 lg:basis-1/3">
|
||||
<div onClick={() => router.push(prefixPath + `/document/detail/${text?.slug}`)} className="flex flex-row bg-yellow-500 sm:flex-row items-center dark:bg-gray-800 cursor-pointer shadow-md rounded-lg p-4 gap-4">
|
||||
<div
|
||||
onClick={() =>
|
||||
router.push(
|
||||
prefixPath + `/document/detail/${text?.slug}`
|
||||
)
|
||||
}
|
||||
className="flex flex-row bg-yellow-500 sm:flex-row items-center dark:bg-gray-800 cursor-pointer shadow-md rounded-lg p-4 gap-4"
|
||||
>
|
||||
<div className="flex items-center justify-center rounded-lg w-16 h-2 lg:h-16">
|
||||
<svg width="28" height="34" viewBox="0 0 28 34" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg
|
||||
width="28"
|
||||
height="34"
|
||||
viewBox="0 0 28 34"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M5.6665 17.4167C5.6665 17.0851 5.7982 16.7672 6.03262 16.5328C6.26704 16.2984 6.58498 16.1667 6.9165 16.1667C7.24802 16.1667 7.56597 16.2984 7.80039 16.5328C8.03481 16.7672 8.1665 17.0851 8.1665 17.4167C8.1665 17.7482 8.03481 18.0661 7.80039 18.3005C7.56597 18.535 7.24802 18.6667 6.9165 18.6667C6.58498 18.6667 6.26704 18.535 6.03262 18.3005C5.7982 18.0661 5.6665 17.7482 5.6665 17.4167ZM6.9165 21.1667C6.58498 21.1667 6.26704 21.2984 6.03262 21.5328C5.7982 21.7672 5.6665 22.0851 5.6665 22.4167C5.6665 22.7482 5.7982 23.0661 6.03262 23.3005C6.26704 23.535 6.58498 23.6667 6.9165 23.6667C7.24802 23.6667 7.56597 23.535 7.80039 23.3005C8.03481 23.0661 8.1665 22.7482 8.1665 22.4167C8.1665 22.0851 8.03481 21.7672 7.80039 21.5328C7.56597 21.2984 7.24802 21.1667 6.9165 21.1667ZM5.6665 27.4167C5.6665 27.0851 5.7982 26.7672 6.03262 26.5328C6.26704 26.2984 6.58498 26.1667 6.9165 26.1667C7.24802 26.1667 7.56597 26.2984 7.80039 26.5328C8.03481 26.7672 8.1665 27.0851 8.1665 27.4167C8.1665 27.7482 8.03481 28.0661 7.80039 28.3005C7.56597 28.535 7.24802 28.6667 6.9165 28.6667C6.58498 28.6667 6.26704 28.535 6.03262 28.3005C5.7982 28.0661 5.6665 27.7482 5.6665 27.4167ZM11.9165 16.1667C11.585 16.1667 11.267 16.2984 11.0326 16.5328C10.7982 16.7672 10.6665 17.0851 10.6665 17.4167C10.6665 17.7482 10.7982 18.0661 11.0326 18.3005C11.267 18.535 11.585 18.6667 11.9165 18.6667H21.0832C21.4147 18.6667 21.7326 18.535 21.9671 18.3005C22.2015 18.0661 22.3332 17.7482 22.3332 17.4167C22.3332 17.0851 22.2015 16.7672 21.9671 16.5328C21.7326 16.2984 21.4147 16.1667 21.0832 16.1667H11.9165ZM10.6665 22.4167C10.6665 22.0851 10.7982 21.7672 11.0326 21.5328C11.267 21.2984 11.585 21.1667 11.9165 21.1667H21.0832C21.4147 21.1667 21.7326 21.2984 21.9671 21.5328C22.2015 21.7672 22.3332 22.0851 22.3332 22.4167C22.3332 22.7482 22.2015 23.0661 21.9671 23.3005C21.7326 23.535 21.4147 23.6667 21.0832 23.6667H11.9165C11.585 23.6667 11.267 23.535 11.0326 23.3005C10.7982 23.0661 10.6665 22.7482 10.6665 22.4167ZM11.9165 26.1667C11.585 26.1667 11.267 26.2984 11.0326 26.5328C10.7982 26.7672 10.6665 27.0851 10.6665 27.4167C10.6665 27.7482 10.7982 28.0661 11.0326 28.3005C11.267 28.535 11.585 28.6667 11.9165 28.6667H21.0832C21.4147 28.6667 21.7326 28.535 21.9671 28.3005C22.2015 28.0661 22.3332 27.7482 22.3332 27.4167C22.3332 27.0851 22.2015 26.7672 21.9671 26.5328C21.7326 26.2984 21.4147 26.1667 21.0832 26.1667H11.9165ZM26.3565 11.0233L16.6415 1.31C16.6157 1.28605 16.5885 1.26378 16.5598 1.24333C16.5392 1.22742 16.5192 1.21074 16.4998 1.19333C16.3852 1.08512 16.2632 0.984882 16.1348 0.893332C16.0922 0.865802 16.0476 0.841298 16.0015 0.819999L15.9215 0.779999L15.8382 0.731666C15.7482 0.679999 15.6565 0.626665 15.5615 0.586665C15.2296 0.454104 14.8783 0.376423 14.5215 0.356665C14.4885 0.354519 14.4557 0.350625 14.4232 0.344999C14.3779 0.338012 14.3323 0.334114 14.2865 0.333332H3.99984C3.11578 0.333332 2.26794 0.684521 1.64281 1.30964C1.01769 1.93476 0.666504 2.78261 0.666504 3.66667V30.3333C0.666504 31.2174 1.01769 32.0652 1.64281 32.6904C2.26794 33.3155 3.11578 33.6667 3.99984 33.6667H23.9998C24.8839 33.6667 25.7317 33.3155 26.3569 32.6904C26.982 32.0652 27.3332 31.2174 27.3332 30.3333V13.38C27.333 12.496 26.9817 11.6483 26.3565 11.0233ZM24.8332 30.3333C24.8332 30.5543 24.7454 30.7663 24.5891 30.9226C24.4328 31.0789 24.2208 31.1667 23.9998 31.1667H3.99984C3.77882 31.1667 3.56686 31.0789 3.41058 30.9226C3.2543 30.7663 3.1665 30.5543 3.1665 30.3333V3.66667C3.1665 3.44565 3.2543 3.23369 3.41058 3.07741C3.56686 2.92113 3.77882 2.83333 3.99984 2.83333H13.9998V10.3333C13.9998 11.2174 14.351 12.0652 14.9761 12.6904C15.6013 13.3155 16.4491 13.6667 17.3332 13.6667H24.8332V30.3333ZM16.4998 4.70166L22.9632 11.1667H17.3332C17.1122 11.1667 16.9002 11.0789 16.7439 10.9226C16.5876 10.7663 16.4998 10.5543 16.4998 10.3333V4.70166Z"
|
||||
fill="black"
|
||||
|
|
@ -255,15 +398,31 @@ const NewContent = (props: { group: string; type: string }) => {
|
|||
|
||||
<div className="flex w-full pr-10 flex-col flex-1">
|
||||
<div className="text-gray-500 dark:text-gray-400 flex flex-row items-center text-xs gap-0 lg:gap-1 mt-1 lg:text-sm">
|
||||
{formatDateToIndonesian(new Date(text?.createdAt))}
|
||||
{formatDateToIndonesian(
|
||||
new Date(text?.createdAt)
|
||||
)}
|
||||
{text?.timezone ? text?.timezone : "WIB"}|
|
||||
<Icon icon="formkit:eye" width="15" height="15" />
|
||||
<Icon
|
||||
icon="formkit:eye"
|
||||
width="15"
|
||||
height="15"
|
||||
/>
|
||||
{text?.clickCount}
|
||||
</div>
|
||||
<div className="font-semibold text-gray-900 dark:text-white mt-1 text-sm h-5 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible ">{text?.title}</div>
|
||||
<div className="font-semibold text-gray-900 dark:text-white mt-1 text-sm h-5 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible ">
|
||||
{text?.title}
|
||||
</div>
|
||||
<div className="flex gap-2 items-center text-sm text-red-500 dark:text-red-500">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 512 512">
|
||||
<path fill="#f00" d="M224 30v256h-64l96 128l96-128h-64V30zM32 434v48h448v-48z" />
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="1em"
|
||||
height="1em"
|
||||
viewBox="0 0 512 512"
|
||||
>
|
||||
<path
|
||||
fill="#f00"
|
||||
d="M224 30v256h-64l96 128l96-128h-64V30zM32 434v48h448v-48z"
|
||||
/>
|
||||
</svg>
|
||||
Download {t("document")}
|
||||
</div>
|
||||
|
|
@ -278,14 +437,27 @@ const NewContent = (props: { group: string; type: string }) => {
|
|||
</Carousel>
|
||||
) : (
|
||||
<p className="flex items-center justify-center">
|
||||
<Image width={1920} height={1080} src="/assets/empty-data.png" alt="empty" className="h-52 w-52 my-4" />
|
||||
<Image
|
||||
width={1920}
|
||||
height={1080}
|
||||
src="/assets/empty-data.png"
|
||||
alt="empty"
|
||||
className="h-52 w-52 my-4"
|
||||
/>
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex items-center flex-row justify-center">
|
||||
<div onClick={() => router.push(prefixPath + `/${selectedTab}/filter?sortBy=${props.type}`)} className="cursor-pointer border text-[#bb3523] rounded-lg text-sm lg:text-md px-4 py-1 border-[#bb3523]">
|
||||
<div
|
||||
onClick={() =>
|
||||
router.push(
|
||||
prefixPath + `/${selectedTab}/filter?sortBy=${props.type}`
|
||||
)
|
||||
}
|
||||
className="cursor-pointer border text-[#bb3523] rounded-lg text-sm lg:text-md px-4 py-1 border-[#bb3523]"
|
||||
>
|
||||
{t("seeAll")}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,278 @@
|
|||
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 ScrollableContent = () => {
|
||||
const [contentType, setContentType] = useState("all");
|
||||
const [search, setSearch] = useState("");
|
||||
const router = useRouter();
|
||||
const params = useParams();
|
||||
const locale = params?.locale;
|
||||
const t = useTranslations("LandingPage");
|
||||
const [content, setContent] = useState<any>();
|
||||
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 (
|
||||
<>
|
||||
<div className="text-center">
|
||||
<h1 className="text-2xl md:text-3xl font-bold text-gray-800 dark:text-white">
|
||||
<span className="text-[#bb3523] dark:text-white">
|
||||
{t("exploration")}
|
||||
</span>{" "}
|
||||
{t("and")}{" "}
|
||||
<span className="text-[#bb3523] dark:text-white">
|
||||
{t("download")}
|
||||
</span>{" "}
|
||||
{t("coverage")}{" "}
|
||||
</h1>
|
||||
<div className="w-[80%] h-1 bg-[#bb3523] mx-auto mt-2"></div>
|
||||
<p className="text-sm md:text-base text-gray-500 dark:text-gray-100 mt-4">
|
||||
{t("officialCoverage")}
|
||||
</p>
|
||||
|
||||
<div className="mt-6 flex flex-col md:flex-row justify-center gap-4">
|
||||
<div className="flex flex-row items-center w-full rounded-lg gap-2 overflow-hidden">
|
||||
<Select value={contentType} onValueChange={setContentType}>
|
||||
<SelectTrigger className="w-[180px]">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectItem value="all">{t("allContent")}</SelectItem>
|
||||
<SelectItem value="image">{t("image")}</SelectItem>
|
||||
<SelectItem value="video">{t("video")}</SelectItem>
|
||||
<SelectItem value="document">{t("text")}</SelectItem>
|
||||
<SelectItem value="audio">{t("audio")}</SelectItem>
|
||||
</SelectGroup>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<div className="flex items-center flex-1 border border-gray-300 rounded-lg overflow-hidden">
|
||||
<span className="material-icons text-black dark:text-white px-4">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="1em"
|
||||
height="1em"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="m19.6 21l-6.3-6.3q-.75.6-1.725.95T9.5 16q-2.725 0-4.612-1.888T3 9.5t1.888-4.612T9.5 3t4.613 1.888T16 9.5q0 1.1-.35 2.075T14.7 13.3l6.3 6.3zM9.5 14q1.875 0 3.188-1.312T14 9.5t-1.312-3.187T9.5 5T6.313 6.313T5 9.5t1.313 3.188T9.5 14"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
<input
|
||||
type="text"
|
||||
placeholder={t("search")}
|
||||
className="w-full py-2 px-2 text-sm text-gray-700 dark:text-gray-100 focus:outline-none"
|
||||
onChange={(e) => setSearch(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
onClick={() =>
|
||||
router.push(`/${contentType}/filter?title=${search}`)
|
||||
}
|
||||
className="flex justify-center items-center px-6 w-full lg:w-[20%] py-2 bg-[#bb3523] gap-2 text-white rounded-lg hover:bg-red-700"
|
||||
>
|
||||
{t("searchCoverage")}
|
||||
<Icon icon="ri:arrow-right-s-line" fontSize={20} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex flex-col md:flex-row gap-6 py-8">
|
||||
<div className="w-full md:w-1/2 px-4">
|
||||
<h2 className="text-lg md:text-xl font-bold text-[#bb3523] border-b-2 border-[#bb3523] mb-4 uppercase">
|
||||
Berita Polda
|
||||
</h2>
|
||||
<div className="grid gap-4">
|
||||
{content?.slice(0, 4).map((item: any, index: number) => (
|
||||
<div
|
||||
key={index}
|
||||
className={`bg-white rounded-lg shadow-md overflow-hidden ${
|
||||
index === 0 ? "" : "flex"
|
||||
}`}
|
||||
>
|
||||
<div
|
||||
className={`relative ${
|
||||
index === 0 ? "w-full h-48" : " w-1/2 h-[150px]"
|
||||
}`}
|
||||
>
|
||||
<Link
|
||||
href={
|
||||
Number(item?.fileTypeId) == 1
|
||||
? `${locale}/image/detail/${item?.slug}`
|
||||
: Number(item?.fileTypeId) == 2
|
||||
? `${locale}/video/detail/${item?.slug}`
|
||||
: Number(item?.fileTypeId) == 3
|
||||
? `${locale}/document/detail/${item?.slug}`
|
||||
: `${locale}/audio/detail/${item?.slug}`
|
||||
}
|
||||
>
|
||||
<Image
|
||||
src={item.thumbnailLink}
|
||||
alt={item.title}
|
||||
layout="fill"
|
||||
objectFit="cover"
|
||||
/>
|
||||
<div className="absolute top-2 right-2 bg-white rounded-full p-1 shadow">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="1.5em"
|
||||
height="1.5em"
|
||||
viewBox="0 0 24 24"
|
||||
fill="currentColor"
|
||||
>
|
||||
<path d="M21 19V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2m-2 0H5V5h14ZM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5Z" />
|
||||
</svg>
|
||||
</div>
|
||||
</Link>
|
||||
</div>
|
||||
{/* <Link
|
||||
href={
|
||||
Number(item?.fileTypeId) == 1
|
||||
? `${locale}/image/detail/${item?.slug}`
|
||||
: Number(item?.fileTypeId) == 2
|
||||
? `${locale}/video/detail/${item?.slug}`
|
||||
: Number(item?.fileTypeId) == 3
|
||||
? `${locale}/document/detail/${item?.slug}`
|
||||
: `${locale}/audio/detail/${item?.slug}`
|
||||
}
|
||||
> */}
|
||||
<div className={`${index === 0 ? "p-4" : "p-3 w-[50%]"}`}>
|
||||
<p className="text-sm text-[#bb3523] font-bold mb-1">
|
||||
{item.categoryName}
|
||||
</p>
|
||||
<h3 className="text-sm font-semibold text-gray-800">
|
||||
{item.title}
|
||||
</h3>
|
||||
<p className="text-xs text-gray-500 mt-1 truncate">
|
||||
{htmlToString(item.description)}
|
||||
</p>
|
||||
</div>
|
||||
{/* </Link> */}
|
||||
</div>
|
||||
))}
|
||||
<button className="w-full mt-2 py-2 border border-[#bb3523] text-[#bb3523] rounded-lg font-semibold hover:bg-[#bb3523] hover:text-white transition">
|
||||
LIHAT SEMUA
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Berita SATKER */}
|
||||
<div className="w-full md:w-1/2 px-4">
|
||||
<h2 className="text-lg md:text-xl font-bold text-[#bb3523] border-b-2 border-[#bb3523] mb-4 uppercase">
|
||||
Berita Satker
|
||||
</h2>
|
||||
<div className="grid gap-4">
|
||||
{content
|
||||
?.filter((item: any) => item.isPublishOnPolda === true)
|
||||
.slice(0, 4)
|
||||
.map((item: any, index: number) => (
|
||||
<div
|
||||
key={index}
|
||||
className={`bg-white rounded-lg shadow-md overflow-hidden ${
|
||||
index === 0 ? "" : "flex"
|
||||
}`}
|
||||
>
|
||||
<div
|
||||
className={`relative ${
|
||||
index === 0 ? "w-full h-48" : " w-1/2 h-[150px]"
|
||||
}`}
|
||||
>
|
||||
<Link
|
||||
href={
|
||||
Number(item?.fileTypeId) == 1
|
||||
? `${locale}/image/detail/${item?.slug}`
|
||||
: Number(item?.fileTypeId) == 2
|
||||
? `${locale}/video/detail/${item?.slug}`
|
||||
: Number(item?.fileTypeId) == 3
|
||||
? `${locale}/document/detail/${item?.slug}`
|
||||
: `${locale}/audio/detail/${item?.slug}`
|
||||
}
|
||||
>
|
||||
<Image
|
||||
src={item.thumbnailLink}
|
||||
alt={item.title}
|
||||
layout="fill"
|
||||
objectFit="cover"
|
||||
/>
|
||||
<div className="absolute top-2 right-2 bg-white rounded-full p-1 shadow">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="1.5em"
|
||||
height="1.5em"
|
||||
viewBox="0 0 24 24"
|
||||
fill="currentColor"
|
||||
>
|
||||
<path d="M21 19V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2m-2 0H5V5h14ZM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5Z" />
|
||||
</svg>
|
||||
</div>
|
||||
</Link>
|
||||
</div>
|
||||
<div className={`${index === 0 ? "p-4" : "p-3 w-[50%]"}`}>
|
||||
<p className="text-sm text-[#bb3523] font-bold mb-1">
|
||||
{item.categoryName}
|
||||
</p>
|
||||
<h3 className="text-sm font-semibold text-gray-800">
|
||||
{item.title}
|
||||
</h3>
|
||||
<p className="text-xs text-gray-500 mt-1 truncate">
|
||||
{htmlToString(item.description)}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
<button className="w-full mt-2 py-2 border border-[#bb3523] text-[#bb3523] rounded-lg font-semibold hover:bg-[#bb3523] hover:text-white transition">
|
||||
LIHAT SEMUA
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default ScrollableContent;
|
||||
|
|
@ -1,64 +1,63 @@
|
|||
import React, { useState } from "react";
|
||||
import { Icon } from "@iconify/react/dist/iconify.js";
|
||||
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import { useRouter } from "@/i18n/routing";
|
||||
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";
|
||||
|
||||
const LeftBanner = () => (
|
||||
<div className="sticky top-0 space-y-4">
|
||||
<img src="/images/all-img/kiri1.png" alt="Banner Kiri 1" />
|
||||
<img src="/images/all-img/kiri2.png" alt="Banner Kiri 2" />
|
||||
</div>
|
||||
);
|
||||
|
||||
const RightBanner = () => (
|
||||
<div className="sticky top-0 space-y-4">
|
||||
<img src="/images/all-img/kanan2.png" alt="Banner Kanan 1" />
|
||||
<img src="/images/all-img/kanan1.png" alt="Banner Kanan 2" />
|
||||
</div>
|
||||
);
|
||||
|
||||
const SearchSection = () => {
|
||||
const [contentType, setContentType] = useState("all");
|
||||
const [search, setSearch] = useState("");
|
||||
const router = useRouter();
|
||||
const t = useTranslations("LandingPage");
|
||||
|
||||
return (
|
||||
<section className="w-full py-8 px-4 lg:px-24">
|
||||
<div className="text-center">
|
||||
{/* Heading */}
|
||||
<h1 className="text-2xl md:text-3xl font-bold text-gray-800 dark:text-white">
|
||||
<span className="text-[#bb3523] dark:text-white">{t("exploration")}</span> {t("and")} <span className="text-[#bb3523] dark:text-white">{t("download")}</span> {t("coverage")}{" "}
|
||||
</h1>
|
||||
<div className="w-[80%] h-1 bg-[#bb3523] mx-auto mt-2"></div>
|
||||
<p className="text-sm md:text-base text-gray-500 dark:text-gray-100 mt-4">{t("officialCoverage")}</p>
|
||||
|
||||
{/* Search Form */}
|
||||
<div className="mt-6 flex flex-col md:flex-row justify-center gap-4">
|
||||
{/* Dropdown */}
|
||||
<div className="flex flex-row items-center w-full rounded-lg gap-2 overflow-hidden">
|
||||
<Select value={contentType} onValueChange={setContentType}>
|
||||
<SelectTrigger className="w-[180px]">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectItem value="all">{t("allContent")}</SelectItem>
|
||||
<SelectItem value="image">{t("image")}</SelectItem>
|
||||
<SelectItem value="video">{t("video")}</SelectItem>
|
||||
<SelectItem value="document">{t("text")}</SelectItem>
|
||||
<SelectItem value="audio">{t("audio")}</SelectItem>
|
||||
</SelectGroup>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<div className="flex items-center flex-1 border border-gray-300 rounded-lg overflow-hidden">
|
||||
<span className="material-icons text-black dark:text-white px-4">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="m19.6 21l-6.3-6.3q-.75.6-1.725.95T9.5 16q-2.725 0-4.612-1.888T3 9.5t1.888-4.612T9.5 3t4.613 1.888T16 9.5q0 1.1-.35 2.075T14.7 13.3l6.3 6.3zM9.5 14q1.875 0 3.188-1.312T14 9.5t-1.312-3.187T9.5 5T6.313 6.313T5 9.5t1.313 3.188T9.5 14"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
<input type="text" placeholder={t("search")} className="w-full py-2 px-2 text-sm text-gray-700 dark:text-gray-100 focus:outline-none" onChange={(e) => setSearch(e.target.value)} />
|
||||
</div>
|
||||
<div className="flex w-full h-full bg-gray-100 dark:bg-zinc-800">
|
||||
<div className="hidden xl:block w-[15%] pr-4 py-8">
|
||||
<LeftBanner />
|
||||
</div>
|
||||
|
||||
{/* Search Input */}
|
||||
<button onClick={() => router.push(`/${contentType}/filter?title=${search}`)} className="flex justify-center items-center px-6 w-full lg:w-[20%] py-2 bg-[#bb3523] gap-2 text-white rounded-lg hover:bg-red-700">
|
||||
{t("searchCoverage")}
|
||||
<Icon icon="ri:arrow-right-s-line" fontSize={20} />
|
||||
</button>
|
||||
<div className="w-full xl:w-[70%] h-full overflow-y-auto px-4 py-8">
|
||||
<ScrollableContent />
|
||||
<NewContent group="mabes" type="latest" />
|
||||
<NewContent group="mabes" type="popular" />
|
||||
<ContentCategory group="mabes" type="popular" />
|
||||
<AreaCoverageWorkUnits />
|
||||
<EventCalender />
|
||||
<UserSurveyBox />
|
||||
</div>
|
||||
|
||||
<div className="hidden xl:block w-[15%] pl-4 py-8">
|
||||
<RightBanner />
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,259 @@
|
|||
import React, { useState } from "react";
|
||||
import {
|
||||
Dialog,
|
||||
DialogClose,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from "../ui/dialog";
|
||||
import FormSurvey from "./survey";
|
||||
import { Controller, useForm } from "react-hook-form";
|
||||
import { Textarea } from "../ui/textarea";
|
||||
import { Button } from "../ui/button";
|
||||
import { z } from "zod";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { Checkbox } from "../ui/checkbox";
|
||||
import { createSurveyData } from "@/service/survey/survey";
|
||||
|
||||
const surveySchema = z.object({
|
||||
accessFrequency: z.string(),
|
||||
uiExperienceDesign: z.string(),
|
||||
uiExperienceNavigation: z.string(),
|
||||
uiExperienceSpeed: z.string(),
|
||||
infoAccuracy: z.string(),
|
||||
infoCompleteness: z.string(),
|
||||
usefulness: z.string(),
|
||||
suggestion: z.string().optional(),
|
||||
});
|
||||
|
||||
type SurveySchema = z.infer<typeof surveySchema>;
|
||||
|
||||
const UserSurveyBox = () => {
|
||||
const [openPolda, setOpenPolda] = useState<any>();
|
||||
const [showSurvey, setShowSurvey] = useState(true);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const {
|
||||
control,
|
||||
handleSubmit,
|
||||
formState: { errors },
|
||||
} = useForm<SurveySchema>({
|
||||
resolver: zodResolver(surveySchema),
|
||||
mode: "all",
|
||||
defaultValues: {
|
||||
accessFrequency: "",
|
||||
uiExperienceDesign: "",
|
||||
uiExperienceNavigation: "",
|
||||
uiExperienceSpeed: "",
|
||||
infoAccuracy: "",
|
||||
infoCompleteness: "",
|
||||
usefulness: "",
|
||||
suggestion: "",
|
||||
},
|
||||
});
|
||||
|
||||
const options = {
|
||||
accessFrequency: [
|
||||
"Setiap hari",
|
||||
"Beberapa kali seminggu",
|
||||
"Beberapa kali dalam sebulan",
|
||||
"Baru pertama kali",
|
||||
],
|
||||
uiExperienceDesign: ["Sangat baik", "Baik", "Cukup", "Kurang", "Buruk"],
|
||||
uiExperienceNavigation: [
|
||||
"Sangat mudah",
|
||||
"Mudah",
|
||||
"Cukup",
|
||||
"Sulit",
|
||||
"Sangat sulit",
|
||||
],
|
||||
uiExperienceSpeed: [
|
||||
"Sangat cepat",
|
||||
"Cepat",
|
||||
"Cukup",
|
||||
"Lambat",
|
||||
"Sangat lambat",
|
||||
],
|
||||
infoAccuracy: ["Sangat puas", "Puas", "Cukup", "Kurang puas", "Tidak puas"],
|
||||
infoCompleteness: [
|
||||
"Sangat lengkap",
|
||||
"Lengkap",
|
||||
"Cukup",
|
||||
"Kurang lengkap",
|
||||
"Tidak lengkap",
|
||||
],
|
||||
usefulness: [
|
||||
"Sangat membantu",
|
||||
"Membantu",
|
||||
"Cukup membantu",
|
||||
"Kurang membantu",
|
||||
"Tidak membantu",
|
||||
],
|
||||
};
|
||||
|
||||
const renderControllerGroup = (
|
||||
name: keyof SurveySchema,
|
||||
question: string,
|
||||
choices: string[]
|
||||
) => (
|
||||
<div className="space-y-2">
|
||||
<p className="font-medium">{question}</p>
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
{choices.map((choice, i) => (
|
||||
<Controller
|
||||
key={i}
|
||||
name={name}
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<label className="flex items-center space-x-2">
|
||||
<Checkbox
|
||||
checked={field.value === choice}
|
||||
onCheckedChange={() => field.onChange(choice)}
|
||||
/>
|
||||
<span>{choice}</span>
|
||||
</label>
|
||||
)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
{errors[name] && (
|
||||
<p className="text-red-500 text-sm">
|
||||
{errors[name]?.message as string}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
const onSubmit = async (data: SurveySchema) => {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const response = await createSurveyData(data);
|
||||
console.log("API Response:", response);
|
||||
setShowSurvey(false);
|
||||
} catch (error) {
|
||||
console.error("Error submitting survey:", error);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
return (
|
||||
<div className="mt-8 rounded-lg bg-white dark:bg-zinc-900 p-4 shadow">
|
||||
<h2 className="text-lg font-bold mb-2">
|
||||
SURVEI KEPUASAN PENGGUNA MEDIAHUB POLRI
|
||||
</h2>
|
||||
<p className="text-sm text-gray-700 dark:text-gray-300 mb-4">
|
||||
Kami menghargai pendapat Anda! Survei ini bertujuan untuk meningkatkan
|
||||
kualitas layanan MediaHub Polri. Mohon luangkan waktu beberapa menit
|
||||
untuk mengisi survei ini.
|
||||
</p>
|
||||
<Dialog open={openPolda} onOpenChange={setOpenPolda}>
|
||||
<DialogTrigger asChild>
|
||||
<Button
|
||||
size="md"
|
||||
onClick={() => setOpenPolda(true)}
|
||||
className="flex flex-col gap-2 justify-center items-center shadow-lg group rounded-xl py-5 px-24 border-2 bg-[#bb3523] hover:bg-white] transition-all duration-300"
|
||||
>
|
||||
<p className="text-base font-bold">Survey Sekarang</p>
|
||||
</Button>
|
||||
</DialogTrigger>
|
||||
<DialogContent
|
||||
size="md"
|
||||
className="max-h-[90vh] overflow-auto flex flex-col "
|
||||
>
|
||||
<DialogHeader>
|
||||
<DialogTitle className="text-lg font-bold">
|
||||
SURVEI KEPUASAN PENGGUNA MEDIAHUB POLRI
|
||||
</DialogTitle>
|
||||
<DialogDescription className="text-sm">
|
||||
Kami menghargai pendapat Anda! Survei ini bertujuan untuk
|
||||
meningkatkan kualitas layanan MediaHub Polri.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
<form onSubmit={handleSubmit(onSubmit)} className="space-y-6 mt-4">
|
||||
{renderControllerGroup(
|
||||
"accessFrequency",
|
||||
"1. Seberapa sering Anda mengakses MediaHub Polri?",
|
||||
options.accessFrequency
|
||||
)}
|
||||
|
||||
<div>
|
||||
<p className="font-medium">
|
||||
2. Bagaimana pengalaman Anda dalam mengakses website ini?
|
||||
</p>
|
||||
<div className="space-y-3 mt-2">
|
||||
{renderControllerGroup(
|
||||
"uiExperienceDesign",
|
||||
"a) Tampilan dan desain website",
|
||||
options.uiExperienceDesign
|
||||
)}
|
||||
{renderControllerGroup(
|
||||
"uiExperienceNavigation",
|
||||
"b) Kemudahan navigasi",
|
||||
options.uiExperienceNavigation
|
||||
)}
|
||||
{renderControllerGroup(
|
||||
"uiExperienceSpeed",
|
||||
"c) Kecepatan akses website",
|
||||
options.uiExperienceSpeed
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<p className="font-medium">
|
||||
3. Seberapa puas Anda dengan informasi yang tersedia di MediaHub
|
||||
Polri?
|
||||
</p>
|
||||
<div className="space-y-3 mt-2">
|
||||
{renderControllerGroup(
|
||||
"infoAccuracy",
|
||||
"a) Akurat dan terpercaya",
|
||||
options.infoAccuracy
|
||||
)}
|
||||
{renderControllerGroup(
|
||||
"infoCompleteness",
|
||||
"b) Kelengkapan berita dan informasi",
|
||||
options.infoCompleteness
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{renderControllerGroup(
|
||||
"usefulness",
|
||||
"4. Apakah Anda merasa website ini membantu dalam mendapatkan informasi terkait Polri?",
|
||||
options.usefulness
|
||||
)}
|
||||
|
||||
<div>
|
||||
<p className="font-medium">5. Apa saran atau masukan Anda?</p>
|
||||
<Controller
|
||||
name="suggestion"
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Textarea
|
||||
placeholder="Tulis pesan Anda..."
|
||||
value={field.value}
|
||||
onChange={field.onChange}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button variant="outline" onClick={() => setShowSurvey(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
<Button type="submit" disabled={isLoading}>
|
||||
{isLoading ? "Mengirim..." : "Kirim"}
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default UserSurveyBox;
|
||||
|
|
@ -17,219 +17,113 @@ import { useState } from "react";
|
|||
import { createTaskTa } from "@/service/task";
|
||||
import { createSurveyData } from "@/service/survey/survey";
|
||||
|
||||
const surveySchema = z.object({
|
||||
accessFrequency: z.string(),
|
||||
uiExperienceDesign: z.string(),
|
||||
uiExperienceNavigation: z.string(),
|
||||
uiExperienceSpeed: z.string(),
|
||||
infoAccuracy: z.string(),
|
||||
infoCompleteness: z.string(),
|
||||
usefulness: z.string(),
|
||||
suggestion: z.string().optional(),
|
||||
});
|
||||
|
||||
type SurveySchema = z.infer<typeof surveySchema>;
|
||||
|
||||
export default function FormSurvey() {
|
||||
const [showSurvey, setShowSurvey] = useState(true);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const {
|
||||
control,
|
||||
handleSubmit,
|
||||
formState: { errors },
|
||||
} = useForm<SurveySchema>({
|
||||
resolver: zodResolver(surveySchema),
|
||||
mode: "all",
|
||||
defaultValues: {
|
||||
accessFrequency: "",
|
||||
uiExperienceDesign: "",
|
||||
uiExperienceNavigation: "",
|
||||
uiExperienceSpeed: "",
|
||||
infoAccuracy: "",
|
||||
infoCompleteness: "",
|
||||
usefulness: "",
|
||||
suggestion: "",
|
||||
},
|
||||
});
|
||||
|
||||
const options = {
|
||||
accessFrequency: [
|
||||
"Setiap hari",
|
||||
"Beberapa kali seminggu",
|
||||
"Beberapa kali dalam sebulan",
|
||||
"Baru pertama kali",
|
||||
],
|
||||
uiExperienceDesign: ["Sangat baik", "Baik", "Cukup", "Kurang", "Buruk"],
|
||||
uiExperienceNavigation: [
|
||||
"Sangat mudah",
|
||||
"Mudah",
|
||||
"Cukup",
|
||||
"Sulit",
|
||||
"Sangat sulit",
|
||||
],
|
||||
uiExperienceSpeed: [
|
||||
"Sangat cepat",
|
||||
"Cepat",
|
||||
"Cukup",
|
||||
"Lambat",
|
||||
"Sangat lambat",
|
||||
],
|
||||
infoAccuracy: ["Sangat puas", "Puas", "Cukup", "Kurang puas", "Tidak puas"],
|
||||
infoCompleteness: [
|
||||
"Sangat lengkap",
|
||||
"Lengkap",
|
||||
"Cukup",
|
||||
"Kurang lengkap",
|
||||
"Tidak lengkap",
|
||||
],
|
||||
usefulness: [
|
||||
"Sangat membantu",
|
||||
"Membantu",
|
||||
"Cukup membantu",
|
||||
"Kurang membantu",
|
||||
"Tidak membantu",
|
||||
],
|
||||
};
|
||||
|
||||
const renderControllerGroup = (
|
||||
name: keyof SurveySchema,
|
||||
question: string,
|
||||
choices: string[]
|
||||
) => (
|
||||
<div className="space-y-2">
|
||||
<p className="font-medium">{question}</p>
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
{choices.map((choice, i) => (
|
||||
<Controller
|
||||
key={i}
|
||||
name={name}
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<label className="flex items-center space-x-2">
|
||||
<Checkbox
|
||||
checked={field.value === choice}
|
||||
onCheckedChange={() => field.onChange(choice)}
|
||||
/>
|
||||
<span>{choice}</span>
|
||||
</label>
|
||||
)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
{errors[name] && (
|
||||
<p className="text-red-500 text-sm">
|
||||
{errors[name]?.message as string}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
const onSubmit = async (data: SurveySchema) => {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const response = await createSurveyData(data);
|
||||
console.log("API Response:", response);
|
||||
setShowSurvey(false);
|
||||
} catch (error) {
|
||||
console.error("Error submitting survey:", error);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog open={showSurvey} onOpenChange={setShowSurvey}>
|
||||
<DialogContent className="z-50 min-w-max h-[600px] overflow-y-auto">
|
||||
<DialogHeader>
|
||||
<DialogTitle className="text-lg font-bold">
|
||||
SURVEI KEPUASAN PENGGUNA MEDIAHUB POLRI
|
||||
</DialogTitle>
|
||||
<DialogDescription className="text-sm">
|
||||
Kami menghargai pendapat Anda! Survei ini bertujuan untuk
|
||||
meningkatkan kualitas layanan MediaHub Polri.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
<form onSubmit={handleSubmit(onSubmit)} className="space-y-6 mt-4">
|
||||
{renderControllerGroup(
|
||||
"accessFrequency",
|
||||
"1. Seberapa sering Anda mengakses MediaHub Polri?",
|
||||
options.accessFrequency
|
||||
)}
|
||||
|
||||
<div>
|
||||
<p className="font-medium">
|
||||
2. Bagaimana pengalaman Anda dalam mengakses website ini?
|
||||
</p>
|
||||
<div className="space-y-3 mt-2">
|
||||
{renderControllerGroup(
|
||||
"uiExperienceDesign",
|
||||
"a) Tampilan dan desain website",
|
||||
options.uiExperienceDesign
|
||||
)}
|
||||
{renderControllerGroup(
|
||||
"uiExperienceNavigation",
|
||||
"b) Kemudahan navigasi",
|
||||
options.uiExperienceNavigation
|
||||
)}
|
||||
{renderControllerGroup(
|
||||
"uiExperienceSpeed",
|
||||
"c) Kecepatan akses website",
|
||||
options.uiExperienceSpeed
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<p className="font-medium">
|
||||
3. Seberapa puas Anda dengan informasi yang tersedia di MediaHub
|
||||
Polri?
|
||||
</p>
|
||||
<div className="space-y-3 mt-2">
|
||||
{renderControllerGroup(
|
||||
"infoAccuracy",
|
||||
"a) Akurat dan terpercaya",
|
||||
options.infoAccuracy
|
||||
)}
|
||||
{renderControllerGroup(
|
||||
"infoCompleteness",
|
||||
"b) Kelengkapan berita dan informasi",
|
||||
options.infoCompleteness
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{renderControllerGroup(
|
||||
"usefulness",
|
||||
"4. Apakah Anda merasa website ini membantu dalam mendapatkan informasi terkait Polri?",
|
||||
options.usefulness
|
||||
)}
|
||||
|
||||
<div>
|
||||
<p className="font-medium">5. Apa saran atau masukan Anda?</p>
|
||||
<Controller
|
||||
name="suggestion"
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Textarea
|
||||
placeholder="Tulis pesan Anda..."
|
||||
value={field.value}
|
||||
onChange={field.onChange}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button variant="outline" onClick={() => setShowSurvey(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
<Button type="submit" disabled={isLoading}>
|
||||
{isLoading ? "Mengirim..." : "Kirim"}
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
// const [showSurvey, setShowSurvey] = useState(true);
|
||||
// const [isLoading, setIsLoading] = useState(false);
|
||||
// const {
|
||||
// control,
|
||||
// handleSubmit,
|
||||
// formState: { errors },
|
||||
// } = useForm<SurveySchema>({
|
||||
// resolver: zodResolver(surveySchema),
|
||||
// mode: "all",
|
||||
// defaultValues: {
|
||||
// accessFrequency: "",
|
||||
// uiExperienceDesign: "",
|
||||
// uiExperienceNavigation: "",
|
||||
// uiExperienceSpeed: "",
|
||||
// infoAccuracy: "",
|
||||
// infoCompleteness: "",
|
||||
// usefulness: "",
|
||||
// suggestion: "",
|
||||
// },
|
||||
// });
|
||||
// const options = {
|
||||
// accessFrequency: [
|
||||
// "Setiap hari",
|
||||
// "Beberapa kali seminggu",
|
||||
// "Beberapa kali dalam sebulan",
|
||||
// "Baru pertama kali",
|
||||
// ],
|
||||
// uiExperienceDesign: ["Sangat baik", "Baik", "Cukup", "Kurang", "Buruk"],
|
||||
// uiExperienceNavigation: [
|
||||
// "Sangat mudah",
|
||||
// "Mudah",
|
||||
// "Cukup",
|
||||
// "Sulit",
|
||||
// "Sangat sulit",
|
||||
// ],
|
||||
// uiExperienceSpeed: [
|
||||
// "Sangat cepat",
|
||||
// "Cepat",
|
||||
// "Cukup",
|
||||
// "Lambat",
|
||||
// "Sangat lambat",
|
||||
// ],
|
||||
// infoAccuracy: ["Sangat puas", "Puas", "Cukup", "Kurang puas", "Tidak puas"],
|
||||
// infoCompleteness: [
|
||||
// "Sangat lengkap",
|
||||
// "Lengkap",
|
||||
// "Cukup",
|
||||
// "Kurang lengkap",
|
||||
// "Tidak lengkap",
|
||||
// ],
|
||||
// usefulness: [
|
||||
// "Sangat membantu",
|
||||
// "Membantu",
|
||||
// "Cukup membantu",
|
||||
// "Kurang membantu",
|
||||
// "Tidak membantu",
|
||||
// ],
|
||||
// };
|
||||
// const renderControllerGroup = (
|
||||
// name: keyof SurveySchema,
|
||||
// question: string,
|
||||
// choices: string[]
|
||||
// ) => (
|
||||
// <div className="space-y-2">
|
||||
// <p className="font-medium">{question}</p>
|
||||
// <div className="grid grid-cols-2 gap-2">
|
||||
// {choices.map((choice, i) => (
|
||||
// <Controller
|
||||
// key={i}
|
||||
// name={name}
|
||||
// control={control}
|
||||
// render={({ field }) => (
|
||||
// <label className="flex items-center space-x-2">
|
||||
// <Checkbox
|
||||
// checked={field.value === choice}
|
||||
// onCheckedChange={() => field.onChange(choice)}
|
||||
// />
|
||||
// <span>{choice}</span>
|
||||
// </label>
|
||||
// )}
|
||||
// />
|
||||
// ))}
|
||||
// </div>
|
||||
// {errors[name] && (
|
||||
// <p className="text-red-500 text-sm">
|
||||
// {errors[name]?.message as string}
|
||||
// </p>
|
||||
// )}
|
||||
// </div>
|
||||
// );
|
||||
// const onSubmit = async (data: SurveySchema) => {
|
||||
// setIsLoading(true);
|
||||
// try {
|
||||
// const response = await createSurveyData(data);
|
||||
// console.log("API Response:", response);
|
||||
// setShowSurvey(false);
|
||||
// } catch (error) {
|
||||
// console.error("Error submitting survey:", error);
|
||||
// } finally {
|
||||
// setIsLoading(false);
|
||||
// }
|
||||
// };
|
||||
// return (
|
||||
// <Dialog open={showSurvey} onOpenChange={setShowSurvey}>
|
||||
// <DialogContent className="z-50 min-w-max h-[600px] overflow-y-auto">
|
||||
// </DialogContent>
|
||||
// </Dialog>
|
||||
// );
|
||||
}
|
||||
|
|
|
|||
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 20 MiB |
|
After Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 22 MiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 217 KiB |
|
After Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 2.4 MiB |