"use client";
import { countUnresolvedAnnotations } from "../core/annotation-status";
import { useCommentStore } from "../react/CommentProvider";
import { CommentHeaderCount } from "./CommentHeaderCount";
import { CommentModeToggleButton } from "./CommentModeToggleButton";
import { CommentsGrid } from "./CommentsGrid";
import { Sidebar } from "@prototype/components/platform-ui/sidebar";
type CommentsSidebarProps = {
open: boolean;
onClose: () => void;
onSelect: (id: string) => void;
selectedId?: string | null;
isCommentModeActive?: boolean;
onToggleCommentMode?: () => void;
};
export function CommentsSidebar({
open,
onClose,
onSelect,
selectedId,
isCommentModeActive = false,
onToggleCommentMode,
}: CommentsSidebarProps) {
const { annotations, deleteAnnotation, updateAnnotation, resolveAnnotation } =
useCommentStore();
const unresolvedCount = countUnresolvedAnnotations(annotations);
const totalCount = annotations.length;
return (
}
onClose={onClose}
ariaLabel="Comments"
dataAttribute="data-comments-sidebar"
widthCssVar="--comments-sidebar-width"
headerActions={
onToggleCommentMode ? (
) : null
}
>
);
}