diff --git a/src/components/AnnotationGroupItem.tsx b/src/components/AnnotationGroupItem.tsx index cc80dfbb..caec9519 100644 --- a/src/components/AnnotationGroupItem.tsx +++ b/src/components/AnnotationGroupItem.tsx @@ -6,7 +6,6 @@ import { Col, Divider, InputNumber, - Menu, Popover, Row, Select, @@ -564,41 +563,25 @@ class AnnotationGroupItem extends React.Component< const color = this.getCurrentColor() const isBadgeVisible = this.state.isVisible && this.state.currentStyle.measurement === null - const { - annotationGroup, - defaultStyle, - isVisible, - metadata, - onVisibilityChange, - onStyleChange, - onAnnotationGroupClick, - ...otherProps - } = this.props return ( - - -
- -
- +
+ - - +
+ +
) } } diff --git a/src/components/AnnotationGroupList.tsx b/src/components/AnnotationGroupList.tsx index 05cf29c4..afcb1c3b 100644 --- a/src/components/AnnotationGroupList.tsx +++ b/src/components/AnnotationGroupList.tsx @@ -1,3 +1,4 @@ +import type { MenuProps } from 'antd' import { Menu, Switch } from 'antd' // skipcq: JS-C1003 import type * as dcmjs from 'dcmjs' @@ -67,21 +68,26 @@ class AnnotationGroupList extends React.Component< } render(): React.ReactNode { - const items = this.props.annotationGroups.map((annotationGroup, _index) => { - const uid = annotationGroup.uid - return ( - - ) - }) + const items: MenuProps['items'] = this.props.annotationGroups.map( + (annotationGroup) => { + const uid = annotationGroup.uid + return { + key: uid, + style: { height: '100%', paddingLeft: '3px' }, + label: ( + + ), + } + }, + ) return ( <> @@ -100,7 +106,7 @@ class AnnotationGroupList extends React.Component< unCheckedChildren={} /> - {items} + ) } diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 2337f056..1bc9a225 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -9,7 +9,6 @@ import { UserOutlined, } from '@ant-design/icons' import { - Badge, Col, Collapse, Dropdown, @@ -86,6 +85,59 @@ const aboutModalStyles: Record = { }, } +/** + * Static count pill that avoids antd Badge → rc-motion `findDOMNode` + * (deprecated under React Strict Mode). + */ +function HeaderCountBadge({ + count, + color = '#ff4d4f', + zIndex, + children, +}: { + count: number + color?: string + zIndex?: number + children?: React.ReactNode +}): JSX.Element { + const pill = + count > 0 ? ( + + {count > 99 ? '99+' : count} + + ) : null + + if (children == null) { + return <>{pill} + } + + return ( + + {children} + {pill} + + ) +} + interface HeaderProps extends RouteComponentProps { app: { name: string @@ -421,11 +473,14 @@ class Header extends React.Component { const { Panel } = Collapse const showErrorCount = (errcount: number): JSX.Element => ( - + ) const showWarningCount = (warncount: number): JSX.Element => ( - 0 ? 'green' : undefined} count={warncount} /> + 0 ? '#52c41a' : '#ff4d4f'} + /> ) Modal.info({ @@ -612,19 +667,63 @@ class Header extends React.Component { ) const debugButton = ( - - 0 ? 'green' : undefined} - count={this.state.warnings.length} - style={{ zIndex: 1001 }} - > - + items={items} + /> ) } }