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

@@ -7,6 +7,7 @@ import {
ChevronRight,
FileText,
FolderOpen,
History,
Loader2,
MessagesSquare,
RotateCcw,
@@ -36,6 +37,7 @@ import Avatar from "@/components/Avatar";
import ConfirmDialog from "@/components/ConfirmDialog";
import StaffDeletePostModal from "@/components/StaffDeletePostModal";
import DeleteCommentModal from "@/components/DeleteCommentModal";
import CommentEditHistoryModal from "@/components/CommentEditHistoryModal";
const PAGE_SIZE = 15;
@@ -145,6 +147,7 @@ export default function ContentAdmin({
const [staffDeleteBusy, setStaffDeleteBusy] = useState(false);
const [staffDeleteComment, setStaffDeleteComment] = useState<AdminContentComment | null>(null);
const [staffDeleteCommentBusy, setStaffDeleteCommentBusy] = useState(false);
const [historyCommentId, setHistoryCommentId] = useState<number | null>(null);
const refreshCounts = useCallback(() => {
apiAdminContentCounts().then(setCounts).catch(() => {});
@@ -570,6 +573,13 @@ export default function ContentAdmin({
</p>
</div>
<div className="flex items-center gap-1 shrink-0">
<button
type="button"
className="btn btn-line btn-sm"
onClick={() => setHistoryCommentId(c.id)}
>
<History size={14} /> 历史
</button>
{c.deleted ? (
<>
<button
@@ -713,6 +723,12 @@ export default function ContentAdmin({
.finally(() => setStaffDeleteCommentBusy(false));
}}
/>
<CommentEditHistoryModal
open={historyCommentId != null}
commentId={historyCommentId}
onClose={() => setHistoryCommentId(null)}
/>
</div>
);
}