import { Button } from "@/src/components/ui/button"; import { ResizableHandle, ResizablePanel, ResizablePanelGroup, } from "@/src/components/ui/resizable"; import { Skeleton } from "@/src/components/ui/skeleton"; import useSessionStorage from "@/src/components/useSessionStorage"; import { CommentsSection } from "@/src/features/annotation-queues/components/shared/CommentsSection"; import { useActiveCell } from "@/src/features/datasets/contexts/ActiveCellContext"; import { AnnotationForm } from "@/src/features/scores/components/AnnotationForm"; import { ChevronRight } from "lucide-react"; import { useState } from "react"; import { toast } from "sonner"; import { decomposeAggregateScoreKey } from "@/src/features/scores/lib/aggregateScores"; export const AnnotationPanel = ({ projectId }: { projectId: string }) => { const [hasCommentDraft, setHasCommentDraft] = useState(false); const { activeCell, clearActiveCell } = useActiveCell(); const [verticalSize, setVerticalSize] = useSessionStorage( `annotationQueueDrawerVertical-compare-${projectId}`, 60, ); if (!activeCell) { return ; } const hasNonAnnotationScores = Object.keys(activeCell.scoreAggregates).some( (key) => { const { source } = decomposeAggregateScoreKey(key); return source !== "ANNOTATION"; }, ); return ( setVerticalSize(sizes[0])} className="h-full" > {activeCell ? ( <> { if (hasCommentDraft) toast.error( "Please save or discard your comment before proceeding", ); else clearActiveCell(); }} > } /> {hasNonAnnotationScores && ( API and eval scores visible on left. Add manual annotations above. )} > ) : ( )} { setHasCommentDraft(draft); }} /> ); };