feat(posts): 类型特殊块移至正文下,采纳答案卡与中奖楼层按评论标记
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -55,8 +55,8 @@ interface CommentSectionProps {
|
||||
/** 悬赏或问答:可采纳时在评论旁显示采纳按钮(二者按帖子类型二选一) */
|
||||
acceptMode?: "bounty" | "question" | null;
|
||||
acceptedCommentId?: number;
|
||||
/** 抽奖已开奖:中奖用户 ID,用于楼层旁显示「中奖」徽标 */
|
||||
winnerUserIds?: number[];
|
||||
/** 抽奖已开奖:中奖楼层评论 ID(每名中奖者仅其最早主评一条) */
|
||||
winnerCommentIds?: number[];
|
||||
/** 全站是否开放评论;缺省 true。关闭时隐藏发评/回复入口 */
|
||||
allowComments?: boolean;
|
||||
}
|
||||
@@ -115,10 +115,10 @@ export default function CommentSection({
|
||||
user,
|
||||
acceptMode = null,
|
||||
acceptedCommentId = 0,
|
||||
winnerUserIds = [],
|
||||
winnerCommentIds = [],
|
||||
allowComments: allowCommentsProp = true,
|
||||
}: CommentSectionProps) {
|
||||
const winnerIdSet = new Set(winnerUserIds.filter((id) => id > 0));
|
||||
const winnerCommentIdSet = new Set(winnerCommentIds.filter((id) => id > 0));
|
||||
const router = useRouter();
|
||||
const [content, setContent] = useState("");
|
||||
// 内联回复目标:在该评论下方就地发子评论(同一时间只有一个回复框)
|
||||
@@ -875,7 +875,7 @@ export default function CommentSection({
|
||||
{acceptedCommentId === c.id && (
|
||||
<span className="badge-accepted shrink-0">已采纳</span>
|
||||
)}
|
||||
{winnerIdSet.has(c.user.id) && (
|
||||
{winnerCommentIdSet.has(c.id) && (
|
||||
<span className="badge-winner shrink-0">中奖楼层</span>
|
||||
)}
|
||||
{floor && (
|
||||
|
||||
Reference in New Issue
Block a user