import React from 'react'; import { Annotation, AnnotationType, Block } from '../types'; interface SidebarProps { annotations: Annotation[]; blocks: Block[]; onSelect: (id: string) => void; onDelete: (id: string) => void; selectedId: string | null; } export const AnnotationSidebar: React.FC = ({ annotations, blocks, onSelect, onDelete, selectedId }) => { const sortedAnnotations = [...annotations].sort((a, b) => { const blockA = blocks.findIndex(blk => blk.id === a.blockId); const blockB = blocks.findIndex(blk => blk.id === b.blockId); if (blockA !== blockB) return blockA - blockB; return a.startOffset - b.startOffset; }); return (

Review Changes

{annotations.length}
{sortedAnnotations.length === 0 ? (

No annotations yet.

Select text in the document to add comments or suggest changes.

) : ( sortedAnnotations.map(ann => (
onSelect(ann.id)} className={` group relative p-3 rounded-lg border transition-all cursor-pointer ${selectedId === ann.id ? 'bg-accent/20 border-accent shadow-sm' : 'bg-card border-border hover:border-accent hover:shadow-sm' } `} >
{ann.type}
"{ann.originalText}"
{(ann.text && ann.type !== AnnotationType.DELETION) && (
{ann.text}
)}
)) )}
); };