diff --git a/web/src/widgets/DocumentComments/CommentsPopover.tsx b/web/src/widgets/DocumentComments/CommentsPopover.tsx new file mode 100644 index 0000000..624ae98 --- /dev/null +++ b/web/src/widgets/DocumentComments/CommentsPopover.tsx @@ -0,0 +1,42 @@ +import { CommentOutlined } from '@ant-design/icons'; +import { Button, Popover } from 'antd'; +import { useState } from 'react'; +import { CommentsList } from './CommentsList'; +import { useDocumentComments } from './useDocumentComments'; + +/** Кнопка с числом комментариев в строке панели документов [39-01]; по клику — список только для чтения. */ +export function CommentsPopover({ documentId, fileName, count }: { documentId: string; fileName: string; count: number }) { + const [open, setOpen] = useState(false); + const { state, load, reset } = useDocumentComments(documentId); + + const onOpenChange = (next: boolean) => { + setOpen(next); + if (next) load(); + else reset(); + }; + + const content = ( +
e.stopPropagation()} + onKeyDown={(e) => e.stopPropagation()} + style={{ width: 360, maxWidth: 420 }}> +
+ +
+
+ +
+
+ ); + + return ( + + + + ); +} diff --git a/web/src/widgets/FilesDrawer/FilesList.tsx b/web/src/widgets/FilesDrawer/FilesList.tsx index 7c74d7c..3e300d0 100644 --- a/web/src/widgets/FilesDrawer/FilesList.tsx +++ b/web/src/widgets/FilesDrawer/FilesList.tsx @@ -4,6 +4,7 @@ import type { ColumnsType } from 'antd/es/table'; import type { ReactNode } from 'react'; import { useNavigate } from 'react-router-dom'; import type { CheckResult, FileOut, FileType } from '../../types/api'; +import { CommentsPopover } from '../DocumentComments/CommentsPopover'; import { FileWarningsPopover } from './FileWarningsPopover'; import { type DocumentRow, type RowStatus, buildDocumentRows, rowBadge } from './documentRows'; @@ -138,14 +139,17 @@ export function FilesList({ title: '', dataIndex: 'action', render: (_, r) => ( -