fix:deleted article detail

This commit is contained in:
Rama Priyanto 2025-10-15 09:19:51 +07:00
parent cb7c9b7256
commit 0873cf973d
8 changed files with 14225 additions and 16452 deletions

View File

@ -13,15 +13,27 @@ export async function generateMetadata({ params }: any): Promise<Metadata> {
const res = await getArticleById(id?.split("-")[0]); const res = await getArticleById(id?.split("-")[0]);
const article = res?.data?.data; const article = res?.data?.data;
return { if (article) {
title: article.title, return {
description: article.description,
openGraph: {
title: article.title, title: article.title,
description: article.description, description: article.description,
images: [`${article.thumbnailUrl}`], openGraph: {
}, title: article.title,
}; description: article.description,
images: [`${article.thumbnailUrl}`],
},
};
} else {
return {
title: "",
description: "",
openGraph: {
title: "",
description: "",
images: [``],
},
};
}
} }
export default async function NewsPage({ params }: any) { export default async function NewsPage({ params }: any) {

View File

@ -1,6 +1,6 @@
// components/custom-editor.js // components/custom-editor.js
import React from "react"; import React, { useCallback, useEffect, useRef, useState } from "react";
import { CKEditor } from "@ckeditor/ckeditor5-react"; import { CKEditor } from "@ckeditor/ckeditor5-react";
import Editor from "ckeditor5-custom-build"; import Editor from "ckeditor5-custom-build";

View File

@ -62,7 +62,13 @@ export default function NewsDetailPage(props: { datas: any }) {
<p className=" text-lg">Berita</p> <p className=" text-lg">Berita</p>
</div> </div>
<div className=" lg:flex lg:justify-around gap-4 lg:gap-16 w-full"> <div className=" lg:flex lg:justify-around gap-4 lg:gap-16 w-full">
<DetailNews data={props.datas} listArticle={articles} /> {!props.datas || props.datas.isActive == false ? (
<div className="flex justify-center items-center">
<p className="text-3xl text-center">Article Tidak Ditemukan</p>
</div>
) : (
<DetailNews data={props.datas} listArticle={articles} />
)}
<div className="w-auto lg:w-[25%] hidden lg:block"> <div className="w-auto lg:w-[25%] hidden lg:block">
<SidebarDetail /> <SidebarDetail />
</div> </div>

View File

@ -166,7 +166,7 @@ export default function DetailNews(props: { data: any; listArticle: any }) {
</p> </p>
</div> </div>
<div className="flex justify-center my-2 lg:my-5"> <div className="flex justify-center my-2 lg:my-5">
{data.files.length > 0 ? ( {data?.files?.length > 0 ? (
data.files[0]?.file_name.split(".")[1].includes("doc") || data.files[0]?.file_name.split(".")[1].includes("doc") ||
data.files[0]?.file_name.split(".")[1].includes("pdf") ? ( data.files[0]?.file_name.split(".")[1].includes("pdf") ? (
<Image <Image
@ -195,7 +195,7 @@ export default function DetailNews(props: { data: any; listArticle: any }) {
"" ""
)} )}
</div> </div>
{data.files?.length > 0 && {data?.files?.length > 0 &&
(data.files[0].file_name.split(".")[1].includes("doc") || (data.files[0].file_name.split(".")[1].includes("doc") ||
data.files[0].file_name.split(".")[1].includes("pdf") ? ( data.files[0].file_name.split(".")[1].includes("pdf") ? (
data.files?.map((file: any, index: number) => ( data.files?.map((file: any, index: number) => (

30586
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,6 @@
}, },
"dependencies": { "dependencies": {
"@ckeditor/ckeditor5-react": "^6.2.0", "@ckeditor/ckeditor5-react": "^6.2.0",
"@ckeditor/ckeditor5-watchdog": "^45.0.0",
"@heroui/breadcrumbs": "^2.2.6", "@heroui/breadcrumbs": "^2.2.6",
"@heroui/button": "^2.2.10", "@heroui/button": "^2.2.10",
"@heroui/code": "2.2.7", "@heroui/code": "2.2.7",

View File

@ -29,7 +29,7 @@
padding: 1.5em 2em !important; padding: 1.5em 2em !important;
min-height: 400px; min-height: 400px;
line-height: 1.6; line-height: 1.6;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
font-size: 14px; font-size: 14px;
color: #333; color: #333;
} }
@ -63,12 +63,24 @@
line-height: 1.4; line-height: 1.4;
} }
.ck.ck-editor__editable h1 { font-size: 1.75em; } .ck.ck-editor__editable h1 {
.ck.ck-editor__editable h2 { font-size: 1.5em; } font-size: 1.75em;
.ck.ck-editor__editable h3 { font-size: 1.25em; } }
.ck.ck-editor__editable h4 { font-size: 1.1em; } .ck.ck-editor__editable h2 {
.ck.ck-editor__editable h5 { font-size: 1em; } font-size: 1.5em;
.ck.ck-editor__editable h6 { font-size: 0.9em; } }
.ck.ck-editor__editable h3 {
font-size: 1.25em;
}
.ck.ck-editor__editable h4 {
font-size: 1.1em;
}
.ck.ck-editor__editable h5 {
font-size: 1em;
}
.ck.ck-editor__editable h6 {
font-size: 0.9em;
}
/* Lists */ /* Lists */
.ck.ck-editor__editable ul, .ck.ck-editor__editable ul,
@ -130,7 +142,7 @@
padding: 1em; padding: 1em;
margin: 1em 0; margin: 1em 0;
overflow-x: auto; overflow-x: auto;
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace; font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
font-size: 13px; font-size: 13px;
line-height: 1.4; line-height: 1.4;
} }
@ -139,7 +151,7 @@
background-color: #f1f5f9; background-color: #f1f5f9;
padding: 0.2em 0.4em; padding: 0.2em 0.4em;
border-radius: 3px; border-radius: 3px;
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace; font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
font-size: 0.9em; font-size: 0.9em;
} }
@ -171,11 +183,11 @@
padding: 1em 1.5em !important; padding: 1em 1.5em !important;
font-size: 16px; /* Better for mobile */ font-size: 16px; /* Better for mobile */
} }
.ck.ck-toolbar { .ck.ck-toolbar {
padding: 6px; padding: 6px;
} }
.ck.ck-toolbar .ck-toolbar__items { .ck.ck-toolbar .ck-toolbar__items {
gap: 2px; gap: 2px;
} }
@ -188,7 +200,7 @@
color: #f9fafb; color: #f9fafb;
border-color: #4b5563; border-color: #4b5563;
} }
.ck.ck-editor__editable h1, .ck.ck-editor__editable h1,
.ck.ck-editor__editable h2, .ck.ck-editor__editable h2,
.ck.ck-editor__editable h3, .ck.ck-editor__editable h3,
@ -197,18 +209,18 @@
.ck.ck-editor__editable h6 { .ck.ck-editor__editable h6 {
color: #f9fafb; color: #f9fafb;
} }
.ck.ck-editor__editable blockquote { .ck.ck-editor__editable blockquote {
background-color: #374151; background-color: #374151;
border-left-color: #1a9aef; border-left-color: #1a9aef;
color: #d1d5db; color: #d1d5db;
} }
.ck.ck-editor__editable pre { .ck.ck-editor__editable pre {
background-color: #374151; background-color: #374151;
border-color: #4b5563; border-color: #4b5563;
} }
.ck.ck-editor__editable code { .ck.ck-editor__editable code {
background-color: #4b5563; background-color: #4b5563;
} }

View File

@ -28,9 +28,9 @@
display: none; display: none;
} }
.ck-editor__editable_inline { /* .ck-editor__editable_inline {
min-height: 200px; min-height: 200px;
} } */
.sidebar-scrollbar { .sidebar-scrollbar {
--scroll-shadow-size: 40px; --scroll-shadow-size: 40px;
@ -86,10 +86,10 @@
} }
} }
.ck-editor__editable_inline:not(.ck-comment__input *) { /* .ck-editor__editable_inline:not(.ck-comment__input *) {
height: 300px; height: 300px;
overflow-y: auto; overflow-y: auto;
} } */
body { body {
height: 100%; height: 100%;