'use client'; import Link from 'next/link'; import { useRouter } from 'next/navigation'; import * as React from 'react'; import { PropertyCard } from '@/components/search/property-card'; import { Badge } from '@/components/ui/badge'; import { Button } from '@/components/ui/button'; import { Card, CardContent } from '@/components/ui/card'; import { Input } from '@/components/ui/input'; import { Select } from '@/components/ui/select'; import { listingsApi, type ListingDetail } from '@/lib/listings-api'; import { PROPERTY_TYPES, TRANSACTION_TYPES } from '@/lib/validations/listings'; const DISTRICTS = [ { name: 'Quận 1', city: 'Hồ Chí Minh', img: null }, { name: 'Quận 2', city: 'Hồ Chí Minh', img: null }, { name: 'Quận 7', city: 'Hồ Chí Minh', img: null }, { name: 'Bình Thạnh', city: 'Hồ Chí Minh', img: null }, { name: 'Thủ Đức', city: 'Hồ Chí Minh', img: null }, { name: 'Ba Đình', city: 'Hà Nội', img: null }, { name: 'Hoàn Kiếm', city: 'Hà Nội', img: null }, { name: 'Hải Châu', city: 'Đà Nẵng', img: null }, ]; const STATS = [ { label: 'Tin đăng', value: '10,000+', icon: '🏠' }, { label: 'Người dùng', value: '50,000+', icon: '👥' }, { label: 'Giao dịch thành công', value: '2,000+', icon: '✅' }, { label: 'Tỉnh thành', value: '63', icon: '📍' }, ]; export default function LandingPage() { const router = useRouter(); const [searchQuery, setSearchQuery] = React.useState(''); const [transactionType, setTransactionType] = React.useState(''); const [propertyType, _setPropertyType] = React.useState(''); const [featuredListings, setFeaturedListings] = React.useState([]); const [loadingFeatured, setLoadingFeatured] = React.useState(true); const [featuredError, setFeaturedError] = React.useState(false); const fetchFeatured = React.useCallback(() => { setLoadingFeatured(true); setFeaturedError(false); listingsApi .search({ status: 'ACTIVE', limit: 6 }) .then((res) => setFeaturedListings(res.data)) .catch(() => setFeaturedError(true)) .finally(() => setLoadingFeatured(false)); }, []); React.useEffect(() => { fetchFeatured(); }, [fetchFeatured]); const handleSearch = (e: React.FormEvent) => { e.preventDefault(); const params = new URLSearchParams(); if (searchQuery) params.set('q', searchQuery); if (transactionType) params.set('transactionType', transactionType); if (propertyType) params.set('propertyType', propertyType); router.push(`/search?${params.toString()}`); }; return (
{/* Hero Section */}

Tìm kiếm bất động sản hoàn hảo

Nền tảng bất động sản thông minh tại Việt Nam — mua bán, cho thuê nhà đất dễ dàng

{/* Search Bar */}
setSearchQuery(e.target.value)} className="border-0 shadow-none focus-visible:ring-0" />
{/* Quick property type links */}
{PROPERTY_TYPES.map((pt) => ( {pt.label} ))}
{/* Featured Listings */}

Tin đăng nổi bật

Khám phá các bất động sản được quan tâm nhất

{loadingFeatured ? (
) : featuredError ? (

Không thể tải tin đăng. Vui lòng thử lại.

) : featuredListings.length > 0 ? (
{featuredListings.map((listing) => ( ))}
) : (

Chưa có tin đăng nổi bật

)}
{/* Districts / Quick Links */}

Khu vực nổi bật

Tìm kiếm theo quận huyện phổ biến

{DISTRICTS.map((district) => (
🏙️

{district.name}

{district.city}

))}
{/* Market Stats */}

GoodGo trong số liệu

Nền tảng bất động sản đáng tin cậy tại Việt Nam

{STATS.map((stat) => (
{stat.icon}

{stat.value}

{stat.label}

))}
{/* CTA Section */}

Bạn có bất động sản muốn đăng?

Đăng tin miễn phí ngay hôm nay, tiếp cận hàng ngàn người mua tiềm năng

); }