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

Revert "Upgraded frontend-build version to v12" #624

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-extraneous-dependencies
const { createConfig } = require('@edx/frontend-build');

module.exports = createConfig('eslint');
8,673 changes: 5,086 additions & 3,587 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
},
"devDependencies": {
"@edx/browserslist-config": "^1.1.0",
"@edx/frontend-build": "^12.0.3",
"@edx/frontend-build": "9.1.2",
"@edx/reactifex": "^1.0.3",
"@testing-library/jest-dom": "5.15.1",
"@testing-library/react": "12.1.5",
Expand Down
35 changes: 25 additions & 10 deletions src/account-settings/AccountSettingsPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,28 @@ class AccountSettingsPage extends React.Component {
})),
}));

sortDates = (a, b) => {
const aTimeSinceEpoch = new Date(a).getTime();
const bTimeSinceEpoch = new Date(b).getTime();

return bTimeSinceEpoch - aTimeSinceEpoch;
}

sortVerifiedNameRecords = verifiedNameHistory => {
if (Array.isArray(verifiedNameHistory)) {
return [...verifiedNameHistory].sort(this.sortDates);
}

return [];
}

handleEditableFieldChange = (name, value) => {
this.props.updateDraft(name, value);
};
}

handleSubmit = (formId, values) => {
this.props.saveSettings(formId, values);
};
}

handleSubmitProfileName = (formId, values) => {
if (Object.keys(this.props.drafts).includes('useVerifiedNameForCerts')) {
Expand Down Expand Up @@ -182,7 +197,7 @@ class AccountSettingsPage extends React.Component {
} else {
this.props.saveSettings(formId, values);
}
};
}

isEditable(fieldName) {
return !this.props.staticFields.includes(fieldName);
Expand Down Expand Up @@ -267,7 +282,7 @@ class AccountSettingsPage extends React.Component {
}

return this.props.intl.formatMessage(messages[messageString]);
};
}

renderVerifiedNameSuccessMessage = (verifiedName, created) => {
const dateValue = new Date(created).valueOf();
Expand All @@ -282,7 +297,7 @@ class AccountSettingsPage extends React.Component {
body={this.props.intl.formatMessage(messages['account.settings.field.name.verified.success.message'])}
/>
);
};
}

renderVerifiedNameFailureMessage = (verifiedName, created) => {
const dateValue = new Date(created).valueOf();
Expand Down Expand Up @@ -313,7 +328,7 @@ class AccountSettingsPage extends React.Component {
}
/>
);
};
}

renderVerifiedNameSubmittedMessage = (willCertNameChange) => (
<Alert
Expand All @@ -331,7 +346,7 @@ class AccountSettingsPage extends React.Component {
}
</p>
</Alert>
);
)

renderVerifiedNameMessage = verifiedNameRecord => {
const {
Expand Down Expand Up @@ -372,7 +387,7 @@ class AccountSettingsPage extends React.Component {
default:
return null;
}
};
}

renderVerifiedNameIcon = (status) => {
switch (status) {
Expand All @@ -383,7 +398,7 @@ class AccountSettingsPage extends React.Component {
default:
return null;
}
};
}

renderVerifiedNameHelpText = (status, proctoredExamId) => {
let messageStr = 'account.settings.field.name.verified.help.text';
Expand All @@ -408,7 +423,7 @@ class AccountSettingsPage extends React.Component {
}

return this.props.intl.formatMessage(messages[messageStr]);
};
}

