Skip to content

Commit 54fc843

Browse files
committed
ui: upgrade to ant-design v4
* upgrades to antd to v4 * fixes UX problems with date range picker: INSPIR-3203 * reduces bundle size by removing unnecessary icons: INSPIR-3228 * upgrades to [email protected] * upgrades to react-router to v5 Unresolved: * `componentWillReceiveProps` warnings from `react-vis` uber/react-vis#1253 * search name space truncates some options like `conferen...` ant-design/ant-design#21754 * `componentWillMount` warnings from `react-helmet` nfl/react-helmet#413 * `componentWillMount` warnings from `react-loadable` jamiebuilds/react-loadable#220 * `Cannot update a component from inside the function body of a different component.` worning from `antd` ant-design/ant-design#21800
1 parent c0daa3d commit 54fc843

File tree

149 files changed

+1039
-1392
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+1039
-1392
lines changed

e2e/tests/submissions/conference.test.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ describe('conference submissions', () => {
3333
addresses: [
3434
{
3535
city: 'Geneva',
36-
country: 'Switzerland',
36+
// Rest of the options are lazily rendered
37+
country: 'Albania',
3738
},
3839
],
3940
field_of_interest: ['Accelerators'],
@@ -66,8 +67,8 @@ describe('conference submissions', () => {
6667
addresses: [
6768
{
6869
cities: ['Geneva'],
69-
country: 'Switzerland',
70-
country_code: 'CH',
70+
country: 'Albaina',
71+
country_code: 'AL',
7172
},
7273
],
7374
opening_date: startDateMoment.format('YYYY-MM-DD'),
@@ -107,11 +108,11 @@ describe('conference submissions', () => {
107108

108109
await formSubmitter.fill({
109110
name: 'Please come to my conference',
110-
dates: [moment().add(20, 'day'), moment().add(24, 'day')],
111+
dates: [moment().add(1, 'day'), moment().add(7, 'day')],
111112
addresses: [
112113
{
113114
city: 'Stockholm',
114-
country: 'Sweden',
115+
country: 'Albania',
115116
},
116117
],
117118
field_of_interest: ['Computing'],

e2e/utils/form.js

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
/* eslint-disable no-await-in-loop, no-restricted-syntax */
22
const moment = require('moment');
3+
34
const routes = require('./routes');
45
const { selectFromSelectBox, ID_ATTRIBUTE, TYPE_ATTRIBUTE } = require('./dom');
56

67
function joinPaths(...paths) {
78
return paths.filter(path => path != null).join('.');
89
}
910

11+
async function fillDateInputElement(element, dateValue) {
12+
const dateMoment = moment(dateValue);
13+
const formattedDate = dateMoment.format('YYYY-MM-DD');
14+
await element.type(formattedDate);
15+
}
16+
1017
const SUBMIT_BUTTON_SELECTOR = 'button[type=submit]';
1118

1219
class FormSubmitter {
@@ -43,6 +50,7 @@ class FormSubmitter {
4350
}
4451

4552
async fill(data) {
53+
await this.page.waitFor('form');
4654
await this.fillAnyField(null, data);
4755
await this.page.click('form');
4856
}
@@ -63,6 +71,9 @@ class FormSubmitter {
6371
case 'string':
6472
await this.fillNumberOrStringField(path, data);
6573
break;
74+
case 'suggester':
75+
await this.fillSuggesterField(path, data);
76+
break;
6677
case 'single-select':
6778
await this.fillSingleSelectField(path, data);
6879
break;
@@ -142,6 +153,12 @@ class FormSubmitter {
142153
}
143154
}
144155

156+
async fillSuggesterField(path, value) {
157+
const fieldSelector = `[${ID_ATTRIBUTE}="${path}"]`;
158+
const innerInputSelector = `${fieldSelector} input`;
159+
await this.page.type(innerInputSelector, value);
160+
}
161+
145162
async fillNumberOrStringField(path, value) {
146163
const fieldSelector = `[${ID_ATTRIBUTE}="${path}"]`;
147164
await this.page.type(fieldSelector, value);
@@ -157,25 +174,24 @@ class FormSubmitter {
157174
}
158175
}
159176

160-
async selectDateOnActivePicker(date) {
161-
const dateSelector = `[title="${moment(date).format('MMMM D, YYYY')}"]`;
162-
await this.page.waitFor(dateSelector);
163-
await this.page.click(dateSelector);
164-
}
165177

166178
async fillDateField(path, value) {
167179
const fieldSelector = `[${ID_ATTRIBUTE}="${path}"]`;
168-
await this.page.click(fieldSelector);
169-
await this.selectDateOnActivePicker(value);
180+
const fieldElement = await this.page.$(fieldSelector);
181+
await fillDateInputElement(fieldElement, value);
170182
}
171183

172184
async fillDateRangeField(path, [startDate, endDate]) {
173185
const fieldSelector = `[${ID_ATTRIBUTE}="${path}"]`;
174-
await this.page.click(fieldSelector);
175-
await this.selectDateOnActivePicker(startDate);
176-
await this.selectDateOnActivePicker(endDate);
186+
const inputsSelector = `${fieldSelector} input`;
187+
const [startDateElement, endDateElement] = await this.page.$$(inputsSelector);
188+
await fillDateInputElement(startDateElement, startDate);
189+
await fillDateInputElement(endDateElement, endDate);
177190
}
178191

192+
193+
194+
179195
async fillRichTextField(path, value) {
180196
const fieldSelector = `[${ID_ATTRIBUTE}="${path}"] [contenteditable=true]`;
181197
await this.page.type(fieldSelector, value);

ui/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "inspire-next-react",
33
"license": "GPL-2.0",
44
"version": "0.1.19",
5-
"proxy": "localhost:8000",
5+
"proxy": "http://localhost:8000",
66
"bundlesize": [
77
{
88
"path": "./build/**/*.js",
@@ -23,10 +23,11 @@
2323
"./node_modules/eslint/bin/eslint.js ./src --ext .js,.jsx --config .eslintrc"
2424
},
2525
"dependencies": {
26+
"@ant-design/icons": "^4.0.0",
2627
"@babel/runtime": "7.0.0-beta.55",
2728
"@craco/craco": "^3.1.0",
2829
"@sentry/browser": "^4.3.0",
29-
"antd": "^3.4.1",
30+
"antd": "^4.0.0",
3031
"axios": "^0.18.0",
3132
"classnames": "^2.2.6",
3233
"connected-react-router": "^6.4.0",
@@ -58,7 +59,7 @@
5859
"react-piwik": "^1.6.0",
5960
"react-quill": "^1.3.3",
6061
"react-redux": "^6.0.0",
61-
"react-router-dom": "^4.2.2",
62+
"react-router-dom": "^5.1.0",
6263
"react-sanitized-html": "^2.0.0",
6364
"react-scripts": "2.0.3",
6465
"react-vis": "^1.9.2",

ui/src/App.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@
4646
}
4747
}
4848

49-
.mb4-important {
50-
margin-bottom: 4px !important;
51-
}
52-
5349
.secondary-color {
5450
color: $secondary-color;
5551
}
@@ -119,6 +115,10 @@
119115
}
120116
}
121117

118+
.mb2-important {
119+
margin-bottom: 0.5rem !important;
120+
}
121+
122122
.ant-drawer-body {
123123
@media (max-width: $screen-xs-max) {
124124
padding: $drawer-body-padding / 2 !important;

ui/src/authors/components/AuthorEmailsAction.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import { List } from 'immutable';
4-
import { Menu, Icon, Tooltip } from 'antd';
4+
import { MailOutlined } from '@ant-design/icons';
5+
import { Menu, Tooltip } from 'antd';
56

67
import ExternalLink from '../../common/components/ExternalLink';
78
import ActionsDropdownOrAction from '../../common/components/ActionsDropdownOrAction';
@@ -26,7 +27,7 @@ function renderEmailAction(email, title) {
2627

2728
const ACTION_TITLE = (
2829
<Tooltip title="Contact author">
29-
<Icon type="mail" />
30+
<MailOutlined />
3031
</Tooltip>
3132
);
3233

ui/src/authors/components/AuthorLinkedinAction.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { Component } from 'react';
22
import PropTypes from 'prop-types';
3-
import { Icon, Tooltip } from 'antd';
3+
import { LinkedinOutlined } from '@ant-design/icons';
4+
import { Tooltip } from 'antd';
45

56
import ListItemAction from '../../common/components/ListItemAction';
67
import ExternalLink from '../../common/components/ExternalLink';
@@ -13,7 +14,7 @@ class AuthorLinkedinAction extends Component {
1314
<ListItemAction>
1415
<Tooltip title="LinkedIn">
1516
<ExternalLink href={href}>
16-
<Icon type="linkedin" />
17+
<LinkedinOutlined />
1718
</ExternalLink>
1819
</Tooltip>
1920
</ListItemAction>

ui/src/authors/components/AuthorOrcid/AuthorOrcid.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ class AuthorOrcid extends Component {
1010
render() {
1111
const { orcid } = this.props;
1212
return (
13-
<Tooltip title="ORCID">
14-
<OrcidProfileLink className="__AuthorOrcid__" orcid={orcid}>
13+
<OrcidProfileLink className="__AuthorOrcid__" orcid={orcid}>
14+
<Tooltip title="ORCID">
1515
<img src={orcidLogo} alt="ORCID" />
16-
</OrcidProfileLink>
17-
</Tooltip>
16+
</Tooltip>
17+
</OrcidProfileLink>
1818
);
1919
}
2020
}
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`AuthorOrcid renders with orcid 1`] = `
4-
<Tooltip
5-
arrowPointAtCenter={false}
6-
autoAdjustOverflow={true}
7-
mouseEnterDelay={0.1}
8-
mouseLeaveDelay={0.1}
9-
placement="top"
10-
title="ORCID"
11-
transitionName="zoom-big-fast"
4+
<OrcidProfileLink
5+
className="__AuthorOrcid__"
6+
orcid="0000-0001-8058-0014"
127
>
13-
<OrcidProfileLink
14-
className="__AuthorOrcid__"
15-
orcid="0000-0001-8058-0014"
8+
<Tooltip
9+
arrowPointAtCenter={false}
10+
autoAdjustOverflow={true}
11+
mouseEnterDelay={0.1}
12+
mouseLeaveDelay={0.1}
13+
placement="top"
14+
title="ORCID"
15+
transitionName="zoom-big-fast"
1616
>
1717
<img
1818
alt="ORCID"
1919
src="orcid.svg"
2020
/>
21-
</OrcidProfileLink>
22-
</Tooltip>
21+
</Tooltip>
22+
</OrcidProfileLink>
2323
`;

ui/src/authors/components/AuthorTwitterAction.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { Component } from 'react';
22
import PropTypes from 'prop-types';
3-
import { Icon, Tooltip } from 'antd';
3+
import { TwitterOutlined } from '@ant-design/icons';
4+
import { Tooltip } from 'antd';
45

56
import ListItemAction from '../../common/components/ListItemAction';
67
import ExternalLink from '../../common/components/ExternalLink';
@@ -13,7 +14,7 @@ class AuthorTwitterAction extends Component {
1314
<ListItemAction>
1415
<Tooltip title="Twitter">
1516
<ExternalLink href={href}>
16-
<Icon type="twitter" />
17+
<TwitterOutlined />
1718
</ExternalLink>
1819
</Tooltip>
1920
</ListItemAction>

ui/src/authors/components/AuthorWebsitesAction.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import React, { useMemo } from 'react';
22
import PropTypes from 'prop-types';
33
import { List } from 'immutable';
4-
import { Menu, Icon, Tooltip } from 'antd';
4+
import { LinkOutlined } from '@ant-design/icons';
5+
import { Menu, Tooltip } from 'antd';
56

67
import ExternalLink from '../../common/components/ExternalLink';
78
import { removeProtocolAndWwwFromUrl } from '../../common/utils';
@@ -48,7 +49,7 @@ function renderWebsiteAction(website, title) {
4849

4950
const ACTION_TITLE = (
5051
<Tooltip title="Personal website">
51-
<Icon type="link" />
52+
<LinkOutlined />
5253
</Tooltip>
5354
);
5455

0 commit comments

Comments
 (0)