'use client' import { useState, useEffect, Suspense } from 'react' import { useSearchParams } from 'next/navigation' import ModalVideo from 'react-modal-video' import "@/node_modules/react-modal-video/css/modal-video.css" import Countdown from '@/components/elements/Countdown' import Layout from "@/components/layout/Layout" import Link from "next/link" import axios from 'axios' interface BlogItem { id: number; title: string; slug: string; image: string; description: string; author: string; profile: string; date: string; } function BlogSingleContent() { const [isOpen, setOpen] = useState(false) const searchParams = useSearchParams(); const currentSlug = searchParams ? searchParams.get('slug') : null; const [blog, setBlog] = useState(null); const [recentBlogs, setRecentBlogs] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { const fetchBlogDetails = async () => { try { setLoading(true); const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL || 'http://localhost:3006/api'; // Fetch other blogs for "Read More" section and fallback const listRes = await axios.get(`${API_BASE_URL}/blogs`); const allBlogs = listRes.data?.success ? listRes.data.data : []; setRecentBlogs(allBlogs); if (currentSlug) { // Fetch current blog details by slug const detailRes = await axios.get(`${API_BASE_URL}/blogs/slug/${currentSlug}`); if (detailRes.data && detailRes.data.success) { setBlog(detailRes.data.data); } } else { // No slug provided, load the most recent blog if (allBlogs.length > 0) { setBlog(allBlogs[0]); } } } catch (error) { console.error("Error fetching blog details:", error); } finally { setLoading(false); } }; fetchBlogDetails(); }, [currentSlug]); if (loading) { return (
Loading...
); } if (!blog) { return (

Blog post not found

Back to Blogs
); } return ( <>

Blog Details

Home Blog Details
{/*===== HERO AREA ENDS =======*/} {/*===== BLOG AREA STARTS =======*/}
{blog.title}
  • {blog.date} |
  • {blog.author} |
  • Comments Disabled

{blog.title}

{/* Render rich text from Quill editor safely */}

Tags:

  • #TamilCulture
  • #Community

Social:

Search

e.preventDefault()}>

Blog Category

  • Business Innovation
  • Leadership & Strategy
  • Networking & Collaboration
  • Entrepreneurship Startups
  • Marketing & Branding
  • Event Highlights & Recaps

Popular Hashtag

  • #Conferences
  • #Meetup
  • #Event
  • #Eventify2024
  • #DigitalTransformation
  • #BusinessLeadership
  • #IndustryTrends

Popular Author

{/*===== BLOG AREA ENDS =======*/} {/*===== BLOG AREA STARTS =======*/}

Read More Blogs

{recentBlogs .filter(post => post.slug !== currentSlug) .slice(0, 3) .map((post) => (
{post.title}
  • {post.date} |
  • {post.author}
{post.title.length > 40 ? `${post.title.slice(0, 40)}...` : post.title}
read more
)) }
{/*===== BLOG AREA ENDS =======*/} {/*===== CTA AREA STARTS =======*/}
Buy Ticket
  • 30 January 2025 - 6pm to 11:30pm
  • Secret Location In The UK
{/*===== CTA AREA ENDS =======*/} {/*===== CTA AREA STARTS =======*/}
Buy Ticket
  • 30 January 2025 - 6pm to 11:30pm
  • Secret Location In The UK
setOpen(false)} /> ) } export default function BlogSingle() { return ( Loading...
}> ) }