Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to MUI v5 - rebased from client-deps-2 upgrade #4391

Merged
merged 90 commits into from
Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
d6f16c6
chore(mui v3 update): update mui to v3
ekowidianto Feb 28, 2022
1de108f
chore(group): update mui components for group feature to v3
ekowidianto Feb 28, 2022
289adfb
fix(notification bar): add react memo to replace shouldcomponentupdate
ekowidianto Feb 28, 2022
d90421b
chore(mui v3 update): update mui to v3
ekowidianto Feb 28, 2022
c963243
chore(mui update): update mui to v4
ekowidianto Feb 23, 2022
7465294
chore(mui v4 update): remove black and white color import from mui
ekowidianto Feb 23, 2022
15ffe3f
chore(mui v4 update): update mui theme config
ekowidianto Feb 23, 2022
15f4a0c
chore(mui v4 update): update nativecolor to htmlcolor for mui icons
ekowidianto Feb 23, 2022
67ee55b
chore(mui v4 update): update left margin for mui redux toggle component
ekowidianto Feb 23, 2022
308235f
chore(mui v4 update): update default styles for several mui components
ekowidianto Feb 23, 2022
05b9c73
test(mui v4 update): fix failing frontend tests after mui v4 update
ekowidianto Feb 23, 2022
6333e01
chore(mui v4 update): update slider to use mui v4
ekowidianto Feb 23, 2022
b93026d
fix(video): fix proptypes for captionsstate
ekowidianto Feb 23, 2022
4287524
chore(mui v4 update): update display method for card header props as …
ekowidianto Feb 23, 2022
be31908
chore(mui v4 update): rename expansion panel components to accordion
ekowidianto Feb 23, 2022
b84c465
fix(error props): fix error props type to boolean for mui components
ekowidianto Feb 23, 2022
2c831e7
fix(stepper): add left and right padding to mui step label to make it…
ekowidianto Feb 23, 2022
e6abe7f
fix(single file input): reduce delete button size and update file val…
ekowidianto Feb 25, 2022
ce0d19d
fix(next video button): fix location of next video button
ekowidianto Feb 25, 2022
c2f28a1
chore(mui v4 update): use start and end icon in mui button component
ekowidianto Feb 25, 2022
b4d1274
style: fix testcaseview style
ekowidianto Feb 25, 2022
c301604
style(survey): fix styling for survey after mui v4 update
ekowidianto Feb 25, 2022
85ba7a5
style(lesson plan chip): reduce icon size inside chip avatar
ekowidianto Feb 25, 2022
01c0020
fix(programming question form): fix mui select uncontrolled component…
ekowidianto Feb 25, 2022
f0ab9ea
fix(textarea): fix readonly attribute for textarea
ekowidianto Feb 25, 2022
f247954
fix(proptype): fix proptype warning
ekowidianto Feb 25, 2022
f343465
chore(mui v4 update): use end icon in mui button component in submiss…
ekowidianto Feb 25, 2022
d59484e
style: fix lint
ekowidianto Feb 25, 2022
6e573de
test(frontend): disable failing tests temporarily
ekowidianto Feb 25, 2022
75428f9
test: fix failing tests after mui v4 upgrade
ekowidianto Feb 25, 2022
e33fdc1
fix(provider wrapper): fix syntax error
ekowidianto Feb 28, 2022
c782805
chore(mui v4 update): fix remaining mui v4 component changes
ekowidianto Feb 28, 2022
579a6eb
chore(mui v4 upgrade): update mui autocomplete
ekowidianto Mar 1, 2022
b74589a
chore(mui v4 update): remove mui v0.20 context theme
ekowidianto Mar 2, 2022
687edf5
chore(mui chip input): remove mui chip input and replace with autocom…
ekowidianto Mar 2, 2022
4aa12eb
chore(mui v0.20): remove mui v0.20
ekowidianto Mar 2, 2022
878fa53
fix(autocomplete): add id to autocomplete field in programming questi…
ekowidianto Mar 2, 2022
90817db
test: fix failing and disable some tests
ekowidianto Mar 3, 2022
794834f
fix: remove unused file and rename htmlColor
ekowidianto Mar 3, 2022
533a821
style: rename floatingLabelText to label
ekowidianto Mar 3, 2022
a7e78d7
style: fix some styling
ekowidianto Mar 4, 2022
e1724ed
chore(mui update): update mui to v5
ekowidianto Mar 4, 2022
5ef9567
chore(mui v5 update): run codemod for standard variant prop
ekowidianto Mar 10, 2022
647f03d
chore(mui v5 upgrade): add other required packages
ekowidianto Mar 10, 2022
ec02999
chore(mui v5 upgrade): add mui v5 theme provider
ekowidianto Mar 10, 2022
dd9959d
chore(mui v5 upgrade): update mui color import
ekowidianto Mar 10, 2022
bb51a2c
chore(mui v5 upgrade): update mui appbar component
ekowidianto Mar 10, 2022
1b444d1
chore(mui v5 upgrade): update autocomplete component
ekowidianto Mar 10, 2022
c6c7e6f
chore(mui v5 upgrade): update mui avatar component
ekowidianto Mar 10, 2022
70b40fe
chore(mui v5 upgrade): update mui badge component
ekowidianto Mar 10, 2022
804800f
chore(mui v5 upgrade): update mui chip component
ekowidianto Mar 10, 2022
b41d720
chore(mui v5 upgrade): update mui checkbox component
ekowidianto Mar 10, 2022
9f9b49a
chore(mui v5 upgrade): update mui loading indicator component
ekowidianto Mar 10, 2022
2e34257
chore(mui v5 upgrade): update mui dialog component
ekowidianto Mar 10, 2022
4f16703
chore(mui v5 upgrade): update mui divider component
ekowidianto Mar 10, 2022
c3c67fe
chore(mui v5 upgrade): update mui icon component
ekowidianto Mar 10, 2022
73800a6
chore(mui v5 upgrade): update mui grid and icon components
ekowidianto Mar 10, 2022
634669b
test: fix failing tests for mui v5 related to chip
ekowidianto Mar 10, 2022
a297ce0
chore(mui v5 upgrade): update mui paper component
ekowidianto Mar 10, 2022
41feaf0
chore(mui v5 upgrade): update mui radio component
ekowidianto Mar 10, 2022
fed368f
chore(mui v5 upgrade): update mui slider component
ekowidianto Mar 10, 2022
7737dbc
chore(mui v5 upgrade): update mui snackbar component
ekowidianto Mar 10, 2022
3794e64
chore(mui v5 upgrade): update mui stepper component
ekowidianto Mar 10, 2022
38fea22
chore(mui v5 upgrade): update mui svgicon component
ekowidianto Mar 10, 2022
2d34bfd
fix(mui v5 upgrade): fix appbar color changed when dialog component e…
ekowidianto Mar 10, 2022
bef3f46
test: fix failing tests
ekowidianto Mar 10, 2022
f0ae116
chore(mui v5 upgrade): update mui listsubheader component
ekowidianto Mar 10, 2022
89399b9
chore(mui v5 upgrade): update mui table component
ekowidianto Mar 10, 2022
9336e6e
chore(mui v5 upgrade): update mui card component
ekowidianto Mar 10, 2022
278b047
chore(mui v5 upgrade): update mui accordion component
ekowidianto Mar 11, 2022
36298a3
chore(mui v5 upgrade): update mui tabs component
ekowidianto Mar 11, 2022
3d3ee56
chore(mui v5 upgrade): update mui switch component
ekowidianto Mar 11, 2022
6bf0537
chore(mui v5 upgrade): update mui menu and menu item components
ekowidianto Mar 11, 2022
74e0f9c
chore(mui v5 upgrade): update mui formcontrollabel component
ekowidianto Mar 11, 2022
f3da5b2
chore(mui v5 upgrade): update mui list component
ekowidianto Mar 11, 2022
0099d14
chore(mui v5 upgrade): update mui popover component
ekowidianto Mar 11, 2022
0a5f684
chore(mui v5 upgrade): update mui iconbutton component
ekowidianto Mar 11, 2022
23e0185
chore(mui v5 upgrade): update mui text field component
ekowidianto Mar 11, 2022
af7f1c0
chore(mui v5 upgrade): update mui toolbar and typography components
ekowidianto Mar 11, 2022
e471f8c
chore(mui v5 upgrade): update mui button components
ekowidianto Mar 14, 2022
633edaf
chore(mui v5 upgrade): update mui fab component
ekowidianto Mar 14, 2022
cdb289c
test(mui v5 button): fix failing tests
ekowidianto Mar 14, 2022
4632136
fix(mui v5 upgrade): fix checked for button component in existingpack…
ekowidianto Mar 14, 2022
4773849
chore(mui v5 upgrade): update mui date picker component
ekowidianto Mar 14, 2022
02e072e
chore(mui v5 upgrade): update mui select and related components
ekowidianto Mar 14, 2022
1ef09c0
chore(mui v5 upgrade): remove mui v4
ekowidianto Mar 14, 2022
ab75bb2
test(mui v5 upgrade): disable circleci failing test
ekowidianto Mar 14, 2022
578aded
chore(date io): remove obsolete date io moment lib
ekowidianto Mar 14, 2022
bd52e91
chore(mui v5 upgrade): minor styling fixes
ekowidianto Mar 15, 2022
808e64c
fix(forum post qn): fix view forum and topic buttons location
ekowidianto Mar 25, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions client/app/__test__/setup.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import PropTypes from 'prop-types';
import { IntlProvider, intlShape } from 'react-intl';
import getMuiTheme from 'material-ui/styles/getMuiTheme';

import { createTheme } from '@mui/material/styles';
import Enzyme from 'enzyme';
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';

Expand All @@ -15,8 +14,9 @@ const timeZone = 'Asia/Singapore';
const intlProvider = new IntlProvider({ locale: 'en', timeZone }, {});
const courseId = '1';

const muiTheme = getMuiTheme();
const muiTheme = createTheme();
const intl = intlProvider.getChildContext().intl;

const buildContextOptions = (store) => ({
context: { intl, store, muiTheme },
childContextTypes: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';
import { reduxForm, Field, Form } from 'redux-form';
import ConditionList from 'lib/components/course/ConditionList';
import TextField from 'lib/components/redux-form/TextField';
import renderTextField from 'lib/components/redux-form/TextField';
import RichTextField from 'lib/components/redux-form/RichTextField';
import Toggle from 'lib/components/redux-form/Toggle';
import renderToggleField from 'lib/components/redux-form/Toggle';
import SingleFileInput, {
BadgePreview,
} from 'lib/components/redux-form/SingleFileInput';
Expand Down Expand Up @@ -60,8 +60,8 @@ const AchievementForm = ({
<Field
fullWidth
name="title"
component={TextField}
floatingLabelText={<FormattedMessage {...translations.title} />}
component={renderTextField}
label={<FormattedMessage {...translations.title} />}
disabled={submitting}
/>
<br />
Expand All @@ -82,9 +82,8 @@ const AchievementForm = ({
<Field
name="published"
parse={Boolean}
component={Toggle}
component={renderToggleField}
label={<FormattedMessage {...translations.published} />}
labelPosition="right"
style={styles.toggle}
disabled={submitting}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { submit } from 'redux-form';
import { injectIntl, FormattedMessage, intlShape } from 'react-intl';
import RaisedButton from 'material-ui/RaisedButton';
import { Button } from '@mui/material';
import NotificationBar, {
notificationShape,
} from 'lib/components/NotificationBar';
Expand Down Expand Up @@ -47,13 +47,15 @@ class EditPage extends Component {
initialValues={initialValues}
/>
<div style={styles.buttonContainer}>
<RaisedButton
label={<FormattedMessage {...translations.updateAchievement} />}
primary
<Button
variant="contained"
color="primary"
className="btn-submit"
disabled={this.props.disabled}
onClick={() => dispatch(submit(formNames.ACHIEVEMENT))}
/>
>
<FormattedMessage {...translations.updateAchievement} />
</Button>
</div>
<NotificationBar notification={this.props.notification} />
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ describe('<AchievementIndex />', () => {

const newBtn = indexPage.find('button');
newBtn.simulate('click');
expect(indexPage.find('Dialog').first().props().open).toBe(true);
expect(indexPage.find('ForwardRef(Dialog)').first().props().open).toBe(
true,
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { submit, isPristine } from 'redux-form';
import { injectIntl, FormattedMessage, intlShape } from 'react-intl';
import Dialog from 'material-ui/Dialog';
import RaisedButton from 'material-ui/RaisedButton';
import FlatButton from 'material-ui/FlatButton';
import {
Button,
Dialog,
DialogActions,
DialogContent,
DialogTitle,
} from '@mui/material';
import NotificationBar, {
notificationShape,
} from 'lib/components/NotificationBar';
import ConfirmationDialog from 'lib/components/ConfirmationDialog';
import formTranslations from 'lib/translations/form';
import modalFormStyles from 'lib/styles/ModalForm.scss';
import AchievementForm from '../../containers/AchievementForm';
import * as actions from '../../actions';
import translations from './translations.intl';
Expand Down Expand Up @@ -55,21 +58,23 @@ class PopupDialog extends Component {
const { intl, dispatch, badge } = this.props;

const formActions = [
<FlatButton
label={<FormattedMessage {...formTranslations.cancel} />}
primary
<Button
color="primary"
disabled={this.props.disabled}
onClick={this.handleClose}
key="achievement-popup-dialog-cancel-button"
/>,
<FlatButton
label={<FormattedMessage {...formTranslations.submit} />}
onClick={this.handleClose}
>
<FormattedMessage {...formTranslations.cancel} />
</Button>,
<Button
color="primary"
className="btn-submit"
primary
onClick={() => dispatch(submit(formNames.ACHIEVEMENT))}
disabled={this.props.disabled}
key="achievement-popup-dialog-submit-button"
/>,
onClick={() => dispatch(submit(formNames.ACHIEVEMENT))}
>
<FormattedMessage {...formTranslations.submit} />
</Button>,
];

const initialValues = {
Expand All @@ -79,26 +84,29 @@ class PopupDialog extends Component {

return (
<>
<RaisedButton
label={intl.formatMessage(translations.new)}
primary
<Button
variant="contained"
color="primary"
onClick={this.handleOpen}
style={styles.newButton}
/>
>
{intl.formatMessage(translations.new)}
</Button>
<Dialog
title={intl.formatMessage(translations.newAchievement)}
modal={false}
onClose={this.handleClose}
open={this.props.visible}
actions={formActions}
onRequestClose={this.handleClose}
autoScrollBodyContent
contentStyle={styles.dialog}
bodyClassName={modalFormStyles.modalForm}
maxWidth="xl"
>
<AchievementForm
onSubmit={this.onFormSubmit}
initialValues={initialValues}
/>
<DialogTitle>
{intl.formatMessage(translations.newAchievement)}
</DialogTitle>
<DialogContent>
<AchievementForm
onSubmit={this.onFormSubmit}
initialValues={initialValues}
/>
</DialogContent>
<DialogActions>{formActions}</DialogActions>
</Dialog>
<ConfirmationDialog
confirmDiscard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { defineMessages, FormattedMessage } from 'react-intl';
import { RadioButton, RadioButtonGroup } from 'material-ui/RadioButton';
import { FormControlLabel, Radio, RadioGroup } from '@mui/material';
import { updateLessonPlanSettings } from 'course/admin/actions/lesson-plan-items';
import { initialState as defaultSettings } from 'course/lesson-plan/reducers/flags';

Expand Down Expand Up @@ -59,26 +59,32 @@ class MilestoneGroupSettings extends Component {
<p>
<FormattedMessage {...translations.explanation} />
</p>
<RadioButtonGroup
<RadioGroup
name="milestonesExpanded"
valueSelected={
value={
this.props.milestonesExpanded || defaultSettings.milestonesExpanded
}
onChange={this.handleUpdate}
>
<RadioButton
<FormControlLabel
key="all"
control={<Radio style={{ padding: 0, paddingLeft: 12 }} />}
value="all"
label={<FormattedMessage {...translations.expandAll} />}
/>
<RadioButton
<FormControlLabel
key="none"
control={<Radio style={{ padding: 0, paddingLeft: 12 }} />}
value="none"
label={<FormattedMessage {...translations.expandNone} />}
/>
<RadioButton
<FormControlLabel
key="current"
control={<Radio style={{ padding: 0, paddingLeft: 12 }} />}
value="current"
label={<FormattedMessage {...translations.expandCurrent} />}
/>
</RadioButtonGroup>
</RadioGroup>
</>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ describe('<LessonPlanSettings />', () => {
buildContextOptions(store),
);

const toggles = lessonPlanSettings.find('Toggle');
const toggles = lessonPlanSettings.find('ForwardRef(Switch)');
// Enabled? and Visible? toggles.
expect(toggles).toHaveLength(2);

const toggle = toggles.first();
toggle.props().onToggle(null, true);
toggle.props().onChange(null, true);
const expectedPayload = {
lesson_plan_settings: {
lesson_plan_item_settings: {
Expand Down
Loading