40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
import { mockDb } from '@/lib/mockDb'
|
||
import BlogPostForm from './BlogPostForm'
|
||
import { notFound } from 'next/navigation'
|
||
|
||
interface Props {
|
||
params: Promise<{ locale: string; id: string }>
|
||
}
|
||
|
||
export default async function AdminBlogPostEditPage({ params }: Props) {
|
||
const { locale, id } = await params
|
||
|
||
let post = null
|
||
|
||
if (id !== 'new') {
|
||
post = await mockDb.getBlogPostById(id)
|
||
if (!post) {
|
||
notFound()
|
||
}
|
||
}
|
||
|
||
return (
|
||
<div className="space-y-6 max-w-4xl">
|
||
<div>
|
||
<h2 className="text-3xl font-heading font-extrabold text-pine lowercase">
|
||
{id === 'new' ? 'yeni yazı ekle' : 'yazıyı düzenle'}
|
||
</h2>
|
||
<p className="text-ink/65 text-xs font-medium mt-1">
|
||
{id === 'new'
|
||
? 'Yeni bir blog yazısı oluşturun.'
|
||
: 'Mevcut blog yazısı bilgilerini güncelleyin.'}
|
||
</p>
|
||
</div>
|
||
|
||
<div className="bg-paper border border-pine/8 rounded-3xl shadow-sm p-6 sm:p-8">
|
||
<BlogPostForm post={post} />
|
||
</div>
|
||
</div>
|
||
)
|
||
}
|