Skip to content

Commit 6b18b1f

Browse files
authored
chore(aggregation): final alignment with design for rebranding (#3894)
* chore(aggregation): remove empty state icon * Add link for stages docs * more improvements * remove invalid test * fix eslint
1 parent 59cdf26 commit 6b18b1f

File tree

10 files changed

+51
-44
lines changed

10 files changed

+51
-44
lines changed

packages/compass-aggregations/src/components/add-stage/add-stage.jsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { PureComponent } from 'react';
22
import PropTypes from 'prop-types';
33
import { connect } from 'react-redux';
44

5-
import { Button, Icon, css, spacing } from '@mongodb-js/compass-components';
5+
import { Button, Icon, css, spacing, Link } from '@mongodb-js/compass-components';
66

77
import { addStage } from '../../modules/pipeline-builder/stage-editor';
88

@@ -13,6 +13,12 @@ const containerStyles = css({
1313
marginBottom: spacing[3]
1414
});
1515

16+
const linkContainerStyles = css({
17+
textAlign: 'center',
18+
marginTop: spacing[3],
19+
marginBottom: spacing[3],
20+
});
21+
1622
export class AddStage extends PureComponent {
1723
static displayName = 'AddStageComponent';
1824

@@ -35,6 +41,10 @@ export class AddStage extends PureComponent {
3541
<Button data-testid="add-stage" onClick={this.onClick} variant="primary" leftGlyph={<Icon glyph="Plus"></Icon>}>
3642
Add Stage
3743
</Button>
44+
45+
<div className={linkContainerStyles}>
46+
<Link href='https://www.mongodb.com/docs/manual/reference/operator/aggregation-pipeline/'>Learn more about aggregation pipeline stages</Link>
47+
</div>
3848
</div>
3949
);
4050
}

packages/compass-aggregations/src/components/pipeline-builder-input-documents.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,15 @@ function PipelineBuilderInputDocuments({
7777
toggleInputDocumentsCollapsed(!isExpanded);
7878
};
7979

80+
const expandTooltipText = isExpanded ? 'Collapse' : 'Expand';
81+
8082
return (<KeylineCard className={cardStyles}>
8183
<div className={headerStyles}>
82-
<IconButton onClick={toggleExpanded} aria-label={isExpanded ? 'Collapse' : 'Expand'}>
84+
<IconButton onClick={toggleExpanded} title={expandTooltipText} aria-label={expandTooltipText}>
8385
<Icon glyph={isExpanded ? 'ChevronDown' : 'ChevronRight'} size="small"></Icon>
8486
</IconButton>
8587
<Body className={headerTextStyles}><b>{count} Document{count === 1 ? '' : 's'}</b> in the collection</Body>
86-
<IconButton onClick={refreshInputDocuments} aria-label="Refresh">
88+
<IconButton onClick={refreshInputDocuments} aria-label="Refresh" title="Refresh">
8789
<Icon glyph="Refresh" size="small" />
8890
</IconButton>
8991
</div>

packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-settings/pipeline-extra-settings.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ export const PipelineExtraSettings: React.FunctionComponent<
107107
</SegmentedControl>
108108
)}
109109
<IconButton
110+
title="More Settings"
110111
aria-label="More Settings"
111112
onClick={() => onToggleSettings()}
112113
data-testid="pipeline-toolbar-settings-button"

packages/compass-aggregations/src/components/stage-editor-toolbar/add-after-stage.spec.jsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React from 'react';
22
import { mount } from 'enzyme';
33
import sinon from 'sinon';
44
import { expect } from 'chai';
5-
import { Tooltip } from '@mongodb-js/compass-components';
65

76
import { AddAfterStage } from './add-after-stage';
87

@@ -22,10 +21,6 @@ describe('AddAfterStage [Component]', function() {
2221
it('renders the icon', function() {
2322
expect(component.find('button').find('Icon').first()).to.have.prop('glyph', 'Plus');
2423
});
25-
26-
it('renders the tooltip', function() {
27-
expect(component.find(Tooltip)).to.be.present();
28-
});
2924
});
3025

3126
context('when clicking on the button', function() {

packages/compass-aggregations/src/components/stage-editor-toolbar/add-after-stage.tsx

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useCallback } from 'react';
22
import { connect } from 'react-redux';
33

4-
import { IconButton, Icon, Tooltip } from '@mongodb-js/compass-components';
4+
import { IconButton, Icon } from '@mongodb-js/compass-components';
55

66
import { addStage } from '../../modules/pipeline-builder/stage-editor';
77

@@ -26,20 +26,12 @@ export function AddAfterStage({
2626
}, [ onAddStageClick, index ]);
2727

2828
return (
29-
<Tooltip
30-
trigger={({ children, ...props }) => (
31-
<div {...props}>
32-
<IconButton
33-
data-testid="add-after-stage"
34-
onClick={onStageAddedAfter}
35-
aria-label="Add stage below"
36-
><Icon glyph="Plus" size="small" /></IconButton>
37-
{children}
38-
</div>
39-
)}
40-
>
41-
Add stage below
42-
</Tooltip>
29+
<IconButton
30+
data-testid="add-after-stage"
31+
onClick={onStageAddedAfter}
32+
title="Add stage below"
33+
aria-label="Add stage below"
34+
><Icon glyph="Plus" size="small" /></IconButton>
4335
);
4436
}
4537

packages/compass-aggregations/src/components/stage-editor-toolbar/stage-editor-toolbar.tsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ const toolbarStyles = css({
7575
cursor: 'grab'
7676
});
7777

78+
const collapsedToolbarStyles = css({
79+
borderBottomWidth: 0,
80+
});
81+
7882
const toolbarStylesDark = css({
7983
borderBottomColor: palette.gray.dark2
8084
});
@@ -99,19 +103,21 @@ const rightStyles = css({
99103
});
100104

101105
type StageEditorToolbarProps = {
102-
stageOperator?: string | null,
103-
index: number
104-
isAutoPreviewing?: boolean,
105-
hasSyntaxError?: boolean
106-
hasServerError?: boolean
106+
stageOperator?: string | null;
107+
index: number;
108+
isAutoPreviewing?: boolean;
109+
hasSyntaxError?: boolean;
110+
hasServerError?: boolean;
111+
isCollapsed?: boolean;
107112
};
108113

109114
function StageEditorToolbar({
110115
stageOperator,
111116
index,
112117
isAutoPreviewing,
113118
hasSyntaxError,
114-
hasServerError
119+
hasServerError,
120+
isCollapsed,
115121
}: StageEditorToolbarProps) {
116122
const darkMode = useDarkMode();
117123

@@ -122,7 +128,8 @@ function StageEditorToolbar({
122128
toolbarStyles,
123129
darkMode ? toolbarStylesDark : toolbarStylesLight,
124130
hasSyntaxError && toolbarWarningStyles,
125-
hasServerError && toolbarErrorStyles
131+
hasServerError && toolbarErrorStyles,
132+
isCollapsed && collapsedToolbarStyles,
126133
)}>
127134
<StageCollapser index={index} />
128135
<StageOperatorSelect index={index} />
@@ -147,5 +154,6 @@ export default connect((state: RootState, ownProps: { index: number}) => {
147154
isAutoPreviewing: !!state.autoPreview,
148155
hasSyntaxError: hasSyntaxError(stage),
149156
hasServerError: !!stage.serverError,
157+
isCollapsed: stage.collapsed,
150158
};
151159
})(StageEditorToolbar);

packages/compass-aggregations/src/components/stage-editor-toolbar/stage-operator-select.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const dropdownWidth = stageNameWidth + descriptionWidth;
1919

2020
const inputHeight = spacing[4] - 2; // match other xs controls
2121
const comboboxStyles = css({
22-
marginLeft: spacing[2],
22+
marginLeft: spacing[1],
2323
marginRight: spacing[2],
2424
width: inputWidth,
2525
'& [role="combobox"]': {

packages/compass-aggregations/src/components/stage-editor-toolbar/toggle-stage.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export class ToggleStage extends PureComponent {
3939
id="toggle-stage-button"
4040
checked={this.props.isEnabled}
4141
onChange={this.onStageToggled}
42+
title={TOOLTIP}
4243
aria-label={TOOLTIP}
4344
size="xsmall"
4445
className={toggleStyle}

packages/compass-aggregations/src/components/stage-preview-toolbar/stage-preview-toolbar.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ const toolbarStyles = css({
2222
borderBottomStyle: 'solid',
2323
});
2424

25+
const collapsedToolbarStyles = css({
26+
borderBottomWidth: 0,
27+
});
2528

2629
const toolbarStylesDark = css({
2730
borderBottomColor: palette.gray.dark2
@@ -103,6 +106,7 @@ type StagePreviewToolbarProps = {
103106
description?: string;
104107
link?: string;
105108
destination?: string;
109+
isCollapsed?: boolean;
106110
};
107111

108112
function StagePreviewToolbar({
@@ -113,7 +117,8 @@ function StagePreviewToolbar({
113117
previewSize,
114118
description,
115119
link,
116-
destination
120+
destination,
121+
isCollapsed,
117122
}: StagePreviewToolbarProps) {
118123
const darkMode = useDarkMode();
119124

@@ -123,7 +128,8 @@ function StagePreviewToolbar({
123128
toolbarStyles,
124129
darkMode ? toolbarStylesDark : toolbarStylesLight,
125130
hasSyntaxError && toolbarWarningStyles,
126-
hasServerError && toolbarErrorStyles
131+
hasServerError && toolbarErrorStyles,
132+
isCollapsed && collapsedToolbarStyles,
127133
)}
128134
>
129135
{isEnabled ? (
@@ -162,6 +168,7 @@ export default connect((state: RootState, ownProps: { index: number }) => {
162168
hasServerError: !!stage.serverError,
163169
isEnabled: !stage.disabled,
164170
previewSize: stage.previewDocs?.length ?? 0,
171+
isCollapsed: stage.collapsed,
165172
...stageInfo
166173
};
167174
})(StagePreviewToolbar);

packages/compass-aggregations/src/components/stage-preview.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -194,16 +194,8 @@ function EmptyIcon() {
194194
const darkMode = useDarkMode();
195195

196196
return (<div className={cx(emptyStyles, darkMode ? emptyStylesDark : emptyStylesLight)}>
197-
<div>
198-
<svg width="44" height="60" viewBox="0 0 44 60" fill="none" xmlns="http://www.w3.org/2000/svg">
199-
<path d="M21.9297 38.2988C23.4783 35.1247 27.7679 30.0989 32.5375 35.3879"/>
200-
<path d="M1 10.7831V51.3133L9.61538 59M1 10.7831L35.4615 1L43 5.19277M1 10.7831L10.1538 15.6747M9.61538 59L43 45.7229C39.9487 34.0763 38 22.5957 43 5.19277M9.61538 59C5.5 34.9362 7.46154 20.3333 10.1538 15.6747M43 5.19277L10.1538 15.6747"/>
201-
<path d="M19.7174 26.7113C19.7734 27.324 19.6719 27.8684 19.4884 28.2491C19.2999 28.6402 19.0726 28.7786 18.9038 28.7941C18.7349 28.8095 18.4862 28.7146 18.2299 28.3642C17.9804 28.0232 17.7818 27.5063 17.7257 26.8935C17.6696 26.2808 17.7711 25.7364 17.9546 25.3557C18.1432 24.9646 18.3704 24.8262 18.5393 24.8107C18.7082 24.7953 18.9568 24.8902 19.2132 25.2406C19.4627 25.5816 19.6613 26.0985 19.7174 26.7113Z" fill="#889397"/>
202-
<path d="M32.481 23.5351C32.5371 24.1479 32.4356 24.6923 32.2521 25.0729C32.0636 25.464 31.8363 25.6025 31.6674 25.6179C31.4985 25.6334 31.2499 25.5385 30.9935 25.1881C30.744 24.847 30.5454 24.3301 30.4894 23.7174C30.4333 23.1046 30.5348 22.5602 30.7183 22.1796C30.9068 21.7885 31.1341 21.65 31.303 21.6346C31.4719 21.6191 31.7205 21.714 31.9769 22.0644C32.2264 22.4055 32.425 22.9224 32.481 23.5351Z" fill="#889397"/>
203-
</svg>
204-
</div>
205197
<Body>
206-
<i data-testid="stage-preview-empty">No Preview Documents</i>
198+
<span data-testid="stage-preview-empty">No Preview Documents</span>
207199
</Body>
208200
</div>);
209201
}
@@ -223,12 +215,11 @@ const documentContainerStyles = css({
223215
flex: 'none',
224216
flexShrink: 0,
225217
width: '384px',
226-
minHeight: '170px',
227218
marginBottom: spacing[2]
228219
});
229220

230221
const documentStyles = css({
231-
flexBasis: '170px',
222+
flexBasis: '164px',
232223
flexGrow: 1,
233224
flexShrink: 0,
234225
overflow: 'auto',

0 commit comments

Comments
 (0)