mirror of
https://github.com/snowykami/neo-blog.git
synced 2025-09-26 11:06:23 +00:00
Refactor comment components and update OIDC configuration
- Updated OIDC configuration to include additional fields in the UpdateOidcConfig method. - Enhanced CommentService to include IsPrivate field in the comment DTO. - Refactored comment components: renamed neo-comment to comment, and moved related files. - Implemented new CommentInput and CommentItem components for better structure and readability. - Removed obsolete files related to the old comment system. - Added CSS animations for comment components to improve user experience.
This commit is contained in:
@ -4,7 +4,7 @@ import { Calendar, Clock, FileText, Flame, Heart, MessageCircle, PenLine, Square
|
||||
import { RenderMarkdown } from "@/components/common/markdown";
|
||||
import { isMobileByUA } from "@/utils/server/device";
|
||||
import { calculateReadingTime } from "@/utils/common/post";
|
||||
import {CommentSection} from "@/components/neo-comment";
|
||||
import {CommentSection} from "@/components/comment";
|
||||
import { TargetType } from '../../models/types';
|
||||
|
||||
function PostMeta({ post }: { post: Post }) {
|
||||
|
@ -10,6 +10,7 @@ import { Textarea } from "@/components/ui/textarea";
|
||||
import { Checkbox } from "@/components/ui/checkbox"
|
||||
import { Label } from "@/components/ui/label";
|
||||
|
||||
|
||||
export function CommentInput(
|
||||
{
|
||||
user,
|
||||
@ -54,7 +55,7 @@ export function CommentInput(
|
||||
</div>
|
||||
<div className="flex-1 pl-2 fade-in-up">
|
||||
<Textarea
|
||||
placeholder={t("placeholder")}
|
||||
placeholder={user?t("placeholder"):t("login_required")}
|
||||
className="w-full p-2 border border-gray-300 rounded-md fade-in-up"
|
||||
value={commentContent}
|
||||
onChange={(e) => setCommentContent(e.target.value)}
|
@ -14,6 +14,7 @@ import { createComment, deleteComment, listComments, updateComment } from "@/api
|
||||
import { OrderBy } from "@/models/common";
|
||||
import config from "@/config";
|
||||
|
||||
|
||||
export function CommentItem(
|
||||
{
|
||||
user,
|
||||
@ -33,6 +34,7 @@ export function CommentItem(
|
||||
|
||||
const [likeCount, setLikeCount] = useState(comment.likeCount);
|
||||
const [liked, setLiked] = useState(comment.isLiked);
|
||||
const [isPrivate, setIsPrivate] = useState(comment.isPrivate);
|
||||
const [replyCount, setReplyCount] = useState(comment.replyCount);
|
||||
const [showReplies, setShowReplies] = useState(false);
|
||||
const [showReplyInput, setShowReplyInput] = useState(false);
|
||||
@ -81,7 +83,7 @@ export function CommentItem(
|
||||
updateComment({ id: comment.id, content: newContent, isPrivate }).then(() => {
|
||||
toast.success(t("edit_success"));
|
||||
comment.content = newContent;
|
||||
comment.isPrivate = isPrivate;
|
||||
setIsPrivate(isPrivate);
|
||||
setShowEditInput(false);
|
||||
}).catch(error => {
|
||||
toast.error(t("edit_failed") + ": " + error.message);
|
||||
@ -127,7 +129,7 @@ export function CommentItem(
|
||||
<div className="font-bold text-base text-slate-800 dark:text-slate-100 fade-in-up">{comment.user.nickname}</div>
|
||||
<p className="text-lg text-slate-600 dark:text-slate-400 fade-in">
|
||||
{
|
||||
comment.isPrivate && <Lock className="inline w-4 h-4 mr-1 mb-1 text-slate-500 dark:text-slate-400" />
|
||||
isPrivate && <Lock className="inline w-4 h-4 mr-1 mb-1 text-slate-500 dark:text-slate-400" />
|
||||
}
|
||||
{
|
||||
parentComment &&
|
||||
@ -201,7 +203,7 @@ export function CommentItem(
|
||||
{showEditInput && !showReplyInput && <CommentInput
|
||||
user={user}
|
||||
initContent={comment.content}
|
||||
initIsPrivate={comment.isPrivate}
|
||||
initIsPrivate={isPrivate}
|
||||
onCommentSubmitted={onCommentEdit}
|
||||
isUpdate={true}
|
||||
/>}
|
@ -11,12 +11,12 @@ import { OrderBy } from "@/models/common";
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
import { getLoginUser } from "@/api/user";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
|
||||
import "./style.css";
|
||||
import { CommentInput } from "./comment-input";
|
||||
import { CommentItem } from "./comment-item";
|
||||
import config from "@/config";
|
||||
|
||||
import "./style.css";
|
||||
|
||||
|
||||
|
||||
export function CommentSection(
|
Reference in New Issue
Block a user