first commit
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
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>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user