49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
import { mockDb } from '@/lib/mockDb'
|
|
import CollectionForm from './CollectionForm'
|
|
import { notFound } from 'next/navigation'
|
|
|
|
interface Props {
|
|
params: Promise<{ locale: string; id: string }>
|
|
}
|
|
|
|
export default async function AdminCollectionEditPage({ params }: Props) {
|
|
const { locale, id } = await params
|
|
|
|
let collection = null
|
|
|
|
if (id !== 'new') {
|
|
collection = await mockDb.getCollectionById(id)
|
|
if (!collection) {
|
|
notFound()
|
|
}
|
|
}
|
|
|
|
const allListings = await mockDb.getListings()
|
|
const listingOptions = allListings.map(l => ({
|
|
value: l.id,
|
|
label: l.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 seçki ekle' : 'seçkiyi düzenle'}
|
|
</h2>
|
|
<p className="text-ink/65 text-xs font-medium mt-1">
|
|
{id === 'new'
|
|
? 'Yeni bir mekan kürasyonu oluşturun.'
|
|
: 'Mevcut kürasyon bilgilerini güncelleyin.'}
|
|
</p>
|
|
</div>
|
|
|
|
<div className="bg-paper border border-pine/8 rounded-3xl shadow-sm p-6 sm:p-8">
|
|
<CollectionForm
|
|
collection={collection}
|
|
allListings={listingOptions}
|
|
/>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|