Skip to content

Commit d8755d7

Browse files
author
Mingze
authored
fix(highlight): Remove unnecessary Highlight Creator (#608)
1 parent 9b542ee commit d8755d7

File tree

4 files changed

+4
-38
lines changed

4 files changed

+4
-38
lines changed

src/highlight/HighlightAnnotations.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as React from 'react';
22
import HighlightCanvas from './HighlightCanvas';
3-
import HighlightCreator from './HighlightCreator';
43
import HighlightList from './HighlightList';
54
import HighlightSvg from './HighlightSvg';
65
import HighlightTarget from './HighlightTarget';
@@ -107,10 +106,7 @@ const HighlightAnnotations = (props: Props): JSX.Element => {
107106
{/* Layer 1: Saved annotations */}
108107
<HighlightList activeId={activeAnnotationId} annotations={annotations} onSelect={handleAnnotationActive} />
109108

110-
{/* Layer 2: Drawn (unsaved) incomplete annotation target, if any */}
111-
{canCreate && <HighlightCreator className="ba-HighlightAnnotations-creator" />}
112-
113-
{/* Layer 3: Staged (unsaved) highlight target, if any */}
109+
{/* Layer 2: Staged (unsaved) highlight target, if any */}
114110
{canCreate && staged && (
115111
<div className="ba-HighlightAnnotations-target">
116112
<HighlightCanvas shapes={staged.shapes} />
@@ -120,14 +116,14 @@ const HighlightAnnotations = (props: Props): JSX.Element => {
120116
</div>
121117
)}
122118

123-
{/* Layer 4a: Annotations promoter to promote selection to staged */}
119+
{/* Layer 3a: Annotations promoter to promote selection to staged */}
124120
{!isCreating && selection && !selection.hasError && (
125121
<div className="ba-HighlightAnnotations-popup">
126122
<PopupHighlight onClick={handlePromote} shape={getBoundingRect(selection.rects)} />
127123
</div>
128124
)}
129125

130-
{/* Layer 4b: Highlight error popup */}
126+
{/* Layer 3b: Highlight error popup */}
131127
{selection && selection.hasError && (
132128
<div className="ba-HighlightAnnotations-popup">
133129
<PopupHighlightError shape={getBoundingRect(selection.rects)} />

src/highlight/HighlightCreator.tsx

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/highlight/__tests__/HighlightAnnotations-test.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React from 'react';
22
import { ReactWrapper, mount } from 'enzyme';
33
import HighlightAnnotations from '../HighlightAnnotations';
44
import HighlightCanvas from '../HighlightCanvas';
5-
import HighlightCreator from '../HighlightCreator';
65
import HighlightList from '../HighlightList';
76
import HighlightSvg from '../HighlightSvg';
87
import PopupHighlight from '../../components/Popups/PopupHighlight';
@@ -49,19 +48,16 @@ describe('HighlightAnnotations', () => {
4948
const getWrapper = (props = {}): ReactWrapper => mount(<HighlightAnnotations {...defaults} {...props} />);
5049

5150
describe('render()', () => {
52-
test('should render a HighlightCreator if in creation mode', () => {
51+
test('should render a HighlightList if in creation mode', () => {
5352
const wrapper = getWrapper({ isCreating: true });
54-
const creator = wrapper.find(HighlightCreator);
5553

5654
expect(wrapper.find(HighlightList).exists()).toBe(true);
57-
expect(creator.hasClass('ba-HighlightAnnotations-creator')).toBe(true);
5855
});
5956

6057
test('should not render creation components if not in creation mode', () => {
6158
const wrapper = getWrapper({ isCreating: false });
6259

6360
expect(wrapper.find(HighlightList).exists()).toBe(true);
64-
expect(wrapper.exists(HighlightCreator)).toBe(false);
6561
expect(wrapper.exists(HighlightCanvas)).toBe(false);
6662
expect(wrapper.exists(HighlightSvg)).toBe(false);
6763
expect(wrapper.exists(PopupReply)).toBe(false);

src/highlight/__tests__/HighlightCreator-test.tsx

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)