Skip to content

Commit

Permalink
OpenConceptLab/ocl_issues#986 | updated to React 17 and MUI5
Browse files Browse the repository at this point in the history
* OpenConceptLab/ocl_issues#986 | updated mui theme provider
* OpenConceptLab/ocl_issues#986 | updated mui packages
* OpenConceptLab/ocl_issues#986 | updated mui components
* OpenConceptLab/ocl_issues#986 | removed mui4 and its deps
* OpenConceptLab/ocl_issues#986 | mui5 | theme API update
  • Loading branch information
snyaggarwal committed Oct 11, 2021
1 parent 85380b8 commit 6e2de25
Show file tree
Hide file tree
Showing 185 changed files with 1,472 additions and 748 deletions.
1,126 changes: 853 additions & 273 deletions package-lock.json

Large diffs are not rendered by default.

21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@
"main": "index.js",
"homepage": ".",
"dependencies": {
"@date-io/moment": "^1.3.13",
"@material-ui/core": "^4.12.3",
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.60",
"@material-ui/pickers": "^3.3.10",
"@emotion/react": "^11.4.1",
"@emotion/styled": "^11.3.0",
"@mui/icons-material": "^5.0.3",
"@mui/lab": "^5.0.0-alpha.50",
"@mui/material": "^5.0.3",
"@mui/styles": "^5.0.1",
"alertifyjs": "^1.13.1",
"axios": "^0.21.4",
"core-js": "^3.18.2",
"lodash": "^4.17.21",
"moment": "^2.29.1",
"prop-types": "^15.7.2",
"react": "^16.14.0",
"react": "^17.0.2",
"react-beautiful-dnd": "^13.1.0",
"react-diff-viewer": "^3.1.1",
"react-dom": "^16.14.0",
"react-dom": "^17.0.2",
"react-dropzone": "^11.4.1",
"react-ga": "^3.3.0",
"react-google-recaptcha": "^2.1.0",
Expand All @@ -40,11 +41,11 @@
"eslint": "./node_modules/.bin/eslint ./src"
},
"devDependencies": {
"@babel/core": "^7.15.5",
"@babel/core": "^7.15.8",
"@babel/plugin-proposal-class-properties": "^7.14.5",
"@babel/plugin-proposal-object-rest-spread": "^7.14.7",
"@babel/polyfill": "^7.12.1",
"@babel/preset-env": "^7.15.4",
"@babel/preset-env": "^7.15.8",
"@babel/preset-react": "^7.14.5",
"@babel/runtime": "7.0.0-beta.42",
"babel-eslint": "^10.1.0",
Expand All @@ -67,7 +68,7 @@
"react-is": "^16.13.1",
"sass-loader": "^6.0.6",
"style-loader": "^0.19.1",
"webpack": "^5.57.1",
"webpack": "^5.58.0",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.2"
}
Expand Down
15 changes: 14 additions & 1 deletion src/components/app/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ span.separator-small {

&-header {
margin-left: -1px;
div:first-child {
div:first-of-type {
overflow: auto !important;
}

Expand Down Expand Up @@ -368,6 +368,7 @@ div.login-paper {
}
.material-tab {
text-transform: capitalize;
flex-direction: row;
span {
flex-direction: row;
display: flex;
Expand Down Expand Up @@ -512,6 +513,9 @@ div.login-paper {
}
}
.custom-drawer {
top: 65px;
height: auto;
bottom: 0;
&.large {
width: 75%;
}
Expand Down Expand Up @@ -949,3 +953,12 @@ div.custom-attributes-accordion-content {
border-bottom: none;
}
}

#chip-date-picker {
input#hidden-date-input {
display: none;
}
input#hidden-date-input + div > button {
display: none;
}
}
2 changes: 1 addition & 1 deletion src/components/app/AppVersions.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*eslint no-process-env: 0*/

import React from 'react';
import { Tooltip } from '@material-ui/core';
import { Tooltip } from '@mui/material';
import APIService from '../../services/APIService';
import { isFHIRServer } from '../../common/utils';
import packageJson from '../../../package.json';
Expand Down
4 changes: 2 additions & 2 deletions src/components/app/Footer.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Divider } from '@material-ui/core';
import { Copyright as CopyrightIcon } from '@material-ui/icons';
import { Divider } from '@mui/material';
import { Copyright as CopyrightIcon } from '@mui/icons-material';
import AppVersions from './AppVersions';

