mirror of
https://github.com/SamyRai/tercul-frontend.git
synced 2025-12-27 04:51:34 +00:00
Add a dedicated blog section to share articles and engage with readers
Implements blog listing, detail, and creation pages with necessary components and types. Replit-Commit-Author: Agent Replit-Commit-Session-Id: cbacfb18-842a-4116-a907-18c0105ad8ec Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/39b5c689-6e8a-4d5a-9792-69cc81a56534/10041482-d9af-42cb-9c5d-d331b0904c5e.jpg
This commit is contained in:
parent
64fd506bdc
commit
987af7c0e7
@ -29,6 +29,9 @@ function Router() {
|
|||||||
<Route path="/collections/create" component={CreateCollection} />
|
<Route path="/collections/create" component={CreateCollection} />
|
||||||
<Route path="/profile" component={Profile} />
|
<Route path="/profile" component={Profile} />
|
||||||
<Route path="/submit" component={Submit} />
|
<Route path="/submit" component={Submit} />
|
||||||
|
<Route path="/blog" component={BlogList} />
|
||||||
|
<Route path="/blog/create" component={BlogCreate} />
|
||||||
|
<Route path="/blog/:slug" component={BlogDetail} />
|
||||||
<Route component={NotFound} />
|
<Route component={NotFound} />
|
||||||
</Switch>
|
</Switch>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -110,6 +110,7 @@ export interface BlogPostWithDetails {
|
|||||||
tags?: Tag[];
|
tags?: Tag[];
|
||||||
commentCount?: number;
|
commentCount?: number;
|
||||||
likeCount?: number;
|
likeCount?: number;
|
||||||
|
comments?: CommentWithUser[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BlogPostListItem {
|
export interface BlogPostListItem {
|
||||||
|
|||||||
@ -17,8 +17,7 @@ import { apiRequest, queryClient } from "@/lib/queryClient";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||||
import { useToast } from "@/hooks/use-toast";
|
import { useToast } from "@/hooks/use-toast";
|
||||||
import { insertBlogPostSchema } from "@shared/schema";
|
import { insertBlogPostSchema, Tag } from "@shared/schema";
|
||||||
import { Tag } from "@/lib/types";
|
|
||||||
|
|
||||||
const blogPostSchema = insertBlogPostSchema.extend({
|
const blogPostSchema = insertBlogPostSchema.extend({
|
||||||
tags: z.array(z.number()).optional(),
|
tags: z.array(z.number()).optional(),
|
||||||
@ -82,7 +81,7 @@ export default function BlogCreate() {
|
|||||||
defaultValues: {
|
defaultValues: {
|
||||||
title: "",
|
title: "",
|
||||||
content: "",
|
content: "",
|
||||||
excerpt: "",
|
excerpt: "", // Using empty string instead of null
|
||||||
authorId: 1, // Mock user ID for demo
|
authorId: 1, // Mock user ID for demo
|
||||||
tags: [],
|
tags: [],
|
||||||
},
|
},
|
||||||
@ -206,7 +205,11 @@ export default function BlogCreate() {
|
|||||||
<Textarea
|
<Textarea
|
||||||
placeholder="Provide a short summary of your article (will appear in previews)"
|
placeholder="Provide a short summary of your article (will appear in previews)"
|
||||||
className="resize-y h-20"
|
className="resize-y h-20"
|
||||||
{...field}
|
value={field.value || ""}
|
||||||
|
onChange={field.onChange}
|
||||||
|
onBlur={field.onBlur}
|
||||||
|
name={field.name}
|
||||||
|
ref={field.ref}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormDescription>
|
<FormDescription>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user