fix: show createdAdd in new-content

This commit is contained in:
Sabda Yagra 2025-11-06 16:18:33 +07:00
parent 78518f038e
commit 618e5f4edb
2 changed files with 76 additions and 17 deletions

View File

@ -193,7 +193,6 @@ export default function FormConvertSPIT() {
const [showRewriteEditor, setShowRewriteEditor] = useState(false); const [showRewriteEditor, setShowRewriteEditor] = useState(false);
const [isGeneratingRewrite, setIsGeneratingRewrite] = useState(false); const [isGeneratingRewrite, setIsGeneratingRewrite] = useState(false);
const [isLoadingRewrite, setIsLoadingRewrite] = useState(false); const [isLoadingRewrite, setIsLoadingRewrite] = useState(false);
// <-- changed: detailThumb is now FileType[] (objects from API) --> // <-- changed: detailThumb is now FileType[] (objects from API) -->
const [detailThumb, setDetailThumb] = useState<FileType[]>([]); const [detailThumb, setDetailThumb] = useState<FileType[]>([]);
const [thumbsSwiper, setThumbsSwiper] = useState<SwiperType | null>(null); const [thumbsSwiper, setThumbsSwiper] = useState<SwiperType | null>(null);

View File

@ -19,6 +19,8 @@ import { Skeleton } from "../ui/skeleton";
import Image from "next/image"; import Image from "next/image";
import { motion } from "framer-motion"; import { motion } from "framer-motion";
import ImageBlurry from "../ui/image-blurry"; import ImageBlurry from "../ui/image-blurry";
import { formatDateToIndonesian } from "@/utils/globals";
import { Icon } from "../ui/icon";
const NewContent = (props: { group: string; type: string }) => { const NewContent = (props: { group: string; type: string }) => {
const [newContent, setNewContent] = useState<any>(); const [newContent, setNewContent] = useState<any>();
@ -276,10 +278,24 @@ const NewContent = (props: { group: string; type: string }) => {
{/* Caption section */} {/* Caption section */}
<div className="p-4 h-full flex flex-col justify-between"> <div className="p-4 h-full flex flex-col justify-between">
<div className="flex flex-col gap-1 flex-grow"> <div className="flex flex-col gap-1 flex-grow">
<p className="text-[10px] font-bold text-[#bb3523] uppercase"> <div className="flex flex-row justify-between mb-2">
{image?.categoryName?.toUpperCase() ?? <p className="text-[10px] font-bold text-[#bb3523] uppercase">
"Giat Pimpinan"} {image?.categoryName?.toUpperCase() ??
</p> "Giat Pimpinan"}
</p>
<p className="flex flex-row items-center text-[10px] gap-1 text-gray-600">
{formatDateToIndonesian(
new Date(image?.createdAt)
)}{" "}
{image?.timezone ?? "WIB"} |
<Icon
icon="formkit:eye"
width="15"
height="15"
/>{" "}
{image.clickCount}
</p>
</div>
<Link <Link
href={ href={
prefixPath + `/image/detail/${image?.slug}` prefixPath + `/image/detail/${image?.slug}`
@ -366,12 +382,26 @@ const NewContent = (props: { group: string; type: string }) => {
{/* Caption */} {/* Caption */}
<div className="p-4"> <div className="p-4">
<p className="text-[12px] font-bold text-[#bb3523] uppercase mb-1"> <div className="flex flex-row justify-between mb-2">
{audio?.categoryName?.toUpperCase() ?? <p className="text-[10px] font-bold text-[#bb3523] uppercase">
"GIAT PIMPINAN"} {audio?.categoryName?.toUpperCase() ??
</p> "Giat Pimpinan"}
</p>
<p className="flex flex-row items-center text-[10px] gap-1 text-gray-600">
{formatDateToIndonesian(
new Date(audio?.createdAt)
)}{" "}
{audio?.timezone ?? "WIB"} |
<Icon
icon="formkit:eye"
width="15"
height="15"
/>{" "}
{audio.clickCount}
</p>
</div>
<p className="text-xl font-semibold text-black dark:text-white line-clamp-4"> <p className="text-sm lg:text-base font-semibold text-black dark:text-white line-clamp-4">
{audio?.title} {audio?.title}
</p> </p>
@ -488,10 +518,25 @@ const NewContent = (props: { group: string; type: string }) => {
{/* Caption section */} {/* Caption section */}
<div className="p-4 h-full flex flex-col justify-between"> <div className="p-4 h-full flex flex-col justify-between">
<div className="flex flex-col gap-1 flex-grow"> <div className="flex flex-col gap-1 flex-grow">
<p className="text-[10px] font-bold text-[#bb3523] uppercase"> <div className="flex flex-row justify-between mb-2">
{video?.categoryName?.toUpperCase() ?? <p className="text-[10px] font-bold text-[#bb3523] uppercase">
"Giat Pimpinan"} {video?.categoryName?.toUpperCase() ??
</p> "Giat Pimpinan"}
</p>
<p className="flex flex-row items-center text-[10px] gap-1 text-gray-600">
{formatDateToIndonesian(
new Date(video?.createdAt)
)}{" "}
{video?.timezone ?? "WIB"} |
<Icon
icon="formkit:eye"
width="15"
height="15"
/>{" "}
{video.clickCount}
</p>
</div>
<Link <Link
href={ href={
prefixPath + `/video/detail/${video?.slug}` prefixPath + `/video/detail/${video?.slug}`
@ -581,8 +626,23 @@ const NewContent = (props: { group: string; type: string }) => {
{/* Konten bawah */} {/* Konten bawah */}
<div className="p-4 flex flex-col gap-2"> <div className="p-4 flex flex-col gap-2">
{/* Kategori merah */} {/* Kategori merah */}
<div className="text-[12px] font-bold text-red-600 uppercase"> <div className="flex flex-row justify-between mb-2">
{text?.categoryName?.toUpperCase() ?? "Text"} <p className="text-[10px] font-bold text-[#bb3523] uppercase">
{text?.categoryName?.toUpperCase() ??
"Giat Pimpinan"}
</p>
<p className="flex flex-row items-center text-[10px] gap-1 text-gray-600">
{formatDateToIndonesian(
new Date(text?.createdAt)
)}{" "}
{text?.timezone ?? "WIB"} |
<Icon
icon="formkit:eye"
width="15"
height="15"
/>{" "}
{text.clickCount}
</p>
</div> </div>
{/* Judul */} {/* Judul */}
@ -591,7 +651,7 @@ const NewContent = (props: { group: string; type: string }) => {
prefixPath + `/document/detail/${text?.slug}` prefixPath + `/document/detail/${text?.slug}`
} }
> >
<p className="font-semibold text-gray-900 dark:text-white text-xl leading-snug line-clamp-4"> <p className="font-semibold text-gray-900 dark:text-white text-sm lg:text-base leading-snug line-clamp-4">
{text?.title} {text?.title}
</p> </p>
</Link> </Link>