renderEmptyStaticFieldMessage() {
if (this.isManagedProfile()) {
Expand Down
2 changes: 1 addition & 1 deletion src/account-settings/EditableField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ function EditableField(props) {
options={inputOptions}
{...others}
/>
{others.children}
<>{others.children}</>
</ValidationFormGroup>
<p>
<StatefulButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function CertificatePreference({
const [modalIsOpen, setModalIsOpen] = useState(false);
const formId = 'useVerifiedNameForCerts';

const handleCheckboxChange = () => {
function handleCheckboxChange() {
if (!checked) {
if (fieldName === 'verified_name') {
dispatch(updateDraft(formId, true));
Expand All @@ -44,30 +44,30 @@ function CertificatePreference({
} else {
setModalIsOpen(true);
}
};
}

const handleCancel = () => {
function handleCancel() {
setModalIsOpen(false);
dispatch(resetDrafts());
};
}

const handleModalChange = (e) => {
function handleModalChange(e) {
if (e.target.value === 'fullName') {
dispatch(updateDraft(formId, false));
} else {
dispatch(updateDraft(formId, true));
}
};
}

const handleSubmit = (e) => {
function handleSubmit(e) {
e.preventDefault();

if (saveState === 'pending') {
return;
}

dispatch(saveSettings(formId, useVerifiedNameForCerts));
};
}

useEffect(() => {
if (originalVerifiedName) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-import-assign */
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
Expand Down
78 changes: 38 additions & 40 deletions src/account-settings/coaching/CoachingConsent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,27 @@ import LogoSVG from '../../logo.svg';
import { fetchSettings } from '../data/actions';
import { coachingConsentPageSelector } from '../data/selectors';

function Logo({ src, alt, ...attributes }) {
return <img src={src} alt={alt} {...attributes} />;
}
const Logo = ({ src, alt, ...attributes }) => (
<>
<img src={src} alt={alt} {...attributes} />
</>
);

function SuccessMessage(props) {
return (
<div className="col-12 col-lg-6 shadow-lg mx-auto mt-4 p-5">
<FontAwesomeIcon className="text-success" icon={faCheck} size="5x" />
<div className="h3">{props.header}</div>
<div>{props.message}</div>
<Hyperlink destination={props.continueUrl} className="d-block p-2 my-3 text-center text-white bg-primary rounded">
{props.continue}
</Hyperlink>
</div>
);
}
const SuccessMessage = props => (
<div className="col-12 col-lg-6 shadow-lg mx-auto mt-4 p-5">
<FontAwesomeIcon className="text-success" icon={faCheck} size="5x" />
<div className="h3">{props.header}</div>
<div>{props.message}</div>
<Hyperlink destination={props.continueUrl} className="d-block p-2 my-3 text-center text-white bg-primary rounded">
{props.continue}
</Hyperlink>
</div>
);

function AutoRedirect(props) {
const AutoRedirect = (props) => {
window.location.href = props.redirectUrl;
// eslint-disable-next-line react/jsx-no-useless-fragment
return <></>;
}
};

const VIEWS = {
NOT_LOADED: 'NOT_LOADED',
Expand Down Expand Up @@ -72,23 +71,6 @@ class CoachingConsent extends React.Component {
this.props.fetchSettings();
}

handleSubmit(e) {
e.preventDefault();
const fullName = e.target.fullName.value;
const phoneNumber = e.target.phoneNumber.value;
const body = {
coaching_consent: true,
consent_form_seen: true,
phone_number: phoneNumber,
full_name: fullName,
};
this.setState({
formErrors: {},
formSubmitted: true,
declineSubmitted: false,
}, () => this.patchUsingCoachingConsentForm(body));
}

sanitizeForwardingUrl(url) {
// Redirect to root of MFE if invalid next param is sent
return url && url.startsWith(getConfig().LMS_BASE_URL) ? url : `${getConfig().LMS_BASE_URL}/dashboard/`;
Expand Down Expand Up @@ -117,6 +99,23 @@ class CoachingConsent extends React.Component {
}
}

handleSubmit(e) {
e.preventDefault();
const fullName = e.target.fullName.value;
const phoneNumber = e.target.phoneNumber.value;
const body = {
coaching_consent: true,
consent_form_seen: true,
phone_number: phoneNumber,
full_name: fullName,
};
this.setState({
formErrors: {},
formSubmitted: true,
declineSubmitted: false,
}, () => this.patchUsingCoachingConsentForm(body));
}

declineCoaching(e) {
e.preventDefault();
const body = {
Expand Down Expand Up @@ -161,7 +160,6 @@ class CoachingConsent extends React.Component {
case VIEWS.DECLINED:
return <AutoRedirect redirectUrl={this.state.redirectUrl} />;
default:
// eslint-disable-next-line react/jsx-no-useless-fragment
return <></>;
}
}
Expand Down Expand Up @@ -255,12 +253,12 @@ CoachingConsent.propTypes = {
}),
}).isRequired,
formErrors: PropTypes.shape({
coaching: PropTypes.shape({}),
coaching: PropTypes.object,
}).isRequired,
confirmationValues: PropTypes.shape({
coaching: PropTypes.shape({}),
name: PropTypes.shape({}),
phone_number: PropTypes.shape({}),
coaching: PropTypes.object,
name: PropTypes.object,
phone_number: PropTypes.object,
}).isRequired,
fetchSettings: PropTypes.func.isRequired,
profileDataManager: PropTypes.string,
Expand Down
Loading