feat(comments): 支持编辑与管理可见历史,采纳展示改用楼层号

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-16 08:05:41 +08:00
parent d032668c66
commit 1b2b87c976
14 changed files with 716 additions and 42 deletions

View File

@@ -81,7 +81,18 @@ function QuestionPanel({ postId, state }: { postId: number; state: QuestionState
<p className="meta text-[12.5px] mt-1">
{state.solved
? state.accepted_comment_id
? `已采纳评论 #${state.accepted_comment_id}`
? (
<>
已采纳{" "}
<a
href={`#comment-${state.accepted_comment_id}`}
className="hover:underline"
style={{ color: "var(--accent)" }}
>
#{state.accepted_floor || "?"}
</a>
</>
)
: "作者已标记为已解决"
: "可在评论旁采纳答案,或手动标记已解决"}
</p>
@@ -295,7 +306,7 @@ function BountyPanel({ postId, state }: { postId: number; state: BountyState })
: state.refunded
? "已退回给发帖人"
: state.accepted_comment_id
? `已采纳评论 #${state.accepted_comment_id}`
? null
: state.escrowed
? "积分已托管,采纳优质回答后发放"
: "悬赏未托管";
@@ -308,7 +319,20 @@ function BountyPanel({ postId, state }: { postId: number; state: BountyState })
悬赏 {state.points} 积分
</h2>
<p className="meta text-[12.5px] mt-1">
{statusText}
{state.accepted_comment_id ? (
<>
已采纳{" "}
<a
href={`#comment-${state.accepted_comment_id}`}
className="hover:underline"
style={{ color: "var(--accent)" }}
>
#{state.accepted_floor || "?"}
</a>
</>
) : (
statusText
)}
{state.ends_at && !state.settled ? ` · 截止 ${formatEndsAt(state.ends_at)}` : ""}
</p>
</div>
@@ -404,11 +428,10 @@ function LotteryPanel({
<li key={w.id}>
<Link
href={`/u/${w.id}`}
className="inline-flex items-center gap-2 px-2.5 py-1.5 rounded-full"
style={{ background: "var(--accent-soft)", color: "var(--accent)" }}
className="badge-winner inline-flex items-center gap-2 !py-1.5 !px-2.5 !text-[13px] !font-medium"
>
<Avatar name={w.nickname || w.username} src={w.avatar || undefined} size={22} />
<span className="text-[13px]">{w.nickname || w.username}</span>
<span>{w.nickname || w.username}</span>
</Link>
</li>
))}