mirror of
https://github.com/SamyRai/tercul-frontend.git
synced 2025-12-27 04:51:34 +00:00
Fix BlogEdit.tsx import and component issues
- Fix import path from @/api/blog-api to @/lib/api/blog-api - Replace TagManager component with simple tag input since BlogEdit uses plain state - Remove unused handleTagsChange function - This resolves the build error where blog-api file was not found
This commit is contained in:
parent
a3ffebdf0c
commit
1656b67abe
@ -1,7 +1,6 @@
|
|||||||
|
import { getBlogPost, updateBlogPost } from "@/lib/api/blog-api";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import { getBlogPost, updateBlogPost } from "@/api/blog-api";
|
|
||||||
import { TagManager } from "../../components/blog/tag-manager";
|
|
||||||
|
|
||||||
interface BlogPost {
|
interface BlogPost {
|
||||||
id: string;
|
id: string;
|
||||||
@ -38,11 +37,6 @@ const BlogEdit: React.FC = () => {
|
|||||||
setPost({ ...post, [e.target.name]: e.target.value });
|
setPost({ ...post, [e.target.name]: e.target.value });
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleTagsChange = (tags: string[]) => {
|
|
||||||
if (!post) return;
|
|
||||||
setPost({ ...post, tags });
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleStatusChange = (status: BlogPost["status"]) => {
|
const handleStatusChange = (status: BlogPost["status"]) => {
|
||||||
if (!post) return;
|
if (!post) return;
|
||||||
setPost({ ...post, status });
|
setPost({ ...post, status });
|
||||||
@ -85,7 +79,20 @@ const BlogEdit: React.FC = () => {
|
|||||||
className="textarea textarea-bordered w-full h-40"
|
className="textarea textarea-bordered w-full h-40"
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<TagManager tags={post.tags} onChange={handleTagsChange} />
|
<div>
|
||||||
|
<label className="block text-sm font-medium mb-2">Tags</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
value={post.tags.join(", ")}
|
||||||
|
onChange={(e) => {
|
||||||
|
const tags = e.target.value.split(",").map(tag => tag.trim()).filter(tag => tag);
|
||||||
|
setPost({ ...post, tags });
|
||||||
|
}}
|
||||||
|
placeholder="Enter tags separated by commas"
|
||||||
|
className="input input-bordered w-full"
|
||||||
|
/>
|
||||||
|
<p className="text-xs text-gray-500 mt-1">Separate tags with commas</p>
|
||||||
|
</div>
|
||||||
<div className="flex gap-2 items-center">
|
<div className="flex gap-2 items-center">
|
||||||
<label htmlFor="status">Status:</label>
|
<label htmlFor="status">Status:</label>
|
||||||
<select
|
<select
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user