"use client"; import { useState, useMemo, useEffect } from "react"; import { useSearchParams } from "next/navigation"; import Link from "next/link"; import Image from "next/image"; import { ArrowRight, Search, ChevronRight, Clock, BookOpen, MessageCircle, Tag, SlidersHorizontal, } from "lucide-react"; import Breadcrumbs from "@/components/ui/breadcrumbs"; import { getWhatsAppUrl } from "@/lib/whatsapp"; import { WhatsAppIcon } from "@/components/ui/whatsapp-icon"; import { POSTS_QUERY_RESULT } from "@/sanity.types"; export interface BlogIndexViewProps { posts?: POSTS_QUERY_RESULT; } interface GuideItem { title: string; slug: string; excerpt: string; tag: string; readTime: string; publishedAt?: string; image?: any; featured?: boolean; } const fallbackGuides: GuideItem[] = [ { title: "Vietnam Luxury Wedding Cost: A Complete Budget Guide (2025)", slug: "vietnam-wedding-guide-part-1", excerpt: "A comprehensive, transparent breakdown of real venue fees, F&B minimums, decoration production, and logistics across Vietnam's 5-star destination resorts.", tag: "Budget Guides", readTime: "12 min read", publishedAt: "Oct 2025", featured: true, }, { title: "Ngân Sách Tiệc Cưới Cao Cấp Tại Việt Nam: Các Khoản Chi Phí Ẩn", slug: "ngan-sach-tiec-cuoi-cao-cap-viet-nam-phan-2", excerpt: "Vạch trần các khoản phí tiềm ẩn: phí phục vụ bên ngoài, phí máy phát điện, phụ thu overtime đêm muộn và thuế quan nhập khẩu trang thiết bị.", tag: "Budget Guides", readTime: "9 min read", publishedAt: "Oct 2025", }, { title: "Why Vietnam is the Premier Destination for Your Wedding?", slug: "why-vietnam", excerpt: "From pristine beachfronts in Da Nang and Phu Quoc to historic colonial charm in Da Lat and Hoi An, discover why Vietnam outshines traditional regional wedding hubs.", tag: "Destination Guides", readTime: "8 min read", publishedAt: "Sep 2025", }, { title: "The Compass Framework: A Project Management Approach to Your Wedding", slug: "wedding-framework-project-managment", excerpt: "How to treat your cross-border wedding like a luxury production. Essential milestone calendars, vendor screening checklists, and contingency buffers.", tag: "Planning Guides", readTime: "10 min read", publishedAt: "Sep 2025", }, { title: "Chọn Lựa Wedding Planner: Chỉ Có Phù Hợp, Không Có Tốt Nhất", slug: "chn-la-wedding-planner-ch-c-ph-hp-khng-c-tt-nht", excerpt: "Tiêu chuẩn đánh giá năng lực thực tế của planner: phân biệt giữa đơn vị chuyên trang trí và đơn vị có tư duy quản trị sự kiện quốc tế.", tag: "Planning Guides", readTime: "7 min read", publishedAt: "Oct 2025", }, { title: "Top Questions for Planning a Premium Wedding in Vietnam, Answered by an Insider", slug: "wedding-in-vietnam-questions", excerpt: "Clear answers to seasonal weather risks, optimal guest accommodation ratios, booking timelines, and contract deposit schedules.", tag: "Planning Guides", readTime: "6 min read", publishedAt: "Sep 2025", }, { title: "Tại Sao Chọn Việt Nam Làm Điểm Đến Cho Tiệc Cưới Của Bạn?", slug: "tai-sao-chon-viet-nam", excerpt: "Khám phá bức tranh tổng thể về dịch vụ hiếu khách 5 sao, cảnh quan ngoạn mục từ biển đảo đến đồi thông, và tối ưu ngân sách cho cặp đôi quốc tế.", tag: "Destination Guides", readTime: "11 min read", publishedAt: "Oct 2025", }, { title: "Case Study: Tổ Chức Siêu Tiệc Cưới Ấn Độ Đa Ngày Tại Phú Quốc & Đà Nẵng", slug: "case-study--siu-tic-ci-n", excerpt: "Phân tích chuyên sâu các thách thức vận hành: ẩm thực chay chuyên biệt, nghi thức tôn giáo phức tạp, và điều phối hậu cần cho 500+ khách bay quốc tế.", tag: "Venue Guides", readTime: "9 min read", publishedAt: "Oct 2025", }, ]; const categories = [ "All Guides", "Venue Guides", "Budget Guides", "Destination Guides", "Planning Guides", ]; export default function BlogIndexView({ posts = [] }: BlogIndexViewProps) { const searchParams = useSearchParams(); const tagParam = searchParams.get("tag"); const [activeCategory, setActiveCategory] = useState("All Guides"); const [searchQuery, setSearchQuery] = useState(""); // Sync category with URL tag parameter when navigated from footer or direct link useEffect(() => { if (!tagParam) return; const lower = tagParam.toLowerCase(); if (lower === "venue" || lower === "venues") { setActiveCategory("Venue Guides"); } else if (lower === "budget" || lower === "budgets" || lower === "cost") { setActiveCategory("Budget Guides"); } else if (lower === "destination" || lower === "destinations") { setActiveCategory("Destination Guides"); } else if (lower === "planning" || lower === "framework") { setActiveCategory("Planning Guides"); } else { const match = categories.find((c) => c.toLowerCase().includes(lower)); if (match) setActiveCategory(match); } }, [tagParam]); // Map Sanity posts to guide item format if present const allGuides = useMemo(() => { if (posts && posts.length > 0) { const sanityList: GuideItem[] = posts.map((post, idx) => { const isFeatured = post.featured === true || post.slug?.current === "vietnam-wedding-guide-part-1"; const slug = post.slug?.current ?? ""; let tag = post.categories?.[0]?.title || "Destination Guides"; if (!post.categories?.[0]?.title) { if (slug.includes("part") || slug.includes("ngan-sach") || slug.includes("budget")) { tag = "Budget Guides"; } else if ( slug.includes("framework") || slug.includes("questions") || slug.includes("planner") || slug.includes("regret") || slug.includes("plan") ) { tag = "Planning Guides"; } else if (slug.includes("case-study") || slug.includes("venue")) { tag = "Venue Guides"; } } return { title: post.title ?? "Untitled Guide", slug: post.slug?.current ?? `guide-${idx}`, excerpt: post.excerpt ?? "", tag, readTime: "10 min read", publishedAt: post.publishedAt ? new Date(post.publishedAt).toLocaleDateString("en-US", { month: "short", year: "numeric", }) : undefined, image: post.image, featured: isFeatured, }; }); return sanityList; } return fallbackGuides; }, [posts]); // Filtered guides based on category and search query const filteredGuides = useMemo(() => { return allGuides.filter((guide) => { const matchesCategory = activeCategory === "All Guides" || guide.tag === activeCategory; const matchesSearch = searchQuery.trim() === "" || guide.title.toLowerCase().includes(searchQuery.toLowerCase()) || guide.excerpt.toLowerCase().includes(searchQuery.toLowerCase()) || guide.tag.toLowerCase().includes(searchQuery.toLowerCase()); return matchesCategory && matchesSearch; }); }, [allGuides, activeCategory, searchQuery]); // Featured Guide (first one that has featured=true, or first in list) const featuredGuide = useMemo(() => { if (activeCategory === "All Guides" && searchQuery.trim() === "") { return allGuides.find((g) => g.featured) || allGuides[0]; } return null; }, [allGuides, activeCategory, searchQuery]); // Non-featured guides list const listGuides = useMemo(() => { if (featuredGuide) { return filteredGuides.filter((g) => g.slug !== featuredGuide.slug); } return filteredGuides; }, [filteredGuides, featuredGuide]); const breadcrumbLinks = [ { label: "Home", href: "/" }, { label: "Wedding Guides", href: "#" }, ]; return (
The independent publication for couples and luxury planners. Unbiased analysis on 5-star destination resorts, transparent cost realities, and luxury event production.
{/* Search Input Bar */}{featuredGuide.excerpt}
{guide.excerpt}
No editorial guides matched your filter or search query “{searchQuery}”.
Our guides provide foundational clarity, but every wedding has unique contract nuances. Connect with our senior destination consultant via WhatsApp for a neutral second opinion.