feat: 更新评论输入框的占位符,支持自定义占位符文本
All checks were successful
Push to Helm Chart Repository / build (push) Successful in 27s

This commit is contained in:
2025-09-12 16:27:12 +08:00
parent 0a7cbc00fc
commit 3fdd801d28
3 changed files with 132 additions and 129 deletions

View File

@ -16,12 +16,14 @@ export function CommentInput(
onCommentSubmitted, onCommentSubmitted,
initContent = "", initContent = "",
initIsPrivate = false, initIsPrivate = false,
placeholder = "",
isUpdate = false isUpdate = false
}: { }: {
user: User | null, user: User | null,
onCommentSubmitted: ({ commentContent, isPrivate }: { commentContent: string, isPrivate: boolean }) => void, onCommentSubmitted: ({ commentContent, isPrivate }: { commentContent: string, isPrivate: boolean }) => void,
initContent?: string, initContent?: string,
initIsPrivate?: boolean, initIsPrivate?: boolean,
placeholder?: string,
isUpdate?: boolean, isUpdate?: boolean,
} }
) { ) {
@ -65,7 +67,7 @@ export function CommentInput(
</div> </div>
<div className="flex-1 pl-2 fade-in-up"> <div className="flex-1 pl-2 fade-in-up">
<Textarea <Textarea
placeholder={user ? (isPrivate ? t("private_placeholder") : t("placeholder")) : t("login_required", { loginButton: "登录" })} placeholder={placeholder || (user ? (isPrivate ? t("private_placeholder") : t("placeholder")) : t("login_required", { loginButton: "登录" }))}
className="w-full p-2 border border-gray-300 rounded-md fade-in-up" className="w-full p-2 border border-gray-300 rounded-md fade-in-up"
value={commentContent} value={commentContent}
onChange={(e) => setCommentContent(e.target.value)} onChange={(e) => setCommentContent(e.target.value)}

View File

@ -268,6 +268,7 @@ export function CommentItem(
user={user} user={user}
onCommentSubmitted={onReply} onCommentSubmitted={onReply}
initIsPrivate={isPrivate} initIsPrivate={isPrivate}
placeholder={`${t("reply")} ${comment.user.nickname} :`}
/>} />}
{activeInput && activeInput.type === 'edit' && activeInput.id === comment.id && <CommentInput {activeInput && activeInput.type === 'edit' && activeInput.id === comment.id && <CommentInput
user={user} user={user}