From 4396e1cefc78d02bb3c7841d6721d5d3c97bebee Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Sat, 15 Nov 2025 20:07:07 +0000 Subject: [PATCH] completionId: cgen-cf56c14213bd41b0990657f4fdf24b84 cgen-cf56c14213bd41b0990657f4fdf24b84 --- client/pages/admin/AdminBlogManager.tsx | 194 ------------------------ 1 file changed, 194 deletions(-) delete mode 100644 client/pages/admin/AdminBlogManager.tsx diff --git a/client/pages/admin/AdminBlogManager.tsx b/client/pages/admin/AdminBlogManager.tsx deleted file mode 100644 index 097d1ab8..00000000 --- a/client/pages/admin/AdminBlogManager.tsx +++ /dev/null @@ -1,194 +0,0 @@ -import { useState, useEffect } from "react"; -import { useNavigate } from "react-router-dom"; -import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; -import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; -import { Button } from "@/components/ui/button"; -import AdminBlogEditor from "@/components/admin/AdminBlogEditor"; -import { useAuth } from "@/contexts/AuthContext"; -import { useAethexToast } from "@/hooks/use-aethex-toast"; -import { Plus, List, FileText } from "lucide-react"; - -interface BlogPost { - id: string; - title: string; - slug: string; - excerpt?: string; - published_at: string; - author?: string; - source: "ghost" | "supabase"; -} - -const AdminBlogManager = () => { - const { user, userRole } = useAuth(); - const navigate = useNavigate(); - const toast = useAethexToast(); - const [posts, setPosts] = useState([]); - const [isLoading, setIsLoading] = useState(true); - const [activeTab, setActiveTab] = useState("editor"); - - // Check authorization - useEffect(() => { - if (!user) { - navigate("/login"); - return; - } - - if (userRole !== "admin" && userRole !== "staff") { - toast.error("Access denied: Admin/Staff only"); - navigate("/dashboard"); - } - - setIsLoading(false); - }, [user, userRole, navigate, toast]); - - // Fetch posts - useEffect(() => { - const fetchPosts = async () => { - try { - const response = await fetch("/api/blog?limit=100"); - if (response.ok) { - const data = await response.json(); - setPosts(data || []); - } - } catch (error) { - console.error("Failed to fetch posts:", error); - } - }; - - fetchPosts(); - }, []); - - const handlePublishSuccess = () => { - setActiveTab("posts"); - // Refresh posts list - setTimeout(() => { - fetch("/api/blog?limit=100") - .then((r) => r.json()) - .then((data) => setPosts(data || [])) - .catch(console.error); - }, 1000); - }; - - if (isLoading) { - return
Loading...
; - } - - if (!user || (userRole !== "admin" && userRole !== "staff")) { - return null; - } - - return ( -
- {/* Header */} -
-

Blog Management

-

- Create and publish posts directly to Ghost.org -

-
- - {/* Tabs */} - - - - - New Post - - - - All Posts ({posts.length}) - - - - {/* New Post Editor Tab */} - - - - - {/* Posts List Tab */} - - {posts.length === 0 ? ( - - - -

No posts yet

-
-
- ) : ( -
- {posts.map((post) => ( - - -
-
- {post.title} - {post.excerpt && ( - - {post.excerpt} - - )} -
-
- {post.source && ( - - {post.source === "ghost" ? "Ghost" : "Local"} - - )} -
-
-
- {post.author && {post.author}} - {post.published_at && ( - - {new Date(post.published_at).toLocaleDateString()} - - )} -
-
- - - -
- ))} -
- )} -
-
- - {/* Info Box */} - - - About Blog Publishing - - -

- ✓ Posts are published directly to Ghost.org and appear immediately on the blog -

-

- ✓ All posts are authored by "AeThex Team" in Ghost (respects Ghost guidelines) -

-

- ✓ Use HTML or paste from your preferred editor (Word, Google Docs, Medium, etc) -

-

- ✓ Featured image and SEO metadata are optional but recommended -

-

- ✓ Posts appear at /blog and in the blog listing page -

-
-
-
- ); -}; - -export default AdminBlogManager;