import React from "react"; import BlogPostCard from "@/components/BlogPostCard"; import { prisma } from "@/lib/prisma"; // Import Prisma client import { auth } from "@/auth"; // Import auth to check session import Button from "@/components/ui/Button"; // Import Button component import type { Metadata } from "next"; interface Post { id: string; slug: string; title: string; content: string; excerpt?: string | null; imageUrl?: string | null; published: boolean; authorId: string; createdAt: Date; updatedAt: Date; tags?: string[]; } // --- Fetch Posts --- async function getPublishedPosts() { try { const posts = await prisma.post.findMany({ where: { published: true }, orderBy: { createdAt: "desc" }, // select needed fields if not all }); return posts; } catch (error) { console.error("Failed to fetch posts:", error); return []; // Return empty array on error } } // --- SEO Metadata --- export const metadata: Metadata = { title: "OMS TechTalk | Insights & Innovation", description: "Explore the latest insights, trends, and discussions on technology, innovation, and digital transformation from the experts at Owethu Managed Services (OMS).", alternates: { canonical: "/tech-talk", }, openGraph: { title: "OMS TechTalk | Insights & Innovation", description: "Stay updated with tech insights from OMS.", url: "https://oms.africa/tech-talk", images: [ { url: "/og-image-techtalk.jpg", width: 1200, height: 630, alt: "OMS TechTalk Banner", }, ], }, twitter: { card: "summary_large_image", title: "OMS TechTalk | Insights & Innovation", description: "Tech insights and articles from Owethu Managed Services.", images: ["/og-image-techtalk.jpg"], }, }; // --- Page Component --- const TechTalkPage = async () => { const posts = await getPublishedPosts(); const session = await auth(); // Get session info return (
Insights, trends, and discussions on the latest in technology, innovation, and digital transformation from the experts at OMS.
{/* Conditionally render Create Post button */} {session?.user && (No posts published yet. Check back soon!
)} {/* TODO: Add Pagination component here if needed */}