Files
marmarislocal/app/[locale]/admin/listings/[id]/page.tsx
T
2026-07-12 20:18:55 +03:00

57 lines
1.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { mockDb } from '@/lib/mockDb'
import ListingForm from './ListingForm'
import { notFound } from 'next/navigation'
interface Props {
params: Promise<{ locale: string; id: string }>
}
export default async function AdminListingEditPage({ params }: Props) {
const { locale, id } = await params
const categories = await mockDb.getCategories()
const neighborhoods = await mockDb.getNeighborhoods()
let listing = null
if (id !== 'new') {
listing = await mockDb.getListingById(id)
if (!listing) {
notFound()
}
}
const categoryOptions = categories.map(c => ({
value: c.id,
label: c.nameTr
}))
const neighborhoodOptions = neighborhoods.map(n => ({
value: n.id,
label: n.nameTr
}))
return (
<div className="space-y-6 max-w-4xl">
<div>
<h2 className="text-3xl font-heading font-extrabold text-pine lowercase">
{id === 'new' ? 'yeni mekan ekle' : 'mekanı düzenle'}
</h2>
<p className="text-ink/65 text-xs font-medium mt-1">
{id === 'new'
? 'Rehbere eklenecek yeni işletme bilgilerini girin.'
: 'Mevcut mekan bilgilerini güncelleyin.'}
</p>
</div>
<div className="bg-paper border border-pine/8 rounded-3xl shadow-sm p-6 sm:p-8">
<ListingForm
listing={listing}
categories={categoryOptions}
neighborhoods={neighborhoodOptions}
/>
</div>
</div>
)
}