diff --git a/components/details/details-content.tsx b/components/details/details-content.tsx index 81cc136..7dcee88 100644 --- a/components/details/details-content.tsx +++ b/components/details/details-content.tsx @@ -56,6 +56,8 @@ export default function DetailContent() { null ); + const [selectedIndex, setSelectedIndex] = useState(0); + const [tabArticles, setTabArticles] = useState([]); const [activeTab, setActiveTab] = useState("trending"); @@ -193,6 +195,14 @@ export default function DetailContent() { close(); } + if (!articleDetail?.files || articleDetail.files.length === 0) { + return ( +
+

Gambar tidak tersedia

+
+ ); + } + return ( <>
@@ -243,19 +253,41 @@ export default function DetailContent() {
- {articleDetail?.files?.[0]?.fileUrl ? ( + {/* Gambar utama */} +
Berita - ) : ( -
-

Gambar tidak tersedia

-
- )} +
+ + {/* Thumbnail */} +
+ {articleDetail.files.map((file: any, index: number) => ( + + ))} +
+ + {/* Slug */}

{articleDetail?.slug}

@@ -327,13 +359,13 @@ export default function DetailContent() {
-

+

-

+
diff --git a/components/table/article-table.tsx b/components/table/article-table.tsx index d76b2a8..227f9ae 100644 --- a/components/table/article-table.tsx +++ b/components/table/article-table.tsx @@ -173,11 +173,11 @@ export default function ArticleTable() { initState(); }; - const copyUrlArticle = async (id: number, slug: string) => { + const copyUrlArticle = async (id: number) => { const url = `${window.location.protocol}//${window.location.host}` + - "/news/detail/" + - `${id}-${slug}`; + "/detail/" + + `${id}`; try { await navigator.clipboard.writeText(url); successToast("Success", "Article Copy to Clipboard"); @@ -228,9 +228,7 @@ export default function ArticleTable() { - copyUrlArticle(article.id, article.slug)} - > + copyUrlArticle(article.id)}> Copy Url Article