feat:update landing page
This commit is contained in:
parent
2956cafbc6
commit
da8fde5499
|
|
@ -8,13 +8,29 @@ import NewContent from "@/components/landing-page/new-content";
|
||||||
import { useToast } from "@/components/ui/use-toast";
|
import { useToast } from "@/components/ui/use-toast";
|
||||||
import { getCookiesDecrypt } from "@/lib/utils";
|
import { getCookiesDecrypt } from "@/lib/utils";
|
||||||
import { close, error, loading, successCallback, warning } from "@/config/swal";
|
import { close, error, loading, successCallback, warning } from "@/config/swal";
|
||||||
import { checkWishlistStatus, createPublicSuggestion, deletePublicSuggestion, deleteWishlist, getDetail, getPublicSuggestionList, saveWishlist } from "@/service/landing/landing";
|
import {
|
||||||
|
checkWishlistStatus,
|
||||||
|
createPublicSuggestion,
|
||||||
|
deletePublicSuggestion,
|
||||||
|
deleteWishlist,
|
||||||
|
getDetail,
|
||||||
|
getPublicSuggestionList,
|
||||||
|
saveWishlist,
|
||||||
|
} from "@/service/landing/landing";
|
||||||
import { Link, useRouter } from "@/i18n/routing";
|
import { Link, useRouter } from "@/i18n/routing";
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
import {
|
||||||
|
Popover,
|
||||||
|
PopoverContent,
|
||||||
|
PopoverTrigger,
|
||||||
|
} from "@/components/ui/popover";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { sendMediaUploadToEmail } from "@/service/media-tracking/media-tracking";
|
import { sendMediaUploadToEmail } from "@/service/media-tracking/media-tracking";
|
||||||
import { checkMaliciousText, formatDateToIndonesian, getPublicLocaleTimestamp } from "@/utils/globals";
|
import {
|
||||||
|
checkMaliciousText,
|
||||||
|
formatDateToIndonesian,
|
||||||
|
getPublicLocaleTimestamp,
|
||||||
|
} from "@/utils/globals";
|
||||||
import withReactContent from "sweetalert2-react-content";
|
import withReactContent from "sweetalert2-react-content";
|
||||||
import Swal from "sweetalert2";
|
import Swal from "sweetalert2";
|
||||||
import parse from "html-react-parser";
|
import parse from "html-react-parser";
|
||||||
|
|
@ -22,7 +38,6 @@ import { Skeleton } from "@/components/ui/skeleton";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
|
|
||||||
|
|
||||||
interface Size {
|
interface Size {
|
||||||
label: string;
|
label: string;
|
||||||
value: string;
|
value: string;
|
||||||
|
|
@ -64,8 +79,11 @@ const DetailInfo = () => {
|
||||||
const poldaName = params?.polda_name;
|
const poldaName = params?.polda_name;
|
||||||
const satkerName = params?.satker_name;
|
const satkerName = params?.satker_name;
|
||||||
|
|
||||||
let prefixPath = poldaName ? `/polda/${poldaName}` : satkerName ? `/satker/${satkerName}` : "/";
|
let prefixPath = poldaName
|
||||||
|
? `/polda/${poldaName}`
|
||||||
|
: satkerName
|
||||||
|
? `/satker/${satkerName}`
|
||||||
|
: "/";
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
|
|
@ -178,14 +196,14 @@ const DetailInfo = () => {
|
||||||
const sizes: Size[] = Object.entries(scaleFactors).map(([label, factor]) => {
|
const sizes: Size[] = Object.entries(scaleFactors).map(([label, factor]) => {
|
||||||
const width = Number(main?.widthPixel);
|
const width = Number(main?.widthPixel);
|
||||||
const height = Number(main?.heightPixel);
|
const height = Number(main?.heightPixel);
|
||||||
|
|
||||||
if (isNaN(width) || isNaN(height) || width === 0) {
|
if (isNaN(width) || isNaN(height) || width === 0) {
|
||||||
return { label, value: "Invalid size" };
|
return { label, value: "Invalid size" };
|
||||||
}
|
}
|
||||||
|
|
||||||
const newWidth = Math.round(width * factor);
|
const newWidth = Math.round(width * factor);
|
||||||
const newHeight = Math.round((width * factor) / (width / height));
|
const newHeight = Math.round((width * factor) / (width / height));
|
||||||
|
|
||||||
return { label, value: `${newWidth} x ${newHeight} px` };
|
return { label, value: `${newWidth} x ${newHeight} px` };
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -263,7 +281,8 @@ const DetailInfo = () => {
|
||||||
|
|
||||||
xhr.addEventListener("readystatechange", () => {
|
xhr.addEventListener("readystatechange", () => {
|
||||||
if (xhr.readyState === 4 && xhr.status === 200) {
|
if (xhr.readyState === 4 && xhr.status === 200) {
|
||||||
const contentType = xhr.getResponseHeader("content-type") || "application/octet-stream";
|
const contentType =
|
||||||
|
xhr.getResponseHeader("content-type") || "application/octet-stream";
|
||||||
const extension = contentType.split("/")[1];
|
const extension = contentType.split("/")[1];
|
||||||
const filename = `${name}.${extension}`;
|
const filename = `${name}.${extension}`;
|
||||||
|
|
||||||
|
|
@ -297,7 +316,11 @@ const DetailInfo = () => {
|
||||||
if (type == "wa" && width <= 768) {
|
if (type == "wa" && width <= 768) {
|
||||||
window.open(`whatsapp://send?${url}`, "_blank");
|
window.open(`whatsapp://send?${url}`, "_blank");
|
||||||
} else if (type == "wa" && width > 768) {
|
} else if (type == "wa" && width > 768) {
|
||||||
window.open(`https://web.whatsapp.com/send?${url}`, "_blank", "noreferrer");
|
window.open(
|
||||||
|
`https://web.whatsapp.com/send?${url}`,
|
||||||
|
"_blank",
|
||||||
|
"noreferrer"
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
window.open(url);
|
window.open(url);
|
||||||
}
|
}
|
||||||
|
|
@ -386,7 +409,9 @@ const DetailInfo = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sendSuggestionChild(parentId: any) {
|
async function sendSuggestionChild(parentId: any) {
|
||||||
const inputElement = document.querySelector(`#input-comment-${parentId}`) as HTMLInputElement;
|
const inputElement = document.querySelector(
|
||||||
|
`#input-comment-${parentId}`
|
||||||
|
) as HTMLInputElement;
|
||||||
|
|
||||||
if (inputElement && inputElement.value.length > 3) {
|
if (inputElement && inputElement.value.length > 3) {
|
||||||
loading();
|
loading();
|
||||||
|
|
@ -399,7 +424,9 @@ const DetailInfo = () => {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
const response = await createPublicSuggestion(data);
|
const response = await createPublicSuggestion(data);
|
||||||
console.log(response);
|
console.log(response);
|
||||||
const responseGet: any = await getPublicSuggestionList(slug?.split("-")?.[0]);
|
const responseGet: any = await getPublicSuggestionList(
|
||||||
|
slug?.split("-")?.[0]
|
||||||
|
);
|
||||||
console.log(responseGet.data?.data);
|
console.log(responseGet.data?.data);
|
||||||
setListSuggestion(responseGet.data?.data);
|
setListSuggestion(responseGet.data?.data);
|
||||||
|
|
||||||
|
|
@ -477,9 +504,11 @@ const DetailInfo = () => {
|
||||||
<rect id="r" width="${w}" height="${h}" fill="url(#g)" />
|
<rect id="r" width="${w}" height="${h}" fill="url(#g)" />
|
||||||
<animate xlink:href="#r" attributeName="x" from="-${w}" to="${w}" dur="1s" repeatCount="indefinite" />
|
<animate xlink:href="#r" attributeName="x" from="-${w}" to="${w}" dur="1s" repeatCount="indefinite" />
|
||||||
</svg>`;
|
</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 (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
@ -494,7 +523,16 @@ const DetailInfo = () => {
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<Image placeholder={`data:image/svg+xml;base64,${toBase64(shimmer(700, 475))}`} width={2560} height={1440} src={detailDataImage?.files[selectedImage]?.url} alt="Main" className="rounded-lg w-auto h-fit" />
|
<Image
|
||||||
|
placeholder={`data:image/svg+xml;base64,${toBase64(
|
||||||
|
shimmer(700, 475)
|
||||||
|
)}`}
|
||||||
|
width={2560}
|
||||||
|
height={1440}
|
||||||
|
src={detailDataImage?.files[selectedImage]?.url}
|
||||||
|
alt="Main"
|
||||||
|
className="rounded-lg w-auto h-fit"
|
||||||
|
/>
|
||||||
<div className="absolute top-4 left-4"></div>
|
<div className="absolute top-4 left-4"></div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
@ -510,7 +548,16 @@ const DetailInfo = () => {
|
||||||
<div className="py-4 flex flex-row gap-3">
|
<div className="py-4 flex flex-row gap-3">
|
||||||
{detailDataImage?.files?.map((file: any, index: number) => (
|
{detailDataImage?.files?.map((file: any, index: number) => (
|
||||||
<a onClick={() => setSelectedImage(index)} key={file?.id}>
|
<a onClick={() => setSelectedImage(index)} key={file?.id}>
|
||||||
<Image placeholder={`data:image/svg+xml;base64,${toBase64(shimmer(700, 475))}`} width={1920} height={1080} alt="image-small" src={file?.url} className="w-[120px] h-[90px] object-cover rounded-md cursor-pointer hover:ring-2 hover:ring-red-600" />
|
<Image
|
||||||
|
placeholder={`data:image/svg+xml;base64,${toBase64(
|
||||||
|
shimmer(700, 475)
|
||||||
|
)}`}
|
||||||
|
width={1920}
|
||||||
|
height={1080}
|
||||||
|
alt="image-small"
|
||||||
|
src={file?.url}
|
||||||
|
className="w-[120px] h-[90px] object-cover rounded-md cursor-pointer hover:ring-2 hover:ring-red-600"
|
||||||
|
/>
|
||||||
</a>
|
</a>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -520,7 +567,10 @@ const DetailInfo = () => {
|
||||||
<div className="text-gray-500 flex flex-col lg:flex-row justify-between items-center border-t mt-4">
|
<div className="text-gray-500 flex flex-col lg:flex-row justify-between items-center border-t mt-4">
|
||||||
<div className="flex flex-col lg:flex-row items-center mt-3 lg:justify-between">
|
<div className="flex flex-col lg:flex-row items-center mt-3 lg:justify-between">
|
||||||
<p className="text-xs lg:text-sm">
|
<p className="text-xs lg:text-sm">
|
||||||
{t("by")} <span className="font-semibold text-black dark:text-white">{detailDataImage?.uploadedBy?.userLevel?.name}</span>
|
{t("by")}
|
||||||
|
<span className="font-semibold text-black dark:text-white">
|
||||||
|
{detailDataImage?.uploadedBy?.userLevel?.name}
|
||||||
|
</span>
|
||||||
</p>
|
</p>
|
||||||
{/* <p className="text-xs lg:text-sm">
|
{/* <p className="text-xs lg:text-sm">
|
||||||
| {t("updatedOn")}
|
| {t("updatedOn")}
|
||||||
|
|
@ -528,7 +578,10 @@ const DetailInfo = () => {
|
||||||
</p> */}
|
</p> */}
|
||||||
<p className="text-xs lg:text-sm">
|
<p className="text-xs lg:text-sm">
|
||||||
| {t("updatedOn")}
|
| {t("updatedOn")}
|
||||||
{formatDateToIndonesian(new Date(detailDataImage?.updatedAt))} {"WIB"}
|
{formatDateToIndonesian(
|
||||||
|
new Date(detailDataImage?.updatedAt)
|
||||||
|
)}{" "}
|
||||||
|
{"WIB"}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-xs lg:text-sm flex justify-center items-center">
|
<p className="text-xs lg:text-sm flex justify-center items-center">
|
||||||
|
|
|
|
||||||
|
|
@ -546,20 +599,33 @@ const DetailInfo = () => {
|
||||||
|
|
||||||
{/* Keterangan */}
|
{/* Keterangan */}
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<h1 className="flex flex-row font-bold text-lg lg:text-2xl my-8">{detailDataImage?.title}</h1>
|
<h1 className="flex flex-row font-bold text-lg lg:text-2xl my-8">
|
||||||
<div className="font-light text-justify mb-5 space-y-4 lg:mb-0" dangerouslySetInnerHTML={{ __html: detailDataImage?.htmlDescription }} />
|
{detailDataImage?.title}
|
||||||
|
</h1>
|
||||||
|
<div
|
||||||
|
className="font-light text-justify mb-5 space-y-4 lg:mb-0"
|
||||||
|
dangerouslySetInnerHTML={{
|
||||||
|
__html: detailDataImage?.htmlDescription,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Bagian Kanan */}
|
{/* Bagian Kanan */}
|
||||||
<div className="md:w-1/4 p-4 bg-[#f7f7f7] dark:bg-slate-600 h-fit rounded-lg mx-4">
|
<div className="md:w-1/4 p-4 bg-[#f7f7f7] dark:bg-slate-600 h-fit rounded-lg mx-4">
|
||||||
{isSaved ? (
|
{isSaved ? (
|
||||||
<a onClick={() => handleDeleteWishlist()} className="flex flex-col mb-3 items-center justify-center cursor-pointer">
|
<a
|
||||||
|
onClick={() => handleDeleteWishlist()}
|
||||||
|
className="flex flex-col mb-3 items-center justify-center cursor-pointer"
|
||||||
|
>
|
||||||
<Icon icon="material-symbols:bookmark" width={40} />
|
<Icon icon="material-symbols:bookmark" width={40} />
|
||||||
<p className="text-base lg:text-lg">{t("delete")}</p>
|
<p className="text-base lg:text-lg">{t("delete")}</p>
|
||||||
</a>
|
</a>
|
||||||
) : (
|
) : (
|
||||||
<a onClick={() => doBookmark()} className="flex flex-col mb-3 items-center justify-center cursor-pointer">
|
<a
|
||||||
|
onClick={() => doBookmark()}
|
||||||
|
className="flex flex-col mb-3 items-center justify-center cursor-pointer"
|
||||||
|
>
|
||||||
<Icon icon="material-symbols:bookmark-outline" width={40} />
|
<Icon icon="material-symbols:bookmark-outline" width={40} />
|
||||||
<p className="text-base lg:text-lg">{t("save")}</p>
|
<p className="text-base lg:text-lg">{t("save")}</p>
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -567,30 +633,52 @@ const DetailInfo = () => {
|
||||||
|
|
||||||
{/* garis */}
|
{/* garis */}
|
||||||
<div className="border-t border-black my-4"></div>
|
<div className="border-t border-black my-4"></div>
|
||||||
|
<div className="flex flex-col justify-center items-center gap-3">
|
||||||
|
<div className="w-auto">
|
||||||
|
<Link
|
||||||
|
href={`/all/filter?title=polda&category=${detailDataImage?.category.id}`}
|
||||||
|
className="bg-red-600 text-white text-xs font-bold px-3 py-3 my-3 rounded w-auto"
|
||||||
|
>
|
||||||
|
{detailDataImage?.category?.name}
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
|
||||||
<Link href={`/all/filter?title=polda&category=${detailDataImage?.category.id}`} className="bg-red-600 text-white text-xs font-bold px-3 py-3 my-3 flex justify-center items-center rounded">
|
<div className="flex justify-center flex-wrap gap-2 mb-4">
|
||||||
{detailDataImage?.category?.name}
|
{detailDataImage?.tags?.split(",").map((tag: string) => (
|
||||||
</Link>
|
<a
|
||||||
|
onClick={() => router.push(`/all/filter?tag=${tag}`)}
|
||||||
<div className="flex justify-center flex-wrap gap-2 mb-4">
|
key={tag}
|
||||||
{detailDataImage?.tags?.split(",").map((tag: string) => (
|
className="bg-gray-200 text-gray-700 text-xs px-3 py-1 rounded-full cursor-pointer hover:bg-gray-500"
|
||||||
<a onClick={() => router.push(`/all/filter?tag=${tag}`)} key={tag} className="bg-gray-200 text-gray-700 text-xs px-3 py-1 rounded-full cursor-pointer hover:bg-gray-500">
|
>
|
||||||
{tag}
|
{tag}
|
||||||
</a>
|
</a>
|
||||||
))}
|
))}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="border-t border-black my-4"></div>
|
<div className="border-t border-black my-4"></div>
|
||||||
|
|
||||||
{/* Opsi Ukuran Foto */}
|
{/* Opsi Ukuran Foto */}
|
||||||
<h4 className="flex text-lg justify-center items-center font-semibold my-3">{t("imageSize")}</h4>
|
<h4 className="flex text-lg justify-center items-center font-semibold my-3">
|
||||||
|
{t("imageSize")}
|
||||||
|
</h4>
|
||||||
<div className="border-t border-black my-4"></div>
|
<div className="border-t border-black my-4"></div>
|
||||||
|
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
{sizes.map((size: any) => (
|
{sizes.map((size: any) => (
|
||||||
<div className="flex flex-row justify-between">
|
<div className="flex flex-row justify-between">
|
||||||
<div key={size?.label} className="items-center flex flex-row gap-2 cursor-pointer">
|
<div
|
||||||
<input type="radio" name="size" value={size?.label} checked={selectedSize === size?.label} onChange={(e) => setImageSizeSelected(e.target.value)} className="text-red-600 focus:ring-red-600" />
|
key={size?.label}
|
||||||
|
className="items-center flex flex-row gap-2 cursor-pointer"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
name="size"
|
||||||
|
value={size?.label}
|
||||||
|
checked={selectedSize === size?.label}
|
||||||
|
onChange={(e) => setImageSizeSelected(e.target.value)}
|
||||||
|
className="text-red-600 focus:ring-red-600"
|
||||||
|
/>
|
||||||
<div className="text-sm">{size?.label}</div>
|
<div className="text-sm">{size?.label}</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="text-sm">{size?.value}</div>
|
<div className="text-sm">{size?.value}</div>
|
||||||
|
|
@ -601,15 +689,30 @@ const DetailInfo = () => {
|
||||||
{/* Download Semua */}
|
{/* Download Semua */}
|
||||||
<div className="mt-4">
|
<div className="mt-4">
|
||||||
<label className="flex items-center space-x-2 text-sm">
|
<label className="flex items-center space-x-2 text-sm">
|
||||||
<input type="checkbox" className="text-red-600 focus:ring-red-600" onChange={() => setIsDownloadAll(!isDownloadAll)} />
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
className="text-red-600 focus:ring-red-600"
|
||||||
|
onChange={() => setIsDownloadAll(!isDownloadAll)}
|
||||||
|
/>
|
||||||
<span>{t("downloadAll")}</span>
|
<span>{t("downloadAll")}</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Tombol Download */}
|
{/* Tombol Download */}
|
||||||
<button onClick={handleDownload} className="mt-4 bg-red-600 text-white w-full py-2 flex justify-center items-center gap-1 rounded-md text-sm hover:bg-red-700">
|
<button
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
onClick={handleDownload}
|
||||||
<path fill="white" d="m12 16l-5-5l1.4-1.45l2.6 2.6V4h2v8.15l2.6-2.6L17 11zm-6 4q-.825 0-1.412-.587T4 18v-3h2v3h12v-3h2v3q0 .825-.587 1.413T18 20z" />
|
className="mt-4 bg-red-600 text-white w-full py-2 flex justify-center items-center gap-1 rounded-md text-sm hover:bg-red-700"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="1em"
|
||||||
|
height="1em"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
fill="white"
|
||||||
|
d="m12 16l-5-5l1.4-1.45l2.6 2.6V4h2v8.15l2.6-2.6L17 11zm-6 4q-.825 0-1.412-.587T4 18v-3h2v3h12v-3h2v3q0 .825-.587 1.413T18 20z"
|
||||||
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
{t("download")}
|
{t("download")}
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -617,29 +720,90 @@ const DetailInfo = () => {
|
||||||
{/* Tombol Bagikan */}
|
{/* Tombol Bagikan */}
|
||||||
<div className="flex flex-row mt-5 justify-center">
|
<div className="flex flex-row mt-5 justify-center">
|
||||||
<p className="text-base font-semibold">{t("share")}</p>
|
<p className="text-base font-semibold">{t("share")}</p>
|
||||||
<a className="ml-8 cursor-pointer" onClick={() => handleShare("fb", `https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fmediahub.polri.go.id%2F${typeString}%2Fdetail%2F${content?.id}"e=${content?.title}`)}>
|
<a
|
||||||
<Icon icon="brandico:facebook" height="20" className="px-auto text-red-600 text-center" />
|
className="ml-8 cursor-pointer"
|
||||||
|
onClick={() =>
|
||||||
|
handleShare(
|
||||||
|
"fb",
|
||||||
|
`https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fmediahub.polri.go.id%2F${typeString}%2Fdetail%2F${content?.id}"e=${content?.title}`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Icon
|
||||||
|
icon="brandico:facebook"
|
||||||
|
height="20"
|
||||||
|
className="px-auto text-red-600 text-center"
|
||||||
|
/>
|
||||||
</a>
|
</a>
|
||||||
<a className="ml-5 cursor-pointer" onClick={() => handleShare("tw", `https://twitter.com/share?url=https%3A%2F%2Fmediahub.polri.go.id%2F${typeString}%2Fdetail%2F${content?.id}&text=${content?.title}`)}>
|
<a
|
||||||
<Icon icon="mdi:twitter" width="23" className="text-red-600 text-center" />
|
className="ml-5 cursor-pointer"
|
||||||
|
onClick={() =>
|
||||||
|
handleShare(
|
||||||
|
"tw",
|
||||||
|
`https://twitter.com/share?url=https%3A%2F%2Fmediahub.polri.go.id%2F${typeString}%2Fdetail%2F${content?.id}&text=${content?.title}`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Icon
|
||||||
|
icon="mdi:twitter"
|
||||||
|
width="23"
|
||||||
|
className="text-red-600 text-center"
|
||||||
|
/>
|
||||||
</a>
|
</a>
|
||||||
<a className="ml-5 cursor-pointer" onClick={() => handleShare("wa", `text=${content?.title}%0D%0A%0D%0Ahttps%3A%2F%2Fmediahub.polri.go.id%2F${typeString}%2Fdetail%2F${content?.id}`)}>
|
<a
|
||||||
<Icon icon="ri:whatsapp-fill" width="23" className="text-red-600 text-center" />
|
className="ml-5 cursor-pointer"
|
||||||
|
onClick={() =>
|
||||||
|
handleShare(
|
||||||
|
"wa",
|
||||||
|
`text=${content?.title}%0D%0A%0D%0Ahttps%3A%2F%2Fmediahub.polri.go.id%2F${typeString}%2Fdetail%2F${content?.id}`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Icon
|
||||||
|
icon="ri:whatsapp-fill"
|
||||||
|
width="23"
|
||||||
|
className="text-red-600 text-center"
|
||||||
|
/>
|
||||||
</a>
|
</a>
|
||||||
<Popover>
|
<Popover>
|
||||||
<PopoverTrigger className="flex justify-end gap-1 cursor-pointer" asChild>
|
<PopoverTrigger
|
||||||
<a className="ml-5 cursor-pointer" data-toggle="dropdown" href="#" aria-expanded="false">
|
className="flex justify-end gap-1 cursor-pointer"
|
||||||
<Icon icon="material-symbols-light:mail" width="23" className="text-red-600 text-center" />
|
asChild
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
className="ml-5 cursor-pointer"
|
||||||
|
data-toggle="dropdown"
|
||||||
|
href="#"
|
||||||
|
aria-expanded="false"
|
||||||
|
>
|
||||||
|
<Icon
|
||||||
|
icon="material-symbols-light:mail"
|
||||||
|
width="23"
|
||||||
|
className="text-red-600 text-center"
|
||||||
|
/>
|
||||||
</a>
|
</a>
|
||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
<PopoverContent>
|
<PopoverContent>
|
||||||
<div className="flex flex-col">
|
<div className="flex flex-col">
|
||||||
<h1 className="mb-2">{t("shareTo")}</h1>
|
<h1 className="mb-2">{t("shareTo")}</h1>
|
||||||
<div className="flex flex-col mb-2">
|
<div className="flex flex-col mb-2">
|
||||||
<p className="text-base font-semibold mb-1">{t("destinationEmail")}</p>
|
<p className="text-base font-semibold mb-1">
|
||||||
<Input value={emailShareInput} onChange={(event) => setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder={t("pressEnter")} />
|
{t("destinationEmail")}
|
||||||
|
</p>
|
||||||
|
<Input
|
||||||
|
value={emailShareInput}
|
||||||
|
onChange={(event) =>
|
||||||
|
setEmailShareInput(event.target.value)
|
||||||
|
}
|
||||||
|
onKeyPress={handleEmailList}
|
||||||
|
type="email"
|
||||||
|
placeholder={t("pressEnter")}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Button className="bg-blue-500 text-white p-2 w-fit rounded-lg" onClick={() => shareToEmail()}>
|
<Button
|
||||||
|
className="bg-blue-500 text-white p-2 w-fit rounded-lg"
|
||||||
|
onClick={() => shareToEmail()}
|
||||||
|
>
|
||||||
{t("send")}
|
{t("send")}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -655,8 +819,15 @@ const DetailInfo = () => {
|
||||||
<div className="flex flex-col my-16 p-4 lg:p-10 bg-[#f7f7f7] dark:bg-slate-600">
|
<div className="flex flex-col my-16 p-4 lg:p-10 bg-[#f7f7f7] dark:bg-slate-600">
|
||||||
<div className="gap-5 flex flex-col px-4 lg:px-14">
|
<div className="gap-5 flex flex-col px-4 lg:px-14">
|
||||||
<p className="flex items-start text-lg">{t("comment")}</p>
|
<p className="flex items-start text-lg">{t("comment")}</p>
|
||||||
<Textarea placeholder={t("leaveComment")} className="flex w-full pb-12" onChange={getInputValue} />
|
<Textarea
|
||||||
<button onClick={() => postData()} className="flex items-start bg-[#bb3523] rounded-lg w-fit text-white px-4 py-1">
|
placeholder={t("leaveComment")}
|
||||||
|
className="flex w-full pb-12"
|
||||||
|
onChange={getInputValue}
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
onClick={() => postData()}
|
||||||
|
className="flex items-start bg-[#bb3523] rounded-lg w-fit text-white px-4 py-1"
|
||||||
|
>
|
||||||
{t("send")}
|
{t("send")}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -667,13 +838,29 @@ const DetailInfo = () => {
|
||||||
{listSuggestion?.map((data: any) => (
|
{listSuggestion?.map((data: any) => (
|
||||||
<div className="flex flex-col">
|
<div className="flex flex-col">
|
||||||
<div className="flex flex-row mt-2 px-4 lg:px-14">
|
<div className="flex flex-row mt-2 px-4 lg:px-14">
|
||||||
<Image placeholder={`data:image/svg+xml;base64,${toBase64(shimmer(700, 475))}`} width={1080} height={1080} src={data?.suggestionFrom?.profilePictureUrl} className="h-12 lg:h-16 w-12 lg:w-16 mr-2" onError={addDefaultProfile} alt="" />
|
<Image
|
||||||
|
placeholder={`data:image/svg+xml;base64,${toBase64(
|
||||||
|
shimmer(700, 475)
|
||||||
|
)}`}
|
||||||
|
width={1080}
|
||||||
|
height={1080}
|
||||||
|
src={data?.suggestionFrom?.profilePictureUrl}
|
||||||
|
className="h-12 lg:h-16 w-12 lg:w-16 mr-2"
|
||||||
|
onError={addDefaultProfile}
|
||||||
|
alt=""
|
||||||
|
/>
|
||||||
<div className="border border-slate-300 w-full p-2 lg:p-4 bg-white gap-1">
|
<div className="border border-slate-300 w-full p-2 lg:p-4 bg-white gap-1">
|
||||||
<p className="text-slate-500 text-sm lg:text-base border-b-2 border-slate-200 mb-2">
|
<p className="text-slate-500 text-sm lg:text-base border-b-2 border-slate-200 mb-2">
|
||||||
{Number(data.suggestionFrom?.roleId) == 2 || Number(data.suggestionFrom?.roleId) == 3 || Number(data.suggestionFrom?.roleId) == 4 ? "HUMAS POLRI" : data.suggestionFrom?.fullname}
|
{Number(data.suggestionFrom?.roleId) == 2 ||
|
||||||
|
Number(data.suggestionFrom?.roleId) == 3 ||
|
||||||
|
Number(data.suggestionFrom?.roleId) == 4
|
||||||
|
? "HUMAS POLRI"
|
||||||
|
: data.suggestionFrom?.fullname}
|
||||||
{getPublicLocaleTimestamp(new Date(data.createdAt))}
|
{getPublicLocaleTimestamp(new Date(data.createdAt))}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-slate-500 text-[13px] lg:text-sm mb-4">{data?.message}</p>
|
<p className="text-slate-500 text-[13px] lg:text-sm mb-4">
|
||||||
|
{data?.message}
|
||||||
|
</p>
|
||||||
<div>
|
<div>
|
||||||
<a
|
<a
|
||||||
style={
|
style={
|
||||||
|
|
@ -686,11 +873,16 @@ const DetailInfo = () => {
|
||||||
onClick={() => showInput(`comment-id-${data.id}`)}
|
onClick={() => showInput(`comment-id-${data.id}`)}
|
||||||
className="mr-2"
|
className="mr-2"
|
||||||
>
|
>
|
||||||
<small className="flex items-start bg-[#bb3523] rounded-lg w-fit text-white px-2 text-xs lg:text-base lg:px-4 py-1 cursor-pointer">{t("reply")}</small>
|
<small className="flex items-start bg-[#bb3523] rounded-lg w-fit text-white px-2 text-xs lg:text-base lg:px-4 py-1 cursor-pointer">
|
||||||
|
{t("reply")}
|
||||||
|
</small>
|
||||||
</a>
|
</a>
|
||||||
{Number(data.suggestionFrom?.id) == Number(userId) || Number(userRoleId) == 2 ? (
|
{Number(data.suggestionFrom?.id) == Number(userId) ||
|
||||||
|
Number(userRoleId) == 2 ? (
|
||||||
<a onClick={() => deleteData(data.id)}>
|
<a onClick={() => deleteData(data.id)}>
|
||||||
<small className="flex items-start bg-[#bb3523] rounded-lg w-fit text-white px-2 text-xs lg:text-base lg:px-4 py-1 cursor-pointer">{t("delete")}</small>
|
<small className="flex items-start bg-[#bb3523] rounded-lg w-fit text-white px-2 text-xs lg:text-base lg:px-4 py-1 cursor-pointer">
|
||||||
|
{t("delete")}
|
||||||
|
</small>
|
||||||
</a>
|
</a>
|
||||||
) : (
|
) : (
|
||||||
""
|
""
|
||||||
|
|
@ -699,14 +891,25 @@ const DetailInfo = () => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{visibleInput === `comment-id-${data.id}` && (
|
{visibleInput === `comment-id-${data.id}` && (
|
||||||
<div id={`comment-id-${data.id}`} className="px-4 pl-[72px] lg:px-14 lg:pl-32 mt-2 ">
|
<div
|
||||||
<Textarea id={`input-comment-${data.id}`} className="p-4 focus:outline-none focus:border-sky-500" placeholder={t("enterReply")} />
|
id={`comment-id-${data.id}`}
|
||||||
|
className="px-4 pl-[72px] lg:px-14 lg:pl-32 mt-2 "
|
||||||
|
>
|
||||||
|
<Textarea
|
||||||
|
id={`input-comment-${data.id}`}
|
||||||
|
className="p-4 focus:outline-none focus:border-sky-500"
|
||||||
|
placeholder={t("enterReply")}
|
||||||
|
/>
|
||||||
<div className="flex flex-row gap-3">
|
<div className="flex flex-row gap-3">
|
||||||
<a onClick={() => postDataChild(data.id)}>
|
<a onClick={() => postDataChild(data.id)}>
|
||||||
<small className="flex items-start bg-[#bb3523] rounded-lg w-fit text-white px-2 text-xs lg:text-base lg:px-4 py-1 mt-2 cursor-pointer">{t("send")}</small>
|
<small className="flex items-start bg-[#bb3523] rounded-lg w-fit text-white px-2 text-xs lg:text-base lg:px-4 py-1 mt-2 cursor-pointer">
|
||||||
|
{t("send")}
|
||||||
|
</small>
|
||||||
</a>
|
</a>
|
||||||
<a onClick={() => showInput(`comment-id-${data.id}`)}>
|
<a onClick={() => showInput(`comment-id-${data.id}`)}>
|
||||||
<small className="flex items-start bg-[#bb3523] rounded-lg mt-2 w-fit text-white px-2 text-xs lg:text-base lg:px-4 py-1 cursor-pointer">{t("cancel")}</small>
|
<small className="flex items-start bg-[#bb3523] rounded-lg mt-2 w-fit text-white px-2 text-xs lg:text-base lg:px-4 py-1 cursor-pointer">
|
||||||
|
{t("cancel")}
|
||||||
|
</small>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -716,30 +919,56 @@ const DetailInfo = () => {
|
||||||
? data.children?.map((child1: any) => (
|
? data.children?.map((child1: any) => (
|
||||||
<div className="flex flex-col">
|
<div className="flex flex-col">
|
||||||
<div className="flex flex-row mt-2 px-4 lg:pr-14 pl-16 lg:pl-32">
|
<div className="flex flex-row mt-2 px-4 lg:pr-14 pl-16 lg:pl-32">
|
||||||
<Image placeholder={`data:image/svg+xml;base64,${toBase64(shimmer(700, 475))}`} width={1080} height={1080} src={child1.suggestionFrom?.profilePictureUrl} onError={addDefaultProfile} alt="" className="h-10 lg:h-16 w-10 lg:w-16 mr-2" />
|
<Image
|
||||||
|
placeholder={`data:image/svg+xml;base64,${toBase64(
|
||||||
|
shimmer(700, 475)
|
||||||
|
)}`}
|
||||||
|
width={1080}
|
||||||
|
height={1080}
|
||||||
|
src={child1.suggestionFrom?.profilePictureUrl}
|
||||||
|
onError={addDefaultProfile}
|
||||||
|
alt=""
|
||||||
|
className="h-10 lg:h-16 w-10 lg:w-16 mr-2"
|
||||||
|
/>
|
||||||
<div className="border border-slate-300 w-full p-2 lg:p-4 bg-white gap-1">
|
<div className="border border-slate-300 w-full p-2 lg:p-4 bg-white gap-1">
|
||||||
<p className="text-slate-500 text-sm lg:text-base border-b-2 border-slate-200 mb-2">
|
<p className="text-slate-500 text-sm lg:text-base border-b-2 border-slate-200 mb-2">
|
||||||
{" "}
|
{" "}
|
||||||
<b>{Number(child1.suggestionFrom?.roleId) == 2 || Number(child1.suggestionFrom?.roleId) == 3 || Number(child1.suggestionFrom?.roleId) == 4 ? "HUMAS POLRI" : child1.suggestionFrom?.fullname}</b>{" "}
|
<b>
|
||||||
{getPublicLocaleTimestamp(new Date(child1.createdAt))}
|
{Number(child1.suggestionFrom?.roleId) == 2 ||
|
||||||
|
Number(child1.suggestionFrom?.roleId) == 3 ||
|
||||||
|
Number(child1.suggestionFrom?.roleId) == 4
|
||||||
|
? "HUMAS POLRI"
|
||||||
|
: child1.suggestionFrom?.fullname}
|
||||||
|
</b>{" "}
|
||||||
|
{getPublicLocaleTimestamp(
|
||||||
|
new Date(child1.createdAt)
|
||||||
|
)}
|
||||||
|
</p>
|
||||||
|
<p className="text-slate-500 text-[13px] lg:text-sm mb-4">
|
||||||
|
{parse(String(child1?.message))}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-slate-500 text-[13px] lg:text-sm mb-4">{parse(String(child1?.message))}</p>
|
|
||||||
<div>
|
<div>
|
||||||
<a
|
<a
|
||||||
style={
|
style={
|
||||||
Number(child1.suggestionFrom?.id) == Number(userId)
|
Number(child1.suggestionFrom?.id) ==
|
||||||
|
Number(userId)
|
||||||
? {
|
? {
|
||||||
display: "none",
|
display: "none",
|
||||||
}
|
}
|
||||||
: {}
|
: {}
|
||||||
}
|
}
|
||||||
onClick={() => showInput(`comment-id-${child1.id}`)}
|
onClick={() =>
|
||||||
|
showInput(`comment-id-${child1.id}`)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<small className="flex items-start bg-[#bb3523] rounded-lg w-fit text-white px-2 text-xs lg:text-base lg:px-4 py-1 cursor-pointer">{t("reply")}</small>
|
<small className="flex items-start bg-[#bb3523] rounded-lg w-fit text-white px-2 text-xs lg:text-base lg:px-4 py-1 cursor-pointer">
|
||||||
|
{t("reply")}
|
||||||
|
</small>
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
style={
|
style={
|
||||||
Number(child1.suggestionFrom?.id) == Number(userId)
|
Number(child1.suggestionFrom?.id) ==
|
||||||
|
Number(userId)
|
||||||
? {}
|
? {}
|
||||||
: {
|
: {
|
||||||
display: "none",
|
display: "none",
|
||||||
|
|
@ -747,21 +976,39 @@ const DetailInfo = () => {
|
||||||
}
|
}
|
||||||
onClick={() => deleteData(child1.id)}
|
onClick={() => deleteData(child1.id)}
|
||||||
>
|
>
|
||||||
<small className="flex items-start bg-[#bb3523] rounded-lg w-fit text-white px-2 text-xs lg:text-base lg:px-4 py-1 cursor-pointer">{t("delete")}</small>
|
<small className="flex items-start bg-[#bb3523] rounded-lg w-fit text-white px-2 text-xs lg:text-base lg:px-4 py-1 cursor-pointer">
|
||||||
|
{t("delete")}
|
||||||
|
</small>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{visibleInput === `comment-id-${child1.id}` && (
|
{visibleInput === `comment-id-${child1.id}` && (
|
||||||
<div id={`comment-id-${child1.id}`} className="px-4 lg:px-14 pl-28 lg:pl-[200px]">
|
<div
|
||||||
<Textarea name="" className="mt-2 " id={`input-comment-${child1.id}`} placeholder={t("enterReply")} />
|
id={`comment-id-${child1.id}`}
|
||||||
|
className="px-4 lg:px-14 pl-28 lg:pl-[200px]"
|
||||||
|
>
|
||||||
|
<Textarea
|
||||||
|
name=""
|
||||||
|
className="mt-2 "
|
||||||
|
id={`input-comment-${child1.id}`}
|
||||||
|
placeholder={t("enterReply")}
|
||||||
|
/>
|
||||||
<div className="flex flex-row mt-2 gap-3">
|
<div className="flex flex-row mt-2 gap-3">
|
||||||
<a onClick={() => postDataChild(child1.id)}>
|
<a onClick={() => postDataChild(child1.id)}>
|
||||||
<small className="flex items-start bg-[#bb3523] rounded-lg w-fit text-white px-2 text-xs lg:text-base lg:px-4 py-1 cursor-pointer">{t("send")}</small>
|
<small className="flex items-start bg-[#bb3523] rounded-lg w-fit text-white px-2 text-xs lg:text-base lg:px-4 py-1 cursor-pointer">
|
||||||
|
{t("send")}
|
||||||
|
</small>
|
||||||
</a>
|
</a>
|
||||||
<a onClick={() => showInput(`comment-id-${child1.id}`)}>
|
<a
|
||||||
<small className="flex items-start bg-[#bb3523] rounded-lg w-fit text-white px-2 text-xs lg:text-base lg:px-4 py-1 cursor-pointer">{t("cancel")}</small>
|
onClick={() =>
|
||||||
|
showInput(`comment-id-${child1.id}`)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<small className="flex items-start bg-[#bb3523] rounded-lg w-fit text-white px-2 text-xs lg:text-base lg:px-4 py-1 cursor-pointer">
|
||||||
|
{t("cancel")}
|
||||||
|
</small>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -771,30 +1018,62 @@ const DetailInfo = () => {
|
||||||
? child1.children?.map((child2: any) => (
|
? child1.children?.map((child2: any) => (
|
||||||
<div className="">
|
<div className="">
|
||||||
<div className="flex flex-row mt-2 px-4 lg:pr-14 pl-28 lg:pl-48">
|
<div className="flex flex-row mt-2 px-4 lg:pr-14 pl-28 lg:pl-48">
|
||||||
<Image placeholder={`data:image/svg+xml;base64,${toBase64(shimmer(700, 475))}`} width={1080} height={1080} src={child2.suggestionFrom?.profilePictureUrl} className="h-9 lg:h-16 w-9 lg:w-16 mr-2" onError={addDefaultProfile} alt="" />
|
<Image
|
||||||
|
placeholder={`data:image/svg+xml;base64,${toBase64(
|
||||||
|
shimmer(700, 475)
|
||||||
|
)}`}
|
||||||
|
width={1080}
|
||||||
|
height={1080}
|
||||||
|
src={
|
||||||
|
child2.suggestionFrom?.profilePictureUrl
|
||||||
|
}
|
||||||
|
className="h-9 lg:h-16 w-9 lg:w-16 mr-2"
|
||||||
|
onError={addDefaultProfile}
|
||||||
|
alt=""
|
||||||
|
/>
|
||||||
<div className="border border-slate-300 w-full p-2 lg:p-4 bg-white gap-1">
|
<div className="border border-slate-300 w-full p-2 lg:p-4 bg-white gap-1">
|
||||||
<p className="text-slate-500 text-sm lg:text-base border-b-2 border-slate-200 mb-2">
|
<p className="text-slate-500 text-sm lg:text-base border-b-2 border-slate-200 mb-2">
|
||||||
{" "}
|
{" "}
|
||||||
<b>{Number(child2.suggestionFrom?.roleId) == 2 || Number(child2.suggestionFrom?.roleId) == 3 || Number(child2.suggestionFrom?.roleId) == 4 ? "HUMAS POLRI" : child2.suggestionFrom?.fullname}</b>{" "}
|
<b>
|
||||||
{getPublicLocaleTimestamp(new Date(child2.createdAt))}
|
{Number(
|
||||||
|
child2.suggestionFrom?.roleId
|
||||||
|
) == 2 ||
|
||||||
|
Number(child2.suggestionFrom?.roleId) ==
|
||||||
|
3 ||
|
||||||
|
Number(child2.suggestionFrom?.roleId) ==
|
||||||
|
4
|
||||||
|
? "HUMAS POLRI"
|
||||||
|
: child2.suggestionFrom?.fullname}
|
||||||
|
</b>{" "}
|
||||||
|
{getPublicLocaleTimestamp(
|
||||||
|
new Date(child2.createdAt)
|
||||||
|
)}
|
||||||
|
</p>
|
||||||
|
<p className="text-slate-500 text-sm mb-4">
|
||||||
|
{parse(String(child2?.message))}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-slate-500 text-sm mb-4">{parse(String(child2?.message))}</p>
|
|
||||||
<div>
|
<div>
|
||||||
<a
|
<a
|
||||||
style={
|
style={
|
||||||
Number(child2.suggestionFrom?.id) == Number(userId)
|
Number(child2.suggestionFrom?.id) ==
|
||||||
|
Number(userId)
|
||||||
? {
|
? {
|
||||||
display: "none",
|
display: "none",
|
||||||
}
|
}
|
||||||
: {}
|
: {}
|
||||||
}
|
}
|
||||||
onClick={() => showInput(`comment-id-${child2.id}`)}
|
onClick={() =>
|
||||||
|
showInput(`comment-id-${child2.id}`)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<small className="flex items-start bg-[#bb3523] rounded-lg w-fit text-white px-2 text-xs lg:text-base lg:px-4 py-1 cursor-pointer">{t("reply")}</small>
|
<small className="flex items-start bg-[#bb3523] rounded-lg w-fit text-white px-2 text-xs lg:text-base lg:px-4 py-1 cursor-pointer">
|
||||||
|
{t("reply")}
|
||||||
|
</small>
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
style={
|
style={
|
||||||
Number(child2.suggestionFrom?.id) == Number(userId)
|
Number(child2.suggestionFrom?.id) ==
|
||||||
|
Number(userId)
|
||||||
? {}
|
? {}
|
||||||
: {
|
: {
|
||||||
display: "none",
|
display: "none",
|
||||||
|
|
@ -802,20 +1081,40 @@ const DetailInfo = () => {
|
||||||
}
|
}
|
||||||
onClick={() => deleteData(child2.id)}
|
onClick={() => deleteData(child2.id)}
|
||||||
>
|
>
|
||||||
<small className="flex items-start bg-[#bb3523] rounded-lg w-fit text-white px-2 text-xs lg:text-base lg:px-4 py-1 cursor-pointer">{t("delete")}</small>
|
<small className="flex items-start bg-[#bb3523] rounded-lg w-fit text-white px-2 text-xs lg:text-base lg:px-4 py-1 cursor-pointer">
|
||||||
|
{t("delete")}
|
||||||
|
</small>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{visibleInput === `comment-id-${child2.id}` && (
|
{visibleInput === `comment-id-${child2.id}` && (
|
||||||
<div id={`comment-id-${child2.id}`} className="px-4 lg:px-14 pl-40 lg:pl-[265px]">
|
<div
|
||||||
<Textarea name="" id={`input-comment-${child2.id}`} className="my-2" placeholder="Masukkan balasan anda" />
|
id={`comment-id-${child2.id}`}
|
||||||
|
className="px-4 lg:px-14 pl-40 lg:pl-[265px]"
|
||||||
|
>
|
||||||
|
<Textarea
|
||||||
|
name=""
|
||||||
|
id={`input-comment-${child2.id}`}
|
||||||
|
className="my-2"
|
||||||
|
placeholder="Masukkan balasan anda"
|
||||||
|
/>
|
||||||
<div className="flex flex-row gap-3">
|
<div className="flex flex-row gap-3">
|
||||||
<a onClick={() => postDataChild(child2.id)}>
|
<a
|
||||||
<small className="flex items-start bg-[#bb3523] rounded-lg w-fit text-white px-2 text-xs lg:text-base lg:px-4 py-1 cursor-pointer">{t("send")}</small>
|
onClick={() => postDataChild(child2.id)}
|
||||||
|
>
|
||||||
|
<small className="flex items-start bg-[#bb3523] rounded-lg w-fit text-white px-2 text-xs lg:text-base lg:px-4 py-1 cursor-pointer">
|
||||||
|
{t("send")}
|
||||||
|
</small>
|
||||||
</a>
|
</a>
|
||||||
<a onClick={() => showInput(`comment-id-${child2.id}`)}>
|
<a
|
||||||
<small className="flex items-start bg-[#bb3523] rounded-lg w-fit text-white px-2 text-xs lg:text-base lg:px-4 py-1 cursor-pointer">{t("cancel")}</small>
|
onClick={() =>
|
||||||
|
showInput(`comment-id-${child2.id}`)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<small className="flex items-start bg-[#bb3523] rounded-lg w-fit text-white px-2 text-xs lg:text-base lg:px-4 py-1 cursor-pointer">
|
||||||
|
{t("cancel")}
|
||||||
|
</small>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
import { getCategoryData, getPublicCategoryData } from "@/service/landing/landing";
|
import {
|
||||||
|
getCategoryData,
|
||||||
|
getPublicCategoryData,
|
||||||
|
} from "@/service/landing/landing";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { Button } from "../ui/button";
|
import { Button } from "../ui/button";
|
||||||
|
|
@ -21,7 +24,15 @@ const ContentCategory = (props: { group?: string }) => {
|
||||||
}, []);
|
}, []);
|
||||||
const initFetch = async () => {
|
const initFetch = async () => {
|
||||||
const response = await getPublicCategoryData(
|
const response = await getPublicCategoryData(
|
||||||
props.group == "mabes" ? "" : props.group == "polda" && poldaName && String(poldaName)?.length > 1 ? poldaName : props.group == "satker" && satkerName && String(satkerName)?.length > 1 ? "satker-" + satkerName : "",
|
props.group == "mabes"
|
||||||
|
? ""
|
||||||
|
: props.group == "polda" && poldaName && String(poldaName)?.length > 1
|
||||||
|
? poldaName
|
||||||
|
: props.group == "satker" &&
|
||||||
|
satkerName &&
|
||||||
|
String(satkerName)?.length > 1
|
||||||
|
? "satker-" + satkerName
|
||||||
|
: "",
|
||||||
"",
|
"",
|
||||||
locale == "en" ? true : false
|
locale == "en" ? true : false
|
||||||
);
|
);
|
||||||
|
|
@ -47,7 +58,10 @@ const ContentCategory = (props: { group?: string }) => {
|
||||||
<animate xlink:href="#r" attributeName="x" from="-${w}" to="${w}" dur="1s" repeatCount="indefinite" />
|
<animate xlink:href="#r" attributeName="x" from="-${w}" to="${w}" dur="1s" repeatCount="indefinite" />
|
||||||
</svg>`;
|
</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 (
|
return (
|
||||||
<div className="px-4 lg:px-24 py-10">
|
<div className="px-4 lg:px-24 py-10">
|
||||||
|
|
@ -85,10 +99,16 @@ const ContentCategory = (props: { group?: string }) => {
|
||||||
// <h3 className="text-sm font-semibold truncate">{category?.name}</h3>
|
// <h3 className="text-sm font-semibold truncate">{category?.name}</h3>
|
||||||
// </div>
|
// </div>
|
||||||
// </Link>
|
// </Link>
|
||||||
<Link key={category?.id} href={`all/filter?category=${category?.id}`} className="relative group rounded-md overflow-hidden shadow-md hover:shadow-lg">
|
<Link
|
||||||
|
key={category?.id}
|
||||||
|
href={`all/filter?category=${category?.id}`}
|
||||||
|
className="relative group rounded-md overflow-hidden shadow-md hover:shadow-lg"
|
||||||
|
>
|
||||||
{/* Gambar */}
|
{/* Gambar */}
|
||||||
<Image
|
<Image
|
||||||
placeholder={`data:image/svg+xml;base64,${toBase64(shimmer(700, 475))}`}
|
placeholder={`data:image/svg+xml;base64,${toBase64(
|
||||||
|
shimmer(700, 475)
|
||||||
|
)}`}
|
||||||
alt="category"
|
alt="category"
|
||||||
width={2560}
|
width={2560}
|
||||||
height={1440}
|
height={1440}
|
||||||
|
|
@ -100,8 +120,10 @@ const ContentCategory = (props: { group?: string }) => {
|
||||||
<div className="absolute inset-0 bg-black bg-opacity-25 group-hover:bg-opacity-35 transition-all duration-300 rounded-md"></div>
|
<div className="absolute inset-0 bg-black bg-opacity-25 group-hover:bg-opacity-35 transition-all duration-300 rounded-md"></div>
|
||||||
|
|
||||||
{/* Judul */}
|
{/* Judul */}
|
||||||
<div className="absolute bottom-5 left-0 right-16 bg-transparent backdrop-blur-md text-white p-4 border-l-2 border-[#bb3523] z-10">
|
<div className="absolute bottom-5 left-0 right-16 bg-transparent backdrop-blur-md text-white p-4 border-l-2 border-[#bb3523] z-10 group-hover:scale-x-150 origin-left">
|
||||||
<h3 className="text-sm font-semibold truncate">{category?.name}</h3>
|
<h3 className="text-sm font-semibold truncate">
|
||||||
|
{category?.name}
|
||||||
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
) : (
|
) : (
|
||||||
|
|
@ -121,10 +143,16 @@ const ContentCategory = (props: { group?: string }) => {
|
||||||
// <h3 className="text-sm font-semibold truncate">{category?.name}</h3>
|
// <h3 className="text-sm font-semibold truncate">{category?.name}</h3>
|
||||||
// </div>
|
// </div>
|
||||||
// </Link>
|
// </Link>
|
||||||
<Link key={category?.id} href={`all/filter?category=${category?.id}`} className="relative group rounded-md overflow-hidden shadow-md hover:shadow-lg">
|
<Link
|
||||||
|
key={category?.id}
|
||||||
|
href={`all/filter?category=${category?.id}`}
|
||||||
|
className="relative group rounded-md overflow-hidden shadow-md hover:shadow-lg"
|
||||||
|
>
|
||||||
{/* Gambar */}
|
{/* Gambar */}
|
||||||
<Image
|
<Image
|
||||||
placeholder={`data:image/svg+xml;base64,${toBase64(shimmer(700, 475))}`}
|
placeholder={`data:image/svg+xml;base64,${toBase64(
|
||||||
|
shimmer(700, 475)
|
||||||
|
)}`}
|
||||||
alt="category"
|
alt="category"
|
||||||
width={2560}
|
width={2560}
|
||||||
height={1440}
|
height={1440}
|
||||||
|
|
@ -137,14 +165,19 @@ const ContentCategory = (props: { group?: string }) => {
|
||||||
|
|
||||||
{/* Judul */}
|
{/* Judul */}
|
||||||
<div className="absolute bottom-5 left-0 right-16 bg-transparent backdrop-blur-md text-white p-4 border-l-2 border-[#bb3523] z-10">
|
<div className="absolute bottom-5 left-0 right-16 bg-transparent backdrop-blur-md text-white p-4 border-l-2 border-[#bb3523] z-10">
|
||||||
<h3 className="text-sm font-semibold truncate">{category?.name}</h3>
|
<h3 className="text-sm font-semibold truncate">
|
||||||
|
{category?.name}
|
||||||
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center flex-row justify-center">
|
<div className="flex items-center flex-row justify-center">
|
||||||
<Button onClick={() => setSeeAllValue(!seeAllValue)} className="bg-white hover:bg-[#bb3523] text-[#bb3523] hover:text-white border-2 border-[#bb3523]">
|
<Button
|
||||||
|
onClick={() => setSeeAllValue(!seeAllValue)}
|
||||||
|
className="bg-white hover:bg-[#bb3523] text-[#bb3523] hover:text-white border-2 border-[#bb3523]"
|
||||||
|
>
|
||||||
{seeAllValue ? t("seeLess") : t("seeMore")}
|
{seeAllValue ? t("seeLess") : t("seeMore")}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -28,23 +28,33 @@ const Footer = () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<footer className="bg-[#bb3523] text-white text-xs lg:text-sm py-4 space-y-3 lg:space-y-0 h-">
|
<footer className="bg-[#bb3523] text-white text-xs lg:text-sm py-4 space-y-3 lg:space-y-0 h-">
|
||||||
<div className="mx-auto flex flex-col md:flex-row justify-between items-center px-4">
|
<div className="mx-auto flex flex-col md:flex-row justify-between items-center px-4 gap-3">
|
||||||
{/* Hak Cipta */}
|
{/* Hak Cipta */}
|
||||||
<div className="text-center md:text-left">
|
<div className="text-center md:text-left">
|
||||||
{t("copyright")} © {new Date().getFullYear()} {t("publicRelation")} {t("reserved")}
|
{t("copyright")} © {new Date().getFullYear()}{" "}
|
||||||
|
{t("publicRelation")} {t("reserved")}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Menu Links */}
|
{/* Menu Links */}
|
||||||
<div className="flex flex-wrap justify-center items-center space-x-3">
|
<div className="flex flex-wrap justify-center items-center space-x-3">
|
||||||
<Link href={generateLocalizedPath("/feedback", String(locale))} className="hover:underline">
|
<Link
|
||||||
|
href={generateLocalizedPath("/feedback", String(locale))}
|
||||||
|
className="hover:underline"
|
||||||
|
>
|
||||||
{t("feedback")}
|
{t("feedback")}
|
||||||
</Link>
|
</Link>
|
||||||
<span className="hidden md:inline-block ">|</span>
|
<span className="hidden md:inline-block ">|</span>
|
||||||
<Link href={generateLocalizedPath("/contact", String(locale))} className="hover:underline">
|
<Link
|
||||||
|
href={generateLocalizedPath("/contact", String(locale))}
|
||||||
|
className="hover:underline"
|
||||||
|
>
|
||||||
{t("contact")}
|
{t("contact")}
|
||||||
</Link>
|
</Link>
|
||||||
<span className="hidden md:inline-block">|</span>
|
<span className="hidden md:inline-block">|</span>
|
||||||
<Link href={generateLocalizedPath("/faqs", String(locale))} className="hover:underline">
|
<Link
|
||||||
|
href={generateLocalizedPath("/faqs", String(locale))}
|
||||||
|
className="hover:underline"
|
||||||
|
>
|
||||||
FAQ
|
FAQ
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
|
|
@ -55,12 +65,17 @@ const Footer = () => {
|
||||||
{t("privacy")}
|
{t("privacy")}
|
||||||
</a>
|
</a>
|
||||||
</DialogTrigger>
|
</DialogTrigger>
|
||||||
<DialogContent className="flex flex-col overflow-y-scroll h-[80%]" size="md">
|
<DialogContent
|
||||||
|
className="flex flex-col overflow-y-scroll h-[80%]"
|
||||||
|
size="md"
|
||||||
|
>
|
||||||
<div className="flex flex-row items-center justify-center gap-4">
|
<div className="flex flex-row items-center justify-center gap-4">
|
||||||
<img src="/assets/icon-privacy.png" alt="Privacy" />
|
<img src="/assets/icon-privacy.png" alt="Privacy" />
|
||||||
<p className="font-semibold text-lg">{t("privacy")}</p>
|
<p className="font-semibold text-lg">{t("privacy")}</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="container text-black dark:text-white space-y-2">{parse(String(privacy))}</div>
|
<div className="container text-black dark:text-white space-y-2">
|
||||||
|
{parse(String(privacy))}
|
||||||
|
</div>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -69,13 +84,25 @@ const Footer = () => {
|
||||||
<div className="flex justify-center items-center space-x-3">
|
<div className="flex justify-center items-center space-x-3">
|
||||||
<span className="text-sm">Follow Us:</span>
|
<span className="text-sm">Follow Us:</span>
|
||||||
<a href="#" aria-label="Facebook">
|
<a href="#" aria-label="Facebook">
|
||||||
<img src="/assets/facebook.svg" alt="Facebook" className="w-5 h-5" />
|
<img
|
||||||
|
src="/assets/facebook.svg"
|
||||||
|
alt="Facebook"
|
||||||
|
className="w-5 h-5"
|
||||||
|
/>
|
||||||
</a>
|
</a>
|
||||||
<a href="#" aria-label="Instagram">
|
<a href="#" aria-label="Instagram">
|
||||||
<img src="/assets/instagram.svg" alt="Instagram" className="w-5 h-5" />
|
<img
|
||||||
|
src="/assets/instagram.svg"
|
||||||
|
alt="Instagram"
|
||||||
|
className="w-5 h-5"
|
||||||
|
/>
|
||||||
</a>
|
</a>
|
||||||
<a href="#" aria-label="Twitter">
|
<a href="#" aria-label="Twitter">
|
||||||
<img src="/assets/twitter.svg" alt="Instagram" className="w-5 h-5" />
|
<img
|
||||||
|
src="/assets/twitter.svg"
|
||||||
|
alt="Instagram"
|
||||||
|
className="w-5 h-5"
|
||||||
|
/>
|
||||||
</a>
|
</a>
|
||||||
<a href="#" aria-label="TikTok">
|
<a href="#" aria-label="TikTok">
|
||||||
<img src="/assets/tiktok.svg" alt="TikTok" className="w-5 h-5" />
|
<img src="/assets/tiktok.svg" alt="TikTok" className="w-5 h-5" />
|
||||||
|
|
|
||||||
|
|
@ -14,18 +14,116 @@ import {
|
||||||
} from "@/components/ui/carousel";
|
} from "@/components/ui/carousel";
|
||||||
import { Skeleton } from "../ui/skeleton";
|
import { Skeleton } from "../ui/skeleton";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { TabsList, TabsTrigger, TabsContent } from "@radix-ui/react-tabs";
|
import Cookies from "js-cookie";
|
||||||
import { Input } from "postcss";
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "../ui/tabs";
|
||||||
import { Button } from "react-day-picker";
|
|
||||||
import { Label } from "recharts";
|
|
||||||
import {
|
import {
|
||||||
|
Card,
|
||||||
|
CardContent,
|
||||||
|
CardDescription,
|
||||||
|
CardFooter,
|
||||||
CardHeader,
|
CardHeader,
|
||||||
CardTitle,
|
CardTitle,
|
||||||
CardDescription,
|
|
||||||
CardContent,
|
|
||||||
CardFooter,
|
|
||||||
} from "../ui/card";
|
} from "../ui/card";
|
||||||
import { Tabs } from "../ui/tabs";
|
import { Label } from "../ui/label";
|
||||||
|
import { Input } from "../ui/input";
|
||||||
|
import { Button } from "../ui/button";
|
||||||
|
|
||||||
|
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();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
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">
|
||||||
|
<Carousel className="w-full">
|
||||||
|
<CarouselContent>
|
||||||
|
{heroData?.map((list: any, index: any) => (
|
||||||
|
<CarouselItem 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"
|
||||||
|
>
|
||||||
|
✕
|
||||||
|
</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-blur-sm 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>
|
||||||
|
</CarouselItem>
|
||||||
|
))}
|
||||||
|
</CarouselContent>
|
||||||
|
<CarouselPrevious className="hover:bg-black ml-1 lg:ml-0" />
|
||||||
|
<CarouselNext className="hover:bg-black mr-1 lg:mr-0" />
|
||||||
|
</Carousel>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const Hero: React.FC = () => {
|
const Hero: React.FC = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
@ -34,6 +132,7 @@ const Hero: React.FC = () => {
|
||||||
const locale = params?.locale;
|
const locale = params?.locale;
|
||||||
const [isLoading, setIsLoading] = useState<any>(true);
|
const [isLoading, setIsLoading] = useState<any>(true);
|
||||||
const [heroData, setHeroData] = useState<any>();
|
const [heroData, setHeroData] = useState<any>();
|
||||||
|
const [showModal, setShowModal] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
|
|
@ -43,6 +142,14 @@ const Hero: React.FC = () => {
|
||||||
return () => clearTimeout(timer);
|
return () => clearTimeout(timer);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const roleId = Cookies.get("urie");
|
||||||
|
if (!roleId) {
|
||||||
|
setShowModal(true); // hanya munculkan modal jika urie tidak ada
|
||||||
|
}
|
||||||
|
initFetch();
|
||||||
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function fetchCategories() {
|
async function fetchCategories() {
|
||||||
const url = "https://netidhub.com/api/csrf";
|
const url = "https://netidhub.com/api/csrf";
|
||||||
|
|
@ -55,7 +162,7 @@ const Hero: React.FC = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
return data; // Menampilkan data yang diterima dari API
|
return data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Fetch error: ", error);
|
console.error("Fetch error: ", error);
|
||||||
}
|
}
|
||||||
|
|
@ -92,7 +199,9 @@ const Hero: React.FC = () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col lg:flex-row items-start justify-center gap-8 px-4 lg:px-20 py-4 mx-auto w-auto mt-6">
|
<div className="flex flex-col lg:flex-row items-start justify-center gap-8 px-4 lg:px-20 py-4 mx-auto w-auto mt-6">
|
||||||
{/* Section Gambar Utama */}
|
<div className="relative">
|
||||||
|
{showModal && <HeroModal onClose={() => setShowModal(false)} />}
|
||||||
|
</div>
|
||||||
{isLoading ? (
|
{isLoading ? (
|
||||||
<div className="flex flex-col space-y-3 mx-auto w-full lg:w-2/3">
|
<div className="flex flex-col space-y-3 mx-auto w-full lg:w-2/3">
|
||||||
<Skeleton className="h-[310px] lg:h-[420px] rounded-xl" />
|
<Skeleton className="h-[310px] lg:h-[420px] rounded-xl" />
|
||||||
|
|
@ -118,30 +227,32 @@ const Hero: React.FC = () => {
|
||||||
className="w-full h-[310px] lg:h-[420px] rounded-lg object-cover"
|
className="w-full h-[310px] lg:h-[420px] rounded-lg object-cover"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className="absolute bottom-0 left-0 right-0 bg-transparent backdrop-blur-sm text-black dark:text-white p-4 rounded-b-lg">
|
<div className="absolute bottom-0 left-0 right-0 bg-black/30 backdrop-blur-sm text-white pb-4 px-4 pt-8 rounded-bl-2xl rounded-tr-2xl mx-3 mb-2">
|
||||||
<span className="text-white bg-[#bb3523] rounded-md w-full h-full font-semibold uppercase text-xs px-2 py-1">
|
<div className="absolute top-0 left-0 bottom-0 w-2 bg-[#bb3523] rounded-bl-lg"></div>
|
||||||
{list?.categoryName}
|
<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>
|
</span>
|
||||||
|
|
||||||
<Link href={`${locale}/image/detail/${list?.slug}`}>
|
<Link href={`${locale}/image/detail/${list?.slug}`}>
|
||||||
<h2 className="text-lg text-slate-500 dark:text-white font-bold mt-2">
|
<h2 className="text-lg leading-tight">{list?.title}</h2>
|
||||||
{list?.title}
|
|
||||||
</h2>
|
|
||||||
</Link>
|
</Link>
|
||||||
<p className="text-xs flex flex-row items-center text-slate-500 dark:text-white gap-1 mt-1">
|
|
||||||
|
<p className="text-xs flex items-center gap-1 mt-2 opacity-80">
|
||||||
{formatDateToIndonesian(new Date(list?.createdAt))}{" "}
|
{formatDateToIndonesian(new Date(list?.createdAt))}{" "}
|
||||||
{list?.timezone ? list?.timezone : "WIB"}|{" "}
|
{list?.timezone || "WIB"} |{" "}
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="1.2em"
|
width="1em"
|
||||||
height="1.2em"
|
height="1em"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
|
className="inline-block"
|
||||||
>
|
>
|
||||||
<path
|
<path
|
||||||
fill="currentColor"
|
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"
|
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>{" "}
|
</svg>
|
||||||
{list?.clickCount}{" "}
|
{list?.clickCount}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -153,7 +264,6 @@ const Hero: React.FC = () => {
|
||||||
</Carousel>
|
</Carousel>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Section Kanan */}
|
|
||||||
<div>
|
<div>
|
||||||
{isLoading ? (
|
{isLoading ? (
|
||||||
<>
|
<>
|
||||||
|
|
@ -195,48 +305,150 @@ const Hero: React.FC = () => {
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<ul className="py-4 lg:py-0 flex flex-row lg:flex-col gap-4 flex-nowrap w-[95vw] lg:w-auto overflow-x-auto">
|
<ul className="py-4 lg:py-0 flex flex-row lg:flex-col gap-4 flex-nowrap w-[95vw] lg:w-auto overflow-x-auto">
|
||||||
{heroData?.map((item: any) => (
|
<Tabs defaultValue="national" className="w-[350px]">
|
||||||
<li key={item?.id} className="flex gap-4 flex-row lg:w-full ">
|
<TabsList className="grid w-full grid-cols-3">
|
||||||
<div className="flex-shrink-0 w-24 rounded-lg">
|
<TabsTrigger value="national">Nasional</TabsTrigger>
|
||||||
<Image
|
<TabsTrigger value="polda">Polda</TabsTrigger>
|
||||||
placeholder={`data:image/svg+xml;base64,${toBase64(
|
<TabsTrigger value="satker">Satker</TabsTrigger>
|
||||||
shimmer(700, 475)
|
</TabsList>
|
||||||
)}`}
|
<TabsContent value="national">
|
||||||
width={720}
|
{heroData?.map((item: any) => (
|
||||||
height={480}
|
<li key={item?.id} className="flex gap-4 flex-row lg:w-full ">
|
||||||
src={item?.thumbnailLink}
|
<div className="flex-shrink-0 w-24 rounded-lg">
|
||||||
alt={item?.title}
|
<Image
|
||||||
className="w-full h-[73px] object-cover rounded-lg"
|
placeholder={`data:image/svg+xml;base64,${toBase64(
|
||||||
/>
|
shimmer(700, 475)
|
||||||
</div>
|
)}`}
|
||||||
<div className="w-[280px] lg:w-auto">
|
width={720}
|
||||||
<span className="text-white bg-[#bb3523] px-4 py-1 rounded-lg flex text-[8px] font-bold uppercase w-fit">
|
height={480}
|
||||||
{item?.categoryName}
|
src={item?.thumbnailLink}
|
||||||
</span>
|
alt={item?.title}
|
||||||
<Link href={`${locale}/image/detail/${item?.slug}`}>
|
className="w-full h-[73px] object-cover rounded-lg"
|
||||||
<h3 className="text-base font-bold mt-2 h-6 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible">
|
|
||||||
{item?.title}
|
|
||||||
</h3>
|
|
||||||
</Link>
|
|
||||||
<p className="text-[10px] flex flex-row items-center gap-1 text-gray-500 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>{" "}
|
</div>
|
||||||
{item?.clickCount}
|
<div className="w-[280px] lg:w-auto">
|
||||||
</p>
|
<span className="text-white bg-[#bb3523] px-4 py-1 rounded-lg flex text-[8px] font-bold uppercase w-fit">
|
||||||
</div>
|
{item?.categoryName}
|
||||||
</li>
|
</span>
|
||||||
))}
|
<Link href={`${locale}/image/detail/${item?.slug}`}>
|
||||||
|
<h3 className="text-base font-bold mt-2 h-6 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible">
|
||||||
|
{item?.title}
|
||||||
|
</h3>
|
||||||
|
</Link>
|
||||||
|
<p className="text-[10px] flex flex-row items-center gap-1 text-gray-500 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>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</TabsContent>
|
||||||
|
<TabsContent value="polda">
|
||||||
|
{heroData
|
||||||
|
?.filter((item: any) => item.isPublishOnPolda === true)
|
||||||
|
.map((item: any, index: any) => (
|
||||||
|
<li
|
||||||
|
key={item?.id}
|
||||||
|
className="flex gap-4 flex-row lg:w-full "
|
||||||
|
>
|
||||||
|
<div className="flex-shrink-0 w-24 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-[73px] object-cover rounded-lg"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="w-[280px] lg:w-auto">
|
||||||
|
<span className="text-white bg-[#bb3523] px-4 py-1 rounded-lg flex text-[8px] font-bold uppercase w-fit">
|
||||||
|
{item?.categoryName}
|
||||||
|
</span>
|
||||||
|
<Link href={`${locale}/image/detail/${item?.slug}`}>
|
||||||
|
<h3 className="text-base font-bold mt-2 h-6 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible">
|
||||||
|
{item?.title}
|
||||||
|
</h3>
|
||||||
|
</Link>
|
||||||
|
<p className="text-[10px] flex flex-row items-center gap-1 text-gray-500 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>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</TabsContent>
|
||||||
|
<TabsContent value="satker">
|
||||||
|
{heroData?.map((item: any) => (
|
||||||
|
<li key={item?.id} className="flex gap-4 flex-row lg:w-full ">
|
||||||
|
<div className="flex-shrink-0 w-24 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-[73px] object-cover rounded-lg"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="w-[280px] lg:w-auto">
|
||||||
|
<span className="text-white bg-[#bb3523] px-4 py-1 rounded-lg flex text-[8px] font-bold uppercase w-fit">
|
||||||
|
{item?.categoryName}
|
||||||
|
</span>
|
||||||
|
<Link href={`${locale}/image/detail/${item?.slug}`}>
|
||||||
|
<h3 className="text-base font-bold mt-2 h-6 hover:h-auto truncate hover:whitespace-normal hover:overflow-visible">
|
||||||
|
{item?.title}
|
||||||
|
</h3>
|
||||||
|
</Link>
|
||||||
|
<p className="text-[10px] flex flex-row items-center gap-1 text-gray-500 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>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</TabsContent>
|
||||||
|
</Tabs>
|
||||||
</ul>
|
</ul>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -2,7 +2,13 @@
|
||||||
|
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
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 { useParams, usePathname } from "next/navigation";
|
||||||
import { Icon } from "@iconify/react/dist/iconify.js";
|
import { Icon } from "@iconify/react/dist/iconify.js";
|
||||||
import { formatDateToIndonesian, secondToTimes } from "@/utils/globals";
|
import { formatDateToIndonesian, secondToTimes } from "@/utils/globals";
|
||||||
|
|
@ -25,7 +31,11 @@ const NewContent = (props: { group: string; type: string }) => {
|
||||||
const satkerName = params?.satker_name;
|
const satkerName = params?.satker_name;
|
||||||
const t = useTranslations("LandingPage");
|
const t = useTranslations("LandingPage");
|
||||||
|
|
||||||
let prefixPath = poldaName ? `/polda/${poldaName}` : satkerName ? `/satker/${satkerName}` : "/";
|
let prefixPath = poldaName
|
||||||
|
? `/polda/${poldaName}`
|
||||||
|
: satkerName
|
||||||
|
? `/satker/${satkerName}`
|
||||||
|
: "/";
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
|
|
@ -45,8 +55,26 @@ const NewContent = (props: { group: string; type: string }) => {
|
||||||
page: 0,
|
page: 0,
|
||||||
size: 5,
|
size: 5,
|
||||||
sortBy: props.type == "popular" ? "clickCount" : "createdAt",
|
sortBy: props.type == "popular" ? "clickCount" : "createdAt",
|
||||||
contentTypeId: selectedTab == "image" ? "1" : selectedTab == "video" ? "2" : selectedTab == "text" ? "3" : selectedTab == "audio" ? "4" : "",
|
contentTypeId:
|
||||||
group: props.group == "mabes" ? "" : props.group == "polda" && poldaName && String(poldaName)?.length > 1 ? poldaName : props.group == "satker" && satkerName && String(satkerName)?.length > 1 ? "satker-" + satkerName : "",
|
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,
|
isInt: locale == "en" ? true : false,
|
||||||
};
|
};
|
||||||
const response = await getListContent(request);
|
const response = await getListContent(request);
|
||||||
|
|
@ -68,7 +96,10 @@ const NewContent = (props: { group: string; type: string }) => {
|
||||||
<animate xlink:href="#r" attributeName="x" from="-${w}" to="${w}" dur="1s" repeatCount="indefinite" />
|
<animate xlink:href="#r" attributeName="x" from="-${w}" to="${w}" dur="1s" repeatCount="indefinite" />
|
||||||
</svg>`;
|
</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 (
|
return (
|
||||||
<div className="px-4 lg:px-16 py-4">
|
<div className="px-4 lg:px-16 py-4">
|
||||||
|
|
@ -79,11 +110,22 @@ const NewContent = (props: { group: string; type: string }) => {
|
||||||
{pathname?.split("/")[1] == "in" ? (
|
{pathname?.split("/")[1] == "in" ? (
|
||||||
<>
|
<>
|
||||||
<span className="text-black ">{t("content")}</span>
|
<span className="text-black ">{t("content")}</span>
|
||||||
{props.type == "popular" ? "Terpopuler" : props.type == "latest" ? t("new") : "Serupa"}
|
{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-black ">
|
||||||
|
{props.type == "popular"
|
||||||
|
? "Popular"
|
||||||
|
: props.type == "latest"
|
||||||
|
? t("new")
|
||||||
|
: "Serupa"}
|
||||||
|
</span>
|
||||||
|
|
||||||
{t("content")}
|
{t("content")}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
@ -96,21 +138,27 @@ const NewContent = (props: { group: string; type: string }) => {
|
||||||
>
|
>
|
||||||
{t("image")}
|
{t("image")}
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
<div className="text-[#bb3523] text-lg hidden md:inline-block">|</div>
|
<div className="text-[#bb3523] text-lg hidden md:inline-block">
|
||||||
|
|
|
||||||
|
</div>
|
||||||
<TabsTrigger
|
<TabsTrigger
|
||||||
value="video"
|
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"
|
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")}
|
{t("video")}
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
<div className="text-[#bb3523] text-lg hidden md:inline-block">|</div>
|
<div className="text-[#bb3523] text-lg hidden md:inline-block">
|
||||||
|
|
|
||||||
|
</div>
|
||||||
<TabsTrigger
|
<TabsTrigger
|
||||||
value="text"
|
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"
|
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")}
|
{t("text")}
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
<div className="text-[#bb3523] text-lg hidden md:inline-block">|</div>
|
<div className="text-[#bb3523] text-lg hidden md:inline-block">
|
||||||
|
|
|
||||||
|
</div>
|
||||||
<TabsTrigger
|
<TabsTrigger
|
||||||
value="audio"
|
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"
|
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"
|
||||||
|
|
@ -134,10 +182,22 @@ const NewContent = (props: { group: string; type: string }) => {
|
||||||
<Carousel className="w-full max-w-7xl mx-auto">
|
<Carousel className="w-full max-w-7xl mx-auto">
|
||||||
<CarouselContent>
|
<CarouselContent>
|
||||||
{newContent?.map((image: any) => (
|
{newContent?.map((image: any) => (
|
||||||
<CarouselItem key={image?.id} className="md:basis-1/2 lg:basis-1/3">
|
<CarouselItem
|
||||||
<div onClick={() => router.push(prefixPath + `/image/detail/${image?.slug}`)} className="cursor-pointer relative group overflow-hidden shadow-md hover:shadow-lg">
|
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
|
<Image
|
||||||
placeholder={`data:image/svg+xml;base64,${toBase64(shimmer(700, 475))}`}
|
placeholder={`data:image/svg+xml;base64,${toBase64(
|
||||||
|
shimmer(700, 475)
|
||||||
|
)}`}
|
||||||
width={2560}
|
width={2560}
|
||||||
height={1440}
|
height={1440}
|
||||||
alt="image"
|
alt="image"
|
||||||
|
|
@ -145,9 +205,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"
|
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-600 border-l-4 border-[#bb3523] rounded-lg backdrop-blur-sm text-white p-2">
|
<div className="absolute bottom-0 left-0 right-0 bg-gray-600 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">
|
||||||
<p className="flex flex-row items-center text-[10px] gap-2">
|
{image?.title}
|
||||||
{formatDateToIndonesian(new Date(image?.createdAt))} {image?.timezone ? image?.timezone : "WIB"} | <Icon icon="formkit:eye" width="15" height="15" /> {image.clickCount}{" "}
|
</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}{" "}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -159,7 +230,13 @@ const NewContent = (props: { group: string; type: string }) => {
|
||||||
</Carousel>
|
</Carousel>
|
||||||
) : (
|
) : (
|
||||||
<p className="flex items-center justify-center">
|
<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>
|
</p>
|
||||||
)
|
)
|
||||||
) : selectedTab == "audio" ? (
|
) : selectedTab == "audio" ? (
|
||||||
|
|
@ -167,11 +244,27 @@ const NewContent = (props: { group: string; type: string }) => {
|
||||||
<Carousel className="w-full max-w-7xl mx-auto">
|
<Carousel className="w-full max-w-7xl mx-auto">
|
||||||
<CarouselContent>
|
<CarouselContent>
|
||||||
{newContent?.map((audio: any) => (
|
{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 className="flex flex-row gap-6">
|
||||||
<div onClick={() => router.push(prefixPath + `/audio/detail/${audio?.slug}`)} className="cursor-pointer flex flex-col sm:flex-row items-center bg-white dark:bg-gray-800 shadow-md rounded-lg p-4 gap-4 w-full">
|
<div
|
||||||
<div className="flex items-center justify-center bg-red-500 text-white rounded-lg w-24 h-8 lg:h-16">
|
onClick={() =>
|
||||||
<svg width="32" height="34" viewBox="0 0 32 34" fill="null" xmlns="http://www.w3.org/2000/svg">
|
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"
|
||||||
|
>
|
||||||
<path
|
<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"
|
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"
|
fill="white"
|
||||||
|
|
@ -181,11 +274,27 @@ const NewContent = (props: { group: string; type: string }) => {
|
||||||
|
|
||||||
<div className="flex flex-col flex-1">
|
<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">
|
<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}{" "}
|
{audio?.clickCount}{" "}
|
||||||
</div>
|
</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>
|
<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">
|
||||||
<p className="text-sm"> {audio?.duration ? secondToTimes(Number(audio?.duration)) : "00:00:00"}</p>
|
{audio?.title}
|
||||||
|
</div>
|
||||||
|
<p className="text-sm">
|
||||||
|
{" "}
|
||||||
|
{audio?.duration
|
||||||
|
? secondToTimes(Number(audio?.duration))
|
||||||
|
: "00:00:00"}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -197,7 +306,13 @@ const NewContent = (props: { group: string; type: string }) => {
|
||||||
</Carousel>
|
</Carousel>
|
||||||
) : (
|
) : (
|
||||||
<p className="flex items-center justify-center">
|
<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>
|
</p>
|
||||||
)
|
)
|
||||||
) : selectedTab == "video" ? (
|
) : selectedTab == "video" ? (
|
||||||
|
|
@ -205,13 +320,43 @@ const NewContent = (props: { group: string; type: string }) => {
|
||||||
<Carousel className="w-full max-w-7xl mx-auto">
|
<Carousel className="w-full max-w-7xl mx-auto">
|
||||||
<CarouselContent>
|
<CarouselContent>
|
||||||
{newContent?.map((video: any) => (
|
{newContent?.map((video: any) => (
|
||||||
<CarouselItem key={video?.id} className="md:basis-1/2 lg:basis-1/3">
|
<CarouselItem
|
||||||
<div onClick={() => router.push(prefixPath + `/video/detail/${video?.slug}`)} className="cursor-pointer relative group rounded-md overflow-hidden shadow-md hover:shadow-lg">
|
key={video?.id}
|
||||||
<Image placeholder={`data:image/svg+xml;base64,${toBase64(shimmer(700, 475))}`} alt="video" width={2560} height={1440} src={video?.thumbnailLink} className="w-full h-40 lg:h-60 object-cover rounded-lg group-hover:scale-100 transition-transform duration-300" />
|
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)
|
||||||
|
)}`}
|
||||||
|
alt="video"
|
||||||
|
width={2560}
|
||||||
|
height={1440}
|
||||||
|
src={video?.thumbnailLink}
|
||||||
|
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">
|
<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">
|
||||||
<p className="flex flex-row items-center text-sm gap-2">
|
{video?.title}
|
||||||
{formatDateToIndonesian(new Date(video?.createdAt))} {video?.timezone ? video?.timezone : "WIB"}| <Icon icon="formkit:eye" width="15" height="15" /> {video?.clickCount}{" "}
|
</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}{" "}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -223,18 +368,40 @@ const NewContent = (props: { group: string; type: string }) => {
|
||||||
</Carousel>
|
</Carousel>
|
||||||
) : (
|
) : (
|
||||||
<p className="flex items-center justify-center">
|
<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>
|
</p>
|
||||||
)
|
)
|
||||||
) : newContent.length > 0 ? (
|
) : newContent.length > 0 ? (
|
||||||
<Carousel className="w-full max-w-7xl mx-auto">
|
<Carousel className="w-full max-w-7xl mx-auto">
|
||||||
<CarouselContent>
|
<CarouselContent>
|
||||||
{newContent?.map((text: any) => (
|
{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 className="md:basis-1/2 lg:basis-1/3">
|
||||||
<div onClick={() => router.push(prefixPath + `/document/detail/${text?.slug}`)} className="flex flex-col 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">
|
<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
|
<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"
|
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"
|
fill="black"
|
||||||
|
|
@ -244,15 +411,31 @@ const NewContent = (props: { group: string; type: string }) => {
|
||||||
|
|
||||||
<div className="flex w-full pr-10 flex-col flex-1">
|
<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">
|
<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"}|
|
{text?.timezone ? text?.timezone : "WIB"}|
|
||||||
<Icon icon="formkit:eye" width="15" height="15" />
|
<Icon
|
||||||
|
icon="formkit:eye"
|
||||||
|
width="15"
|
||||||
|
height="15"
|
||||||
|
/>
|
||||||
{text?.clickCount}
|
{text?.clickCount}
|
||||||
</div>
|
</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">
|
<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">
|
<svg
|
||||||
<path fill="#f00" d="M224 30v256h-64l96 128l96-128h-64V30zM32 434v48h448v-48z" />
|
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>
|
</svg>
|
||||||
Download {t("document")}
|
Download {t("document")}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -267,14 +450,27 @@ const NewContent = (props: { group: string; type: string }) => {
|
||||||
</Carousel>
|
</Carousel>
|
||||||
) : (
|
) : (
|
||||||
<p className="flex items-center justify-center">
|
<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>
|
</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center flex-row justify-center">
|
<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")}
|
{t("seeAll")}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue