import { getTranslations, setRequestLocale } from 'next-intl/server' import { mockDb } from '@/lib/mockDb' import ListingCard from '@/components/ListingCard' import { Link } from '@/i18n/routing' import { notFound } from 'next/navigation' import { MapPin, SlidersHorizontal, Check } from 'lucide-react' import LiveFilterForm from '@/components/LiveFilterForm' interface PageProps { params: Promise<{ locale: string, category: string }> searchParams: Promise<{ search?: string neighborhood?: string price?: string approved?: string }> } export const dynamic = 'force-dynamic' export default async function DynamicCategoryPage({ params, searchParams }: PageProps) { const { locale, category: categorySlug } = await params setRequestLocale(locale) const { search, neighborhood, price, approved } = await searchParams const t = await getTranslations('categories') const navT = await getTranslations('nav') // Find Category Restoran const categories = await mockDb.getCategories() const currentCategory = categories.find(c => c.slug === categorySlug) if (!currentCategory) notFound() const categoryId = currentCategory?.id // Get active neighborhoods for filter const neighborhoods = await mockDb.getNeighborhoods() // Selected filters const selectedNeighborhoodId = neighborhood || undefined const selectedPriceRange = price ? parseInt(price) : undefined const isApprovedOnly = approved === 'true' const listings = await mockDb.getListings({ categoryId, neighborhoodId: selectedNeighborhoodId, priceRange: selectedPriceRange, isLocalApproved: isApprovedOnly ? true : undefined, search: search }) const getLocalizedName = (obj: any) => { if (!obj) return '' return locale === 'ru' ? obj.nameRu : locale === 'en' ? obj.nameEn : obj.nameTr } return (
{/* Header */}

{getLocalizedName(currentCategory)}

marmaris local • {listings.length} {locale === 'tr' ? 'sonuç' : locale === 'en' ? 'results' : 'результатов'}

{/* Filters Panel */}
filtreler
{/* Search Input */}
{/* Neighborhood select */}
{/* Price range select */}
{/* Submit / Checkbox area */}
{/* Results */} {listings.length === 0 ? (

{t('noResults')}

) : (
{listings.map((listing) => ( ))}
)}
) }