'use client'; import { Building2 } from 'lucide-react'; import * as React from 'react'; import { ProjectCard } from '@/components/du-an/project-card'; import { ProjectFilterBar } from '@/components/du-an/project-filter-bar'; import { Button } from '@/components/ui/button'; import type { SearchProjectsParams } from '@/lib/du-an-api'; import { useProjectsSearch } from '@/lib/hooks/use-du-an'; const PAGE_SIZE = 12; export default function DuAnPage() { const [filters, setFilters] = React.useState({ page: 1, limit: PAGE_SIZE, }); const { data, isLoading, isError } = useProjectsSearch(filters); const handleFilterChange = (newFilters: SearchProjectsParams) => { setFilters({ ...newFilters, limit: PAGE_SIZE }); window.scrollTo({ top: 0, behavior: 'smooth' }); }; const handlePageChange = (page: number) => { setFilters((prev) => ({ ...prev, page })); window.scrollTo({ top: 0, behavior: 'smooth' }); }; return (
{/* Page header */}

Dự án bất động sản

Khám phá các dự án mới nhất từ các chủ đầu tư uy tín

{/* Filters */} {/* Results */}
{isLoading ? (
{Array.from({ length: 6 }).map((_, i) => (
))}
) : isError ? (

Không thể tải danh sách dự án. Vui lòng thử lại.

) : data && data.data.length > 0 ? ( <>

{data.total} dự án được tìm thấy

{data.data.map((project) => ( ))}
{/* Pagination */} {data.totalPages > 1 && (
Trang {data.page} / {data.totalPages}
)} ) : (

Không tìm thấy dự án

Thử thay đổi bộ lọc để tìm kiếm nhiều hơn

)}
); }