const Footer = () => {
Expand Down
21 changes: 13 additions & 8 deletions src/components/app/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import {
AppBar, Toolbar, Typography, Button, Drawer, CssBaseline, List, IconButton,
ListItem, ListItemText, Collapse, ListItemIcon, Tooltip, Paper,
Popper, Grow, ClickAwayListener
} from '@material-ui/core';
} from '@mui/material';
import {
Menu as MenuIcon,
ExpandLess as ExpandLessIcon,
ExpandMore as ExpandMoreIcon,
} from '@material-ui/icons';
import { makeStyles } from '@material-ui/core/styles';
} from '@mui/icons-material';
import makeStyles from '@mui/styles/makeStyles';
import { map, isEmpty, get } from 'lodash';
import {
isAtGlobalSearch, isLoggedIn, isServerSwitched, canSwitchServer, getAppliedServerConfig
Expand Down Expand Up @@ -128,8 +128,13 @@ const Header = props => {
<CssBaseline />
<AppBar
position="fixed"
variant="outlined"
style={{backgroundColor: WHITE, color: BLACK, borderLeft: 'none'}}
style={{
backgroundColor: WHITE,
color: BLACK,
borderLeft: 'none',
borderBottom: '1px solid rgba(0, 0, 0, 0.12)',
boxShadow: 'none'
}}
className={classes.appBar}
>
<Toolbar style={{padding: '0 15px'}}>
Expand All @@ -139,7 +144,7 @@ const Header = props => {
onClick={toggleOpen}
edge="start"
className={classes.menuButton}
>
size="large">
<MenuIcon />
</IconButton>
<Typography variant="h6" className="brand col-sm-1" style={{padding: '0 5px'}}>
Expand Down Expand Up @@ -272,7 +277,7 @@ const Header = props => {
edge="start"
className={open ? classes.menuButton + ' ' + classes.hide : classes.menuButton}
style={{marginLeft: 0}}
>
size="large">
<MenuIcon />
</IconButton>
</div>
Expand Down Expand Up @@ -359,7 +364,7 @@ const Header = props => {

}
</React.Fragment>
)
);
}

export default Header;
2 changes: 1 addition & 1 deletion src/components/app/MenuOptions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
ContactSupport as FAQIcon,
Map as MapIcon,
QuestionAnswer as ContactIcon
} from '@material-ui/icons';
} from '@mui/icons-material';
import OpenMRSLogo from '../common/OpenMRSLogo';

export const SITE_URL = 'https://openconceptlab.org/';
Expand Down
4 changes: 2 additions & 2 deletions src/components/collections/AddReferencesResult.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import MuiAlert from '@material-ui/lab/Alert';
import MuiAlert from '@mui/material/Alert';
import {
Button, Dialog, DialogActions, DialogContent, DialogTitle,
Divider
} from '@material-ui/core'
} from '@mui/material'
import { filter, map, get, isEmpty } from 'lodash';

const ReferencesResult = ({references, severity, title, messageKey}) => (
Expand Down
2 changes: 1 addition & 1 deletion src/components/collections/Collection.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Loyalty as LoyaltyIcon } from '@material-ui/icons'
import { Loyalty as LoyaltyIcon } from '@mui/icons-material'
import { merge, get, isEmpty, map, isArray, reject, includes, keys } from 'lodash'
import { DARKGRAY } from '../../common/constants';
import ResourceLabel from '../common/ResourceLabel';
Expand Down
2 changes: 1 addition & 1 deletion src/components/collections/CollectionHome.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { CircularProgress } from '@material-ui/core';
import { CircularProgress } from '@mui/material';
import { includes, isEmpty, get, findIndex, isEqual, find, isObject } from 'lodash';
import APIService from '../../services/APIService';
import CollectionHomeHeader from './CollectionHomeHeader';
Expand Down
10 changes: 5 additions & 5 deletions src/components/collections/CollectionHomeHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
FileCopy as CopyIcon,
Edit as EditIcon,
Delete as DeleteIcon,
} from '@material-ui/icons';
import { Tooltip, Button, ButtonGroup, Collapse } from '@material-ui/core';
} from '@mui/icons-material';
import { Tooltip, Button, ButtonGroup, Collapse } from '@mui/material';
import { filter, map, get } from 'lodash';
import { toFullAPIURL, copyURL, nonEmptyCount, currentUserHasAccess } from '../../common/utils';
import { GREEN } from '../../common/constants';
Expand Down Expand Up @@ -139,22 +139,22 @@ const CollectionHomeHeader = ({
<span style={{marginLeft: '15px'}}>
<ButtonGroup variant='text' size='large'>
<Tooltip arrow title="Copy URL">
<Button onClick={onIconClick}>
<Button onClick={onIconClick} color='secondary'>
<CopyIcon fontSize="inherit" />
</Button>
</Tooltip>
{
hasAccess && isVersionedObject &&
<Tooltip arrow title='Edit Collection'>
<Button onClick={() => setCollectionForm(true)}>
<Button onClick={() => setCollectionForm(true)} color='secondary'>
<EditIcon fontSize='inherit' />
</Button>
</Tooltip>
}
{
hasAccess && isVersionedObject &&
<Tooltip arrow title='Delete Collection'>
<Button onClick={() => setDeleteDialog(true) }>
<Button onClick={() => setDeleteDialog(true) } color='secondary'>
<DeleteIcon fontSize='inherit' />
</Button>
</Tooltip>
Expand Down
2 changes: 1 addition & 1 deletion src/components/collections/CollectionHomeTabs.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Tabs, Tab } from '@material-ui/core';
import { Tabs, Tab } from '@mui/material';
import { get, reject, includes, map, pickBy, isString, isObject } from 'lodash';
import { GREEN } from '../../common/constants';
import { currentUserHasAccess } from '../../common/utils';
Expand Down
2 changes: 1 addition & 1 deletion src/components/collections/ReferenceForm.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import alertifyjs from 'alertifyjs';
import { Button, Switch, FormControlLabel } from '@material-ui/core';
import { Button, Switch, FormControlLabel } from '@mui/material';
import { set, get, isEmpty, isNumber, isNaN, cloneDeep, pullAt, find, map, compact } from 'lodash';
import APIService from '../../services/APIService';
import { SOURCE_CHILD_URI_REGEX } from '../../common/constants';
Expand Down
8 changes: 4 additions & 4 deletions src/components/collections/ResourceReferenceForm.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { TextField } from '@material-ui/core';
import Autocomplete from '@material-ui/lab/Autocomplete';
import { TextField } from '@mui/material';
import Autocomplete from '@mui/material/Autocomplete';
import { set, map, orderBy, get, includes } from 'lodash';
import MixedOwnersAutocomplete from '../common/MixedOwnersAutocomplete';
import ConceptContainersAutocomplete from '../common/ConceptContainersAutocomplete';
Expand Down Expand Up @@ -112,7 +112,7 @@ class ResourceReferenceForm extends React.Component {
<Autocomplete
blurOnSelect
openOnFocus
getOptionSelected={(option, value) => option.version === get(value, 'version')}
isOptionEqualToValue={(option, value) => option.version === get(value, 'version')}
value={version}
id='version'
options={versions}
Expand Down Expand Up @@ -161,7 +161,7 @@ class ResourceReferenceForm extends React.Component {
</React.Fragment>
}
</div>
)
);
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/components/collections/URLReferenceForm.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react';
import { TextField, IconButton, Button } from '@material-ui/core';
import { Add as AddIcon, Delete as DeleteIcon } from '@material-ui/icons';
import { TextField, IconButton, Button } from '@mui/material';
import { Add as AddIcon, Delete as DeleteIcon } from '@mui/icons-material';
import { map, isNumber } from 'lodash';

const URLReferenceForm = ({expressions, onAdd, onChange, onBlur, onDelete}) => {
return (
<div className='col-md-12 no-side-padding'>
<div className='col-md-12 no-side-padding' style={{marginTop: '15px'}}>
<Button onClick={onAdd} startIcon={<AddIcon />} variant='outlined' color='default'>Expression</Button>
<Button onClick={onAdd} startIcon={<AddIcon />} variant='outlined'>Expression</Button>
</div>
{
map(expressions, (expression, index) => {
Expand All @@ -32,15 +32,15 @@ const URLReferenceForm = ({expressions, onAdd, onChange, onBlur, onDelete}) => {
{
index > 0 &&
<div className='col-md-1 no-side-padding'>
<IconButton onClick={() => onDelete(index)}><DeleteIcon fontSize='inherit'/></IconButton>
<IconButton onClick={() => onDelete(index)} size="large"><DeleteIcon fontSize='inherit'/></IconButton>
</div>
}
</div>
)
);
})
}
</div>
)
);
}

export default URLReferenceForm;
5 changes: 3 additions & 2 deletions src/components/common/AccessChip.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React from 'react';
import {
Public as PublicIcon,
Lock as PrivateIcon,
} from '@material-ui/icons';
import { Tooltip, Chip } from '@material-ui/core';
} from '@mui/icons-material';
import { Tooltip, Chip } from '@mui/material';
import { startCase, includes } from 'lodash';

const AccessChip = props => {
Expand All @@ -22,6 +22,7 @@ const AccessChip = props => {
<PublicIcon fontSize='inherit' /> :
<PrivateIcon fontSize='inherit' />
}
style={{backgroundColor: '#e0e0e0'}}
/>
</Tooltip>
</span>
Expand Down
10 changes: 5 additions & 5 deletions src/components/common/AddToCollection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import {
Button, Popper, MenuItem, MenuList, Grow, Paper, ClickAwayListener, Tooltip,
CircularProgress, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle,
FormControlLabel, Checkbox, Divider, TextField, InputAdornment
} from '@material-ui/core'
import MuiAlert from '@material-ui/lab/Alert';
} from '@mui/material'
import MuiAlert from '@mui/material/Alert';
import {
ArrowDropDown as ArrowDropDownIcon,
Loyalty as LoyaltyIcon,
Help as HelpIcon,
Search as SearchIcon,
} from '@material-ui/icons'
} from '@mui/icons-material'
import { map, isEmpty, get, filter, cloneDeep } from 'lodash';
import APIService from '../../services/APIService';
import { getCurrentUserCollections, getCurrentUser } from '../../common/utils';
Expand Down Expand Up @@ -128,13 +128,13 @@ class AddToCollection extends React.Component {
if(iconButton)
return (
<Tooltip arrow title='Add to Collection'>
<Button ref={this.anchorRef} onClick={this.toggleOpen} {...rest}>
<Button ref={this.anchorRef} onClick={this.toggleOpen} {...rest} color='secondary'>
<LoyaltyIcon fontSize='inherit' />
</Button>
</Tooltip>
)
return (
<Button ref={this.anchorRef} onClick={this.toggleOpen} startIcon={<LoyaltyIcon />} endIcon={<ArrowDropDownIcon />} {...rest}>
<Button ref={this.anchorRef} onClick={this.toggleOpen} startIcon={<LoyaltyIcon />} endIcon={<ArrowDropDownIcon />} {...rest} color='secondary'>
Add to Collection
</Button>
)
Expand Down
12 changes: 9 additions & 3 deletions src/components/common/AppsMenu.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { Link } from 'react-router-dom';
import { useLocation } from 'react-router';
import { Apps as AppsIcon , Web as MetadataBrowserIcon, Publish as ImportsIcon } from '@material-ui/icons';
import { Popper, ClickAwayListener, Tooltip, Grow, Paper, IconButton, Box, Typography } from '@material-ui/core';
import { Apps as AppsIcon , Web as MetadataBrowserIcon, Publish as ImportsIcon } from '@mui/icons-material';
import { Popper, ClickAwayListener, Tooltip, Grow, Paper, IconButton, Box, Typography } from '@mui/material';
import useToggle from '../../hooks/useToggle';
import OpenMRSLogo from '../common/OpenMRSLogo';
import { getOpenMRSURL } from '../../common/utils';
Expand All @@ -21,7 +21,13 @@ const AppsMenu = () => {
return (
<React.Fragment>
<Tooltip arrow title="Apps menu">
<IconButton className={open.value ? "app-menu-toggle selected" : "app-menu-toggle"} style={{marginRight:"5px"}} touch='true' onClick={open.toggle} ref={anchorRef}>
<IconButton
className={open.value ? "app-menu-toggle selected" : "app-menu-toggle"}
style={{marginRight:"5px"}}
touch='true'
onClick={open.toggle}
ref={anchorRef}
size="large">
<AppsIcon/>
</IconButton>
</Tooltip>
Expand Down

0 comments on commit 6e2de25

Please sign in to comment.