// app/find-trucks/page.jsx import ListingCard from "@/components/listing/ListingCard"; import { searchListing } from "@/service/ListingService"; import SearchBar from "@/components/listing/SearchBar"; import Filters from "@/components/listing/Filters"; import Pagination from "../common/pagination"; import FindTrucksClient from "./FindTruckClient"; export default async function FindTrucksPage({ searchParams }) { const { page = "0", size = "9", type = "", condition = "", titleKeyword, city, state, country, minPrice, maxPrice, year, categoryId, makerId, modelId, trimId, truckClassId, fuelTypeId, transmission, transmissionSpeed, engineManufacturer, driverSide, mileageRange, trailerComposition, trailerFloorType, trailerHitch, trailerNumberOfAxles, trailerMinLength, trailerMaxLength, trailerMinWidth, trailerMaxWidth, trailerMinHeight, trailerMaxHeight, // lat, // lng, } = await searchParams || {}; // fallback for undefined const searchRequest = { page: parseInt(page), size: parseInt(size), type: type || undefined, condition : condition || undefined, titleKeyword, city, state, country, minPrice: minPrice ? parseFloat(minPrice) : undefined, maxPrice: maxPrice ? parseFloat(maxPrice) : undefined, year, categoryId, makerId, modelId, trimId, truckClassId, fuelTypeId, transmission, transmissionSpeed, engineManufacturer, driverSide, mileageRange, trailerComposition, trailerFloorType, trailerHitch, trailerNumberOfAxles, trailerMinLength, trailerMaxLength, trailerMinWidth, trailerMaxWidth, trailerMinHeight, trailerMaxHeight, // lat, // lng, }; let listings = []; let currentPage = 0; let totalPages = 0; // try { const response = await searchListing(searchRequest); listings = response.content || []; currentPage = response.currentPage; totalPages = response.totalPages; // } catch (error) { // console.error("Error fetching listings:", error.message); // } return ( //
// {/* Header with shared background */} //
//
//
//

Find Trucks & Trailers

//

Your next heavy-duty partner is just a search away.

//
// //
//
// {/* Main layout with sidebar and content */} //
// {/* Sidebar Filters with unified background */} // // {/* Main listing grid and pagination */} //
//
// {listings.length === 0 ? ( //
// No listings found. Try adjusting your filters. //
// ) : ( // listings.map((listing) => ( // // )) // )} //
// {totalPages > 1 && ( // // )} //
//
//
); }