diff --git a/app/details/[slug]/page.tsx b/app/details/[slug]/page.tsx new file mode 100644 index 0000000..6adfd1f --- /dev/null +++ b/app/details/[slug]/page.tsx @@ -0,0 +1,30 @@ +import DetailContent from "@/components/details/details-content"; +import Footer from "@/components/landing-page/footer"; +import Navbar from "@/components/landing-page/navbar"; +import Image from "next/image"; + +export default function Home() { + return ( +
+
+ Background +
+ +
+ +
+ +
+ +
+
+ ); +} diff --git a/components/details/details-content.tsx b/components/details/details-content.tsx index 1c6ee5d..ee34d50 100644 --- a/components/details/details-content.tsx +++ b/components/details/details-content.tsx @@ -20,6 +20,8 @@ import { postArticleComment, } from "@/service/master-user"; import { useForm } from "react-hook-form"; +import { Badge } from "../ui/badge"; +import { map } from "zod"; type TabKey = "trending" | "comments" | "latest"; @@ -299,7 +301,7 @@ export default function DetailContent() { async function initStateData() { loading(); - const res = await getArticleById(id); + const res = await getArticleBySlug(slug); const data = res?.data?.data; setThumbnail(data?.thumbnailUrl); @@ -570,9 +572,17 @@ export default function DetailContent() {
{articleDetail?.tags ? ( - - {articleDetail.tags} - + articleDetail.tags + .split(",") // pisahkan berdasarkan koma + .map((tag: string, index: number) => ( + + {tag.trim()} + + )) ) : ( Tidak ada tag )} diff --git a/components/landing-page/citizen-news/citizen-news.tsx b/components/landing-page/citizen-news/citizen-news.tsx index d2d03d8..ff9d296 100644 --- a/components/landing-page/citizen-news/citizen-news.tsx +++ b/components/landing-page/citizen-news/citizen-news.tsx @@ -13,6 +13,7 @@ type Article = { description: string; categoryName: string; createdAt: string; + slug: string; createdByName: string; customCreatorName: string; thumbnailUrl: string; @@ -150,7 +151,7 @@ export default function CitizenNews() {
{/* Image + Category */}
@@ -319,7 +320,7 @@ export default function CitizenNews() {
- +
{mainArticle && (
- + {mainArticle.title} {otherArticles.map((article, index) => (
- + {/* Image + Category */}
@@ -318,7 +319,7 @@ export default function DevelopmentNews() {
- +
{mainArticle && (
- + {mainArticle.title} {otherArticles.map((article, index) => (
- + {articles.length > 0 && (
- + {articles.slice(1, 5).map((article, index) => (
- + {mainArticle && (
- + {mainArticle.title} {otherArticles.map((article, index) => (
- +
- +
{currentArticles.map((article, index) => (
- +
- +
- + {"articles[0]?.title"}
- +
{popularPosts.slice(1, 5).map((post, index) => (
- +
(
- +
(
- +
{ + const copyUrlArticle = async (slug: any) => { const url = `${window.location.protocol}//${window.location.host}` + - "/detail/" + - `${id}`; + "/details/" + + `${slug}`; try { await navigator.clipboard.writeText(url); successToast("Success", "Article Copy to Clipboard"); @@ -263,7 +263,9 @@ export default function ArticleTable() { - copyUrlArticle(article.id)}> + copyUrlArticle(article.slug)} + > Copy Url Article