import Link from "next/link"; import type { BlogPost } from "@/types/blog"; import { editorjsToHtml, getCmsImageUrl } from "@/utils"; import { toSlug } from "@/utils/slugify"; import CommentsSection from "./CommentsSection"; interface NewsDetailsContentProps { post: BlogPost; } export default function NewsDetailsContent({ post }: NewsDetailsContentProps) { // Get comments from post (already included in API response) const postComments = post.comments || []; // Get base URL for EditorJS images const baseUrl = process.env.NEXT_PUBLIC_API_URL || "http://localhost:3001"; // Convert EditorJS content to HTML const renderContent = () => { const html = editorjsToHtml(post.content, baseUrl); return { __html: html }; }; // Convert EditorJS contentAfterQuote to HTML const renderContentAfterQuote = () => { const html = editorjsToHtml(post.contentAfterQuote, baseUrl); return { __html: html }; }; return (
{post.title}
  • By {post.author}
  • {post.publishedAt}
  • {postComments.length} Comments

{post.title}

{/* Gallery Images */} {post.galleryImages && post.galleryImages.length > 0 && (
{post.galleryImages.map((image, index) => (
{`${post.title}
))}
)} {/* Quote/Sidebar */} {post.quote && (
{post.quote}
)} {/* Content After Quote */} {post.contentAfterQuote && (
)} {/* Tags and Social Share */}
Tags: {post.tags.map((tagName) => { // Generate slug from tag name (Vietnamese-friendly) const tagSlug = toSlug(tagName); return ( {tagName} ); })}
); }