import { redirect } from "next/navigation";
import { getSession } from "@/lib/auth";
import { PostForm } from "../PostForm";

export default async function NewPostPage() {
  const session = await getSession();
  if (!session.isLoggedIn) redirect("/admin/login");

  return (
    <div>
      <div className="mb-6">
        <a href="/admin/posts" className="text-sm text-text-secondary hover:text-accent">← برگشت به نوشته‌ها</a>
        <h1 className="mt-2 text-2xl font-bold text-text-primary">نوشته جدید</h1>
      </div>
      <PostForm />
    </div>
  );
}
