diff --git a/client/components/admin/AdminBlogManager.tsx b/client/components/admin/AdminBlogManager.tsx index 3fb7e860..c034551d 100644 --- a/client/components/admin/AdminBlogManager.tsx +++ b/client/components/admin/AdminBlogManager.tsx @@ -29,10 +29,17 @@ import { } from "@/components/ui/alert-dialog"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { Textarea } from "@/components/ui/textarea"; -import { Loader2, Trash2, ExternalLink, RefreshCw, Plus, X } from "lucide-react"; +import { + Loader2, + Trash2, + ExternalLink, + RefreshCw, + Plus, + X, + Send, +} from "lucide-react"; import { aethexToast } from "@/lib/aethex-toast"; -// API Base URL for fetch requests const API_BASE = import.meta.env.VITE_API_BASE || ""; interface BlogPost { @@ -200,10 +207,9 @@ export default function AdminBlogManager() { throw new Error(error.message || "Failed to publish post"); } - const data = await response.json(); aethexToast.success({ title: "Post published!", - description: `Successfully published to Ghost`, + description: "Successfully published to Ghost", }); // Reset form @@ -242,154 +248,348 @@ export default function AdminBlogManager() { return (
- - -
-
- Blog Management - - {blogPosts.length} published{" "} - {blogPosts.length === 1 ? "post" : "posts"} - -
- -
-
- -
-
- - setSearchQuery(e.target.value)} - className="h-8" - /> -
-
- - -
-
+ + + Manage Posts + + + Create New + + - {filteredPosts.length === 0 ? ( -
-

- {blogPosts.length === 0 - ? "No blog posts found" - : "No matching blog posts"} -

- {blogPosts.length === 0 && ( + {/* Manage Posts Tab */} + + + +
+
+ Blog Posts + + {blogPosts.length} published{" "} + {blogPosts.length === 1 ? "post" : "posts"} + +
+
+
+ +
+
+ + setSearchQuery(e.target.value)} + className="h-8" + /> +
+
+ + +
+
+ + {filteredPosts.length === 0 ? ( +
+

+ {blogPosts.length === 0 + ? "No blog posts found" + : "No matching blog posts"} +

+
+ ) : ( +
+ + + + Title + Author + Category + Date + + Actions + + + + + {filteredPosts.map((post) => ( + + +
+

{post.title}

+

+ {post.slug} +

+
+
+ + {post.author || "—"} + + + {post.category ? ( + + {post.category} + + ) : ( + + — + + )} + + + {formatDate(post.published_at || post.date)} + + +
+ + +
+
+
+ ))} +
+
+
)} -
- ) : ( -
- - - - Title - Author - Category - Date - Actions - - - - {filteredPosts.map((post) => ( - - -
-

{post.title}

-

- {post.slug} -

-
-
- - {post.author || "—"} - - - {post.category ? ( - - {post.category} - - ) : ( - - — - - )} - - - {formatDate(post.published_at || post.date)} - - -
- - -
-
-
- ))} -
-
-
- )} -
-
+ + + + + {/* Create Post Tab */} + + + + Create New Post + + Publish directly to Ghost.org immediately + + + + {/* Title */} +
+ + setTitle(e.target.value)} + placeholder="Post title" + className="border-border/50" + /> +
+ + {/* Slug */} +
+ + setSlug(e.target.value)} + placeholder="Leave blank to auto-generate" + className="border-border/50" + /> + {!slug && title && ( +

+ Auto-slug:{" "} + {autoSlug} +

+ )} +
+ + {/* Excerpt */} +
+ +