Skip to content

Commit a518ee4

Browse files
committed
ui: upgrade to ant-design v4
INSPIR-3203 * upgrades to antd to v4 * upgrades to react@16.13.10 * 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 d37787f commit a518ee4

File tree

143 files changed

+1003
-1349
lines changed

Some content is hidden

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

143 files changed

+1003
-1349
lines changed

e2e/utils/form.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class FormSubmitter {
4343
}
4444

4545
async fill(data) {
46+
await this.page.waitFor('form');
4647
await this.fillAnyField(null, data);
4748
await this.page.click('form');
4849
}
@@ -63,6 +64,9 @@ class FormSubmitter {
6364
case 'string':
6465
await this.fillNumberOrStringField(path, data);
6566
break;
67+
case 'suggester':
68+
await this.fillSuggesterField(path, data);
69+
break;
6670
case 'single-select':
6771
await this.fillSingleSelectField(path, data);
6872
break;
@@ -142,6 +146,12 @@ class FormSubmitter {
142146
}
143147
}
144148

149+
async fillSuggesterField(path, value) {
150+
const fieldSelector = `[${ID_ATTRIBUTE}="${path}"]`;
151+
const innerInputSelector = `${fieldSelector} input`;
152+
await this.page.type(innerInputSelector, value);
153+
}
154+
145155
async fillNumberOrStringField(path, value) {
146156
const fieldSelector = `[${ID_ATTRIBUTE}="${path}"]`;
147157
await this.page.type(fieldSelector, value);
@@ -158,7 +168,7 @@ class FormSubmitter {
158168
}
159169

160170
async selectDateOnActivePicker(date) {
161-
const dateSelector = `[title="${moment(date).format('MMMM D, YYYY')}"]`;
171+
const dateSelector = `[title="${date}"]`;
162172
await this.page.waitFor(dateSelector);
163173
await this.page.click(dateSelector);
164174
}

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

ui/src/authors/components/UserSettingsAction.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { useCallback, useState } from 'react';
22
import { Button } from 'antd';
3+
import { SettingOutlined } from '@ant-design/icons';
34

45
import ListItemAction from '../../common/components/ListItemAction';
56
import IconText from '../../common/components/IconText';
@@ -18,7 +19,7 @@ function UserSettingsAction() {
1819
<>
1920
<ListItemAction>
2021
<Button onClick={onClick}>
21-
<IconText text="settings" type="setting" />
22+
<IconText text="settings" icon={<SettingOutlined />} />
2223
</Button>
2324
</ListItemAction>
2425
<UserSettingsModal

ui/src/authors/components/__tests__/__snapshots__/AuthorBAI.test.jsx.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ exports[`AuthorBAI renders 1`] = `
55
Author Identifier:
66
77
<Link
8-
replace={false}
98
to="/literature?q=a%20F.Marchetto.1"
109
>
1110
F.Marchetto.1

ui/src/authors/components/__tests__/__snapshots__/AuthorEmailsAction.test.jsx.snap

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ exports[`AuthorEmailsAction renders multiple current emails in a dropdown 1`] =
2020
title="Contact author"
2121
transitionName="zoom-big-fast"
2222
>
23-
<Icon
24-
type="mail"
25-
/>
23+
<ForwardRef(MailOutlined) />
2624
</Tooltip>
2725
</Button>
2826
}
@@ -63,9 +61,7 @@ exports[`AuthorEmailsAction renders single email 1`] = `
6361
title="Contact author"
6462
transitionName="zoom-big-fast"
6563
>
66-
<Icon
67-
type="mail"
68-
/>
64+
<ForwardRef(MailOutlined) />
6965
</Tooltip>
7066
</ExternalLink>
7167
</ListItemAction>

ui/src/authors/components/__tests__/__snapshots__/AuthorLinkedinAction.test.jsx.snap

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ exports[`AuthorLinkedinAction renders with linkedin 1`] = `
1414
<ExternalLink
1515
href="//linkedin.com/in/harunurhan"
1616
>
17-
<Icon
18-
type="linkedin"
19-
/>
17+
<ForwardRef(LinkedinOutlined) />
2018
</ExternalLink>
2119
</Tooltip>
2220
</ListItemAction>

ui/src/authors/components/__tests__/__snapshots__/AuthorResultItem.test.jsx.snap

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ exports[`AuthorResultItem renders full author result 1`] = `
1111
>
1212
<Link
1313
className="f4"
14-
replace={false}
1514
to="/authors/12345"
1615
>
1716
<AuthorName
@@ -71,7 +70,6 @@ exports[`AuthorResultItem renders with only name 1`] = `
7170
>
7271
<Link
7372
className="f4"
74-
replace={false}
7573
to="/authors/12345"
7674
>
7775
<AuthorName

ui/src/authors/components/__tests__/__snapshots__/AuthorTwitterAction.test.jsx.snap

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ exports[`AuthorTwitterAction renders with twitter 1`] = `
1414
<ExternalLink
1515
href="//twitter.com/harunurhan"
1616
>
17-
<Icon
18-
type="twitter"
19-
/>
17+
<ForwardRef(TwitterOutlined) />
2018
</ExternalLink>
2119
</Tooltip>
2220
</ListItemAction>

ui/src/authors/components/__tests__/__snapshots__/AuthorWebsitesAction.test.jsx.snap

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ exports[`AuthorWebsitesAction renders only a url 1`] = `
1414
title="Personal website"
1515
transitionName="zoom-big-fast"
1616
>
17-
<Icon
18-
type="link"
19-
/>
17+
<ForwardRef(LinkOutlined) />
2018
</Tooltip>
2119
</ExternalLink>
2220
</ListItemAction>
@@ -36,9 +34,7 @@ exports[`AuthorWebsitesAction renders only blog 1`] = `
3634
title="Personal website"
3735
transitionName="zoom-big-fast"
3836
>
39-
<Icon
40-
type="link"
41-
/>
37+
<ForwardRef(LinkOutlined) />
4238
</Tooltip>
4339
</ExternalLink>
4440
</ListItemAction>
@@ -64,9 +60,7 @@ exports[`AuthorWebsitesAction renders with a blog and urls in a dropdown 1`] = `
6460
title="Personal website"
6561
transitionName="zoom-big-fast"
6662
>
67-
<Icon
68-
type="link"
69-
/>
63+
<ForwardRef(LinkOutlined) />
7064
</Tooltip>
7165
</Button>
7266
}

ui/src/authors/components/__tests__/__snapshots__/OrcidPushSetting.test.jsx.snap

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,7 @@ exports[`OrcidPushSetting renders when disabled 1`] = `
1212
</span>
1313
<Popconfirm
1414
disabled={false}
15-
icon={
16-
<Icon
17-
theme="filled"
18-
type="exclamation-circle"
19-
/>
20-
}
15+
icon={<ForwardRef(ExclamationCircleFilled) />}
2116
okType="primary"
2217
onConfirm={[Function]}
2318
placement="top"
@@ -66,12 +61,7 @@ exports[`OrcidPushSetting renders when enabled 1`] = `
6661
</span>
6762
<Popconfirm
6863
disabled={false}
69-
icon={
70-
<Icon
71-
theme="filled"
72-
type="exclamation-circle"
73-
/>
74-
}
64+
icon={<ForwardRef(ExclamationCircleFilled) />}
7565
okType="primary"
7666
onConfirm={[Function]}
7767
placement="top"

ui/src/authors/components/__tests__/__snapshots__/UserSettingsAction.test.jsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ exports[`UserSettingsAction renders 1`] = `
1111
onClick={[Function]}
1212
>
1313
<IconText
14+
icon={<ForwardRef(SettingOutlined) />}
1415
text="settings"
15-
type="setting"
1616
/>
1717
</Button>
1818
</ListItemAction>

ui/src/authors/containers/SearchPageContainer.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import LoadingOrChildren from '../../common/components/LoadingOrChildren';
1111
import DocumentHead from '../../common/components/DocumentHead';
1212
import { AUTHORS_NS } from '../../reducers/search';
1313

14-
const META_DESCRIPTION = "Find authors in High Energy Physics"
15-
const TITLE = "Authors Search"
14+
const META_DESCRIPTION = 'Find authors in High Energy Physics';
15+
const TITLE = 'Authors Search';
1616

1717
class SearchPage extends Component {
1818
static renderAuthorItem(result) {
@@ -27,7 +27,7 @@ class SearchPage extends Component {
2727
<Row className="mt3" gutter={32} type="flex" justify="center">
2828
<Col xs={24} lg={16} xl={16} xxl={14}>
2929
<LoadingOrChildren loading={loading}>
30-
<Row type="flex">
30+
<Row>
3131
<Col>
3232
<NumberOfResultsContainer namespace={AUTHORS_NS} />
3333
</Col>

0 commit comments

Comments
 (0)