Files
marmarislocal/app/[locale]/admin/collections/[id]/page.tsx
T

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 { id } = await params
let collection = null
if (id !== 'new') {
collection = await mockDb.getCollectionById(id)
if (!collection) {
notFound()
}
}
// Fetch listings for option list
const listings = await mockDb.getListings()
const listingOptions = listings.map(l => ({
value: l.id,
label: `${l.nameTr} (${l.neighborhood?.nameTr})`
}))
return (
<div className="space-y-6 max-w-5xl">
<div>
<h2 className="text-3xl font-heading font-extrabold text-pine lowercase">
{id === 'new' ? 'yeni seçki (koleksiyon)' : 'seçkiyi düzenle'}
</h2>
<p className="text-ink/65 text-xs font-medium mt-1">
{id === 'new'
? 'Yeni bir tematik mekan derlemesi oluşturun.'
: 'Mevcut kürasyon seki 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}
listingOptions={listingOptions}
/>
</div>
</div>
)
}