create post completed

This commit is contained in:
libertyoms
2025-04-21 20:59:37 +02:00
parent 629da1b7e7
commit a8c6b5297b
21 changed files with 1973 additions and 37 deletions

View File

@ -0,0 +1,40 @@
import React from "react";
import { auth } from "@/auth";
import { redirect } from "next/navigation";
import CreatePostForm from "@/components/CreatePostForm";
import type { Metadata } from "next";
// Metadata for the page, preventing search engine indexing
export const metadata: Metadata = {
title: "Create New TechTalk Post | OMS",
description: "Create a new blog post for OMS TechTalk.",
robots: { index: false, follow: false }, // Don't index the creation page
};
// Page component to render the creation form
export default async function CreateTechTalkPage() {
const session = await auth();
// Protect the route: Redirect if not logged in
if (!session?.user) {
// Redirect to sign-in page, passing the current page as callbackUrl
// This ensures the user returns here after successful login
const callbackUrl = encodeURIComponent("/tech-talk/create");
redirect(`/api/auth/signin?callbackUrl=${callbackUrl}`);
}
// Render the page content if the user is authenticated
return (
<div className="bg-background text-foreground">
<div className="container mx-auto px-4 py-16 sm:py-20 lg:py-24">
<div className="max-w-3xl mx-auto bg-card p-6 sm:p-8 rounded-lg border border-border shadow-md">
<h1 className="text-3xl md:text-4xl font-bold mb-8 text-center text-primary">
Create New TechTalk Post
</h1>
{/* Render the form component */}
<CreatePostForm />
</div>
</div>
</div>
);
}