Skip to content

Commit

Permalink
feat: upgrade to ui@5 (TECH-385) (#891)
Browse files Browse the repository at this point in the history
Implements TECH-385

Depends on dhis2/analytics#476

Changes include:

* upgrade from @dhis2/ui-core v4 to @dhis2/ui v5
* add styled-jsx as dependency since @dhis2/ui declares it as a peer dependency (it was already installed due to other dependencies)
* The FilterSelector popover now uses @dhis2/ui instead of material-ui
* margin-bottom added to EditTitleBar to account for some spacing changes between ui4 and ui5
  • Loading branch information
jenniferarnesen authored Jun 16, 2020
1 parent 1ad9b6d commit d551b81
Show file tree
Hide file tree
Showing 44 changed files with 6,732 additions and 2,270 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
"@dhis2/d2-ui-sharing-dialog": "^7.0.4",
"@dhis2/d2-ui-translation-dialog": "^7.0.4",
"@dhis2/data-visualizer-plugin": "^35.2.0",
"@dhis2/ui-core": "^4.21.1",
"@dhis2/ui-widgets": "^5.0.3",
"@dhis2/ui": "^5.0.3",
"@material-ui/core": "^3.9.2",
"@material-ui/icons": "^4.9.1",
"d2": "^31.8.1",
Expand All @@ -34,6 +33,7 @@
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
"reselect": "^4.0.0",
"styled-jsx": "^3.3.0",
"typeface-roboto": "^0.0.75",
"whatwg-fetch": "^3.0.0"
},
Expand Down
8 changes: 2 additions & 6 deletions src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { HashRouter as Router, Route, Switch } from 'react-router-dom';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import i18n from '@dhis2/d2-i18n';
import { HeaderBar } from '@dhis2/ui-widgets';
import { CssVariables } from '@dhis2/ui-core';
import { HeaderBar, CssVariables } from '@dhis2/ui';

import { EDIT, VIEW, NEW } from './Dashboard/dashboardModes';
import { acReceivedUser } from '../actions/user';
Expand Down Expand Up @@ -100,7 +99,4 @@ const mapDispatchToProps = dispatch => {
};
};

export default connect(
null,
mapDispatchToProps
)(App);
export default connect(null, mapDispatchToProps)(App);
2 changes: 1 addition & 1 deletion src/components/ControlBar/ConfirmDeleteDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
ModalActions,
ButtonStrip,
ModalTitle,
} from '@dhis2/ui-core';
} from '@dhis2/ui';

import classes from './styles/ConfirmDeleteDialog.module.css';

Expand Down
2 changes: 1 addition & 1 deletion src/components/ControlBar/ControlBar.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { colors } from '@dhis2/ui-core';
import { colors } from '@dhis2/ui';
import { HEADERBAR_HEIGHT } from './controlBarDimensions';

import classes from './styles/ControlBar.module.css';
Expand Down
2 changes: 1 addition & 1 deletion src/components/ControlBar/DashboardItemChip.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Chip } from '@dhis2/ui-core';
import { Chip } from '@dhis2/ui';
import { Link } from 'react-router-dom';
import debounce from 'lodash/debounce';

Expand Down
7 changes: 2 additions & 5 deletions src/components/ControlBar/EditBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Redirect } from 'react-router-dom';
import i18n from '@dhis2/d2-i18n';
import ControlBar from './ControlBar';
import TranslationDialog from '@dhis2/d2-ui-translation-dialog';
import { Button } from '@dhis2/ui-core';
import { Button } from '@dhis2/ui';

import ConfirmDeleteDialog from './ConfirmDeleteDialog';
import {
Expand Down Expand Up @@ -241,7 +241,4 @@ const mapDispatchToProps = dispatch => ({
onTranslate: (id, value) => dispatch(acSetDashboardDisplayName(id, value)),
});

export default connect(
mapStateToProps,
mapDispatchToProps
)(EditBar);
export default connect(mapStateToProps, mapDispatchToProps)(EditBar);
2 changes: 1 addition & 1 deletion src/components/ControlBar/Filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { withStyles } from '@material-ui/core/styles';
import InputField from '@material-ui/core/Input';
import InputAdornment from '@material-ui/core/InputAdornment';
import SearchIcon from '@material-ui/icons/Search';
import { colors } from '@dhis2/ui-core';
import { colors } from '@dhis2/ui';

import ClearButton from './ClearButton';
import { DEFAULT_STATE_DASHBOARDS_FILTER_NAME } from '../../reducers/dashboardsFilter';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { shallow } from 'enzyme';
import { ButtonStrip } from '@dhis2/ui-core';
import { ButtonStrip } from '@dhis2/ui';
import { ConfirmDeleteDialog } from '../ConfirmDeleteDialog';
import { getStubContext } from '../../../setupTests';

Expand Down
2 changes: 1 addition & 1 deletion src/components/ControlBar/__tests__/ControlBar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { shallow } from 'enzyme';

import ControlBar from '../ControlBar';

jest.mock('@dhis2/ui-core', () => {
jest.mock('@dhis2/ui', () => {
return {
colors: { white: 'white', yellow050: 'yellow' },
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { shallow } from 'enzyme';
import { Chip } from '@dhis2/ui-core';
import { Chip } from '@dhis2/ui';
import { DashboardItemChip } from '../DashboardItemChip';

describe('DashboardItemChip', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/ControlBar/__tests__/EditBar.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { shallow } from 'enzyme';
import { Button } from '@dhis2/ui-core';
import { Button } from '@dhis2/ui';

import { EditBar } from '../EditBar';
import ConfirmDeleteDialog from '../ConfirmDeleteDialog';
Expand Down
2 changes: 1 addition & 1 deletion src/components/FilterBar/FilterBadge.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';

import i18n from '@dhis2/d2-i18n';

import { colors } from '@dhis2/ui-core';
import { colors } from '@dhis2/ui';

const styles = {
badgeContainer: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Item/DeleteItemButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import i18n from '@dhis2/d2-i18n';
import DeleteIcon from '@material-ui/icons/Delete';
import { colors } from '@dhis2/ui-core';
import { colors } from '@dhis2/ui';

import classes from './styles/DeleteItemButton.module.css';

Expand Down
11 changes: 4 additions & 7 deletions src/components/Item/ListItem/Item.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { colors } from '@dhis2/ui-core';
import { colors } from '@dhis2/ui';
import DescriptionIcon from '../../../icons/Description';

import DeleteIcon from '../../../icons/Delete';
Expand Down Expand Up @@ -76,9 +76,6 @@ ListItem.contextTypes = {
d2: PropTypes.object,
};

export default connect(
null,
{
tRemoveListItemContent,
}
)(ListItem);
export default connect(null, {
tRemoveListItemContent,
})(ListItem);
7 changes: 2 additions & 5 deletions src/components/Item/MessagesItem/Item.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import i18n from '@dhis2/d2-i18n';

import { sGetMessagesRoot } from '../../../reducers/messages';
import { formatDate } from '../../../modules/util';
import { colors } from '@dhis2/ui-core';
import { colors } from '@dhis2/ui';
import ItemHeader from '../ItemHeader';
import Line from '../../../widgets/Line';

Expand Down Expand Up @@ -145,9 +145,6 @@ const mapStateToProps = state => {
};
};

const MessagesContainer = connect(
mapStateToProps,
null
)(MessagesItem);
const MessagesContainer = connect(mapStateToProps, null)(MessagesItem);

export default MessagesContainer;
2 changes: 1 addition & 1 deletion src/components/Item/SpacerItem/Item.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import i18n from '@dhis2/d2-i18n';

import { colors } from '@dhis2/ui-core';
import { colors } from '@dhis2/ui';
import ItemHeader from '../ItemHeader';

const style = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Item/VisualizationItem/ItemFooter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { colors } from '@dhis2/ui-core';
import { colors } from '@dhis2/ui';
import { getId } from './plugin';
import InterpretationsComponent from '@dhis2/d2-ui-interpretations';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Item/VisualizationItem/ItemHeaderButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
VIS_TYPE_GAUGE,
VIS_TYPE_PIE,
} from '@dhis2/analytics';
import { Button, Menu, MenuItem, Divider, colors } from '@dhis2/ui-core';
import { Button, Menu, MenuItem, Divider, colors } from '@dhis2/ui';
import i18n from '@dhis2/d2-i18n';
import Popover from '@material-ui/core/Popover';
import TableIcon from '@material-ui/icons/ViewList';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Item/VisualizationItem/LoadingMask.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { CircularLoader } from '@dhis2/ui-core';
import { CircularLoader } from '@dhis2/ui';

import classes from './styles/LoadingMask.module.css';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Item/VisualizationItem/assets/icons.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { colors } from '@dhis2/ui-core';
import { colors } from '@dhis2/ui';

export const ThreeDots = () => (
<svg
Expand Down
2 changes: 1 addition & 1 deletion src/components/ItemFilter/FilterDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
ModalContent,
ModalActions,
ButtonStrip,
} from '@dhis2/ui-core';
} from '@dhis2/ui';

import i18n from '@dhis2/d2-i18n';

Expand Down
Loading

0 comments on commit d551b81

Please sign in to comment.