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

refactor: upgraded frontend-build version to v12 #757

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ec3caef
refactor: upgraded frontend-build version to v12
BilalQamar95 Jul 18, 2022
8cc3401
refactor: updated packages
BilalQamar95 Jul 25, 2022
7a95be1
refactor: resolved eslint issues
BilalQamar95 Jul 25, 2022
43ec4f3
refactor: resolved eslint issues
BilalQamar95 Jul 25, 2022
0ec5c5b
refactor: resolved eslint issues
BilalQamar95 Jul 25, 2022
a7d6641
Merge branch 'master' into bilalqamar95/frontend-build-upgrade
BilalQamar95 Jul 25, 2022
1016b0c
refactor: resolved eslint issues after merge with master
BilalQamar95 Jul 25, 2022
5506d11
Merge branch 'master' into bilalqamar95/frontend-build-upgrade
BilalQamar95 Aug 16, 2022
abd6b49
Merge branch 'master' into bilalqamar95/frontend-build-upgrade
BilalQamar95 Aug 22, 2022
da20787
Merge branch 'master' into bilalqamar95/frontend-build-upgrade
BilalQamar95 Aug 24, 2022
07f2e44
refactor: resolved eslint issues post master merge & updated frontend…
BilalQamar95 Aug 24, 2022
5669840
refactor: pinned frontend-build version & ignored jsx-no-constructed-…
BilalQamar95 Sep 7, 2022
6077f2c
refactor: merged with master branch
BilalQamar95 Sep 7, 2022
2e0acac
refactor: resolved eslint issues after master branch merge
BilalQamar95 Sep 7, 2022
3d91a23
refactor: updated collaborator import
BilalQamar95 Sep 7, 2022
5975167
Merge branch 'master' into bilalqamar95/frontend-build-upgrade
BilalQamar95 Sep 14, 2022
ed64f49
refactor: updated tests to accommodate jsx-no-constructed-context-val…
BilalQamar95 Sep 14, 2022
758c3a3
Merge branch 'master' of https://github.com/openedx/frontend-app-publ…
BilalQamar95 Oct 26, 2022
e02c217
refactor: updated frontend-build & resolved eslint issues
BilalQamar95 Oct 26, 2022
eea82bf
Merge branch 'master' of https://github.com/openedx/frontend-app-publ…
BilalQamar95 Nov 21, 2022
21fb497
refactor: updated package-lock & resolved eslint issues
BilalQamar95 Nov 21, 2022
75e44d4
Merge branch 'master' of https://github.com/openedx/frontend-app-publ…
BilalQamar95 Dec 29, 2022
f308591
refactor: updated package-lock
BilalQamar95 Dec 29, 2022
a47472c
Merge remote-tracking branch 'upstream/master' into bilalqamar95/fron…
BilalQamar95 Jan 11, 2023
0c955df
refactor: updated snapshots
BilalQamar95 Jan 11, 2023
ca9dfea
Merge branch 'master' into bilalqamar95/frontend-build-upgrade
BilalQamar95 Jan 20, 2023
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: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line import/no-extraneous-dependencies
const { createConfig } = require('@edx/frontend-build');

module.exports = createConfig('eslint');
17,206 changes: 8,299 additions & 8,907 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 @@ -63,7 +63,7 @@
},
"devDependencies": {
"@edx/browserslist-config": "^1.1.0",
"@edx/frontend-build": "9.2.2",
"@edx/frontend-build": "12.3.0",
"@edx/stylelint-config-edx": "2.2.0",
"axios": "0.27.2",
"axios-mock-adapter": "1.21.1",
Expand Down
44 changes: 22 additions & 22 deletions src/components/Collaborator/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,28 @@ export const Collaborator = ({
/>
</button>
{ !disabled
// Don't show the edit link at all if fields should be disabled
&& (
<Link
to={{
pathname: `/collaborators/${uuid}`,
state: {
name,
imageUrl,
uuid,
},
}}
className="btn mr-1 p-0"
onClick={() => store.dispatch(sourceInfo(referrer))}
>
<Icon
id={`edit-icon-${uuid}`}
className="fa fa-edit fa-fw"
screenReaderText={`Edit ${name}`}
title="Edit"
/>
</Link>
)}
// Don't show the edit link at all if fields should be disabled
&& (
<Link
to={{
pathname: `/collaborators/${uuid}`,
state: {
name,
imageUrl,
uuid,
},
}}
className="btn mr-1 p-0"
onClick={() => store.dispatch(sourceInfo(referrer))}
>
<Icon
id={`edit-icon-${uuid}`}
className="fa fa-edit fa-fw"
screenReaderText={`Edit ${name}`}
title="Edit"
/>
</Link>
)}
<span className="name font-weight-bold">
{name}
</span>
Expand Down
36 changes: 20 additions & 16 deletions src/components/Collaborator/renderSuggestion.jsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
import React from 'react';
import NewInstructorImage from '../../../assets/new-instructor-80.png';

export default (suggestion) => (
<div className="d-flex flex-row m-1 p-1">
<div className="m-1 p-1 w-25">
<img
src={suggestion.image_url || NewInstructorImage}
alt={`logo for ${suggestion.name}`}
className="w-100"
/>
</div>
<div className="m-1 p-1 w-75">
<div className="m-1 p-1">{suggestion.name}</div>
<div className="m-1 p-1">
{suggestion.item_text && (
function renderSuggestion(suggestion) {
return (
<div className="d-flex flex-row m-1 p-1">
<div className="m-1 p-1 w-25">
<img
src={suggestion.image_url || NewInstructorImage}
alt={`logo for ${suggestion.name}`}
className="w-100"
/>
</div>
<div className="m-1 p-1 w-75">
<div className="m-1 p-1">{suggestion.name}</div>
<div className="m-1 p-1">
{suggestion.item_text && (
<span>{suggestion.item_text}</span>
)}
)}
</div>
</div>
</div>
</div>
);
);
}

export default renderSuggestion;
70 changes: 34 additions & 36 deletions src/components/CourseTable/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,18 @@ class CourseTable extends React.Component {
const pageOptions = getPageOptionsFromUrl();

return (
<>
<div className="row">
<div className="width-percent-44 px-3 float-left">
<Select
closeMenuOnSelect={false}
value={selectedFilters}
options={filterGroups}
onChange={filters => this.updateFilterQueryParamsInUrl(filters === null
? [] : filters)}
isMulti
maxMenuHeight="30vh"
placeholder="Filters..."
styles={
<div className="row">
<div className="width-percent-44 px-3 float-left">
<Select
closeMenuOnSelect={false}
value={selectedFilters}
options={filterGroups}
onChange={filters => this.updateFilterQueryParamsInUrl(filters === null
? [] : filters)}
isMulti
maxMenuHeight="30vh"
placeholder="Filters..."
styles={
{
option: (styles, { data }) => ({ ...styles, ...dot(data.color) }),
multiValue: (styles, { data }) => (
Expand All @@ -159,29 +158,28 @@ class CourseTable extends React.Component {
),
}
}
/>
</div>
<div className="width-percent-44 px-3 float-left">
<SearchField
value={pageOptions.pubq}
onClear={() => {
updateUrl({ filter: null });
}}
onSubmit={(filter) => {
updateUrl({ filter, page: 1 });
}}
placeholder="Search"
/>
</div>
<div className="width-percent-12 px-3 float-right">
<ButtonToolbar className="mb-3" rightJustify>
<Link to="/courses/new">
<button type="button" className="btn btn-primary">New course</button>
</Link>
</ButtonToolbar>
</div>
/>
</div>
</>
<div className="width-percent-44 px-3 float-left">
<SearchField
value={pageOptions.pubq}
onClear={() => {
updateUrl({ filter: null });
}}
onSubmit={(filter) => {
updateUrl({ filter, page: 1 });
}}
placeholder="Search"
/>
</div>
<div className="width-percent-12 px-3 float-right">
<ButtonToolbar className="mb-3" rightJustify>
<Link to="/courses/new">
<button type="button" className="btn btn-primary">New course</button>
</Link>
</ButtonToolbar>
</div>
</div>
);
}

Expand Down Expand Up @@ -261,7 +259,7 @@ CourseTable.defaultProps = {
CourseTable.propTypes = {
fetchOrganizations: PropTypes.func,
publisherUserInfo: PropTypes.shape({
organizations: PropTypes.array,
organizations: PropTypes.arrayOf(PropTypes.shape({})),
error: PropTypes.arrayOf(PropTypes.string),
isFetching: PropTypes.bool,
}),
Expand Down
10 changes: 5 additions & 5 deletions src/components/CreateCoursePage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ class CreateCoursePage extends React.Component {
this.setStartedFetching();
}

setStartedFetching() {
this.setState({ startedFetching: true });
}

handleCourseCreate(options) {
const priceData = formatPriceData(options, this.props.courseOptions);
const courseData = {
Expand All @@ -59,6 +55,10 @@ class CreateCoursePage extends React.Component {
return this.props.createCourse(courseData);
}

setStartedFetching() {
this.setState({ startedFetching: true });
}

showModal(options) {
this.setState({
createCourseData: options,
Expand Down Expand Up @@ -219,7 +219,7 @@ CreateCoursePage.propTypes = {
pacing_type: PropTypes.string,
}),
publisherUserInfo: PropTypes.shape({
organizations: PropTypes.array,
organizations: PropTypes.arrayOf(PropTypes.shape({})),
error: PropTypes.arrayOf(PropTypes.string),
isFetching: PropTypes.bool,
}),
Expand Down
8 changes: 4 additions & 4 deletions src/components/CreateCourseRunPage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ class CreateCourseRunPage extends React.Component {
this.setStartedFetching();
}

setStartedFetching() {
this.setState({ startedFetching: true });
}

handleCourseCreate(options) {
const {
courseInfo: {
Expand Down Expand Up @@ -85,6 +81,10 @@ class CreateCourseRunPage extends React.Component {
return createCourseRun(uuid, courseRunData);
}

setStartedFetching() {
this.setState({ startedFetching: true });
}

parseCourseRunLabels(courseRuns) {
// Sort course runs by descending start dates
const sortedCourseRuns = courseRuns.sort((run1, run2) => moment(run2.start).diff(moment(run1.start)));
Expand Down
4 changes: 2 additions & 2 deletions src/components/EditCoursePage/AdditionalMetadataFields.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import RichEditor from '../RichEditor';
import { utcTimeZone } from '../../utils';
import DateTimeField from '../DateTimeField';

function AdditionalMetadataFields(props) {
const AdditionalMetadataFields = (props) => {
const {
disabled,
} = props;
Expand Down Expand Up @@ -141,7 +141,7 @@ function AdditionalMetadataFields(props) {
</div>
</div>
);
}
};

AdditionalMetadataFields.propTypes = {
disabled: PropTypes.bool,
Expand Down
4 changes: 3 additions & 1 deletion src/components/EditCoursePage/CollapsibleCourseRun.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable react/jsx-no-useless-fragment */
import React from 'react';

import { CopyToClipboard } from 'react-copy-to-clipboard';
Expand Down Expand Up @@ -165,6 +166,7 @@ class CollapsibleCourseRun extends React.Component {
// We initialize hasExternalKey to null and then the function will reevaluate it into
// a boolean which will be our exit state
if (prevState.hasExternalKey === undefined && courseRuns) {
// eslint-disable-next-line react/prop-types
const hasExternalKey = hasMastersTrack(courseRuns[index].run_type, runTypeModes);
this.setState({ hasExternalKey }); // eslint-disable-line react/no-did-update-set-state
}
Expand All @@ -178,7 +180,7 @@ class CollapsibleCourseRun extends React.Component {
setTimeout(() => {
this.setState({ copied: false });
}, 1800);
}
};

scrollToStaffPosition(focus) {
this.setState({
Expand Down
4 changes: 2 additions & 2 deletions src/components/EditCoursePage/CourseButtonToolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React from 'react';
import ActionButton from '../ActionButton';
import ButtonToolbar from '../ButtonToolbar';

function CourseButtonToolbar(props) {
const CourseButtonToolbar = (props) => {
const {
className,
disabled,
Expand Down Expand Up @@ -55,7 +55,7 @@ function CourseButtonToolbar(props) {
/>
</ButtonToolbar>
);
}
};

CourseButtonToolbar.propTypes = {
className: PropTypes.string,
Expand Down
4 changes: 2 additions & 2 deletions src/components/EditCoursePage/CourseRunButtonToolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import CourseRunSubmitButton from './CourseRunSubmitButton';

import { PUBLISHED, UNPUBLISHED } from '../../data/constants';

function CourseRunButtonToolbar(props) {
const CourseRunButtonToolbar = (props) => {
const {
className,
disabled,
Expand Down Expand Up @@ -44,7 +44,7 @@ function CourseRunButtonToolbar(props) {
/>
</ButtonToolbar>
);
}
};

CourseRunButtonToolbar.propTypes = {
className: PropTypes.string,
Expand Down
20 changes: 9 additions & 11 deletions src/components/EditCoursePage/EditCourseForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -495,18 +495,16 @@ export class BaseEditCourseForm extends React.Component {
name="tags"
component={ReduxFormCreatableSelect}
label={(
<>
<FieldLabel
id="tags.label"
text="Topics"
helpText={(
<p>
You can add tags in the format mba-no-gmat,mba,mba_4_modules,mba_NY
</p>
<FieldLabel
id="tags.label"
text="Topics"
helpText={(
<p>
You can add tags in the format mba-no-gmat,mba,mba_4_modules,mba_NY
</p>
)}
optional
/>
</>
optional
/>
)}
disabled={disabled || !administrator}
value={this.state.courseTag}
Expand Down
2 changes: 1 addition & 1 deletion src/components/EditCoursePage/EditCoursePage.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ describe('EditCoursePage', () => {
});

it('submit modal can be cancelled', () => {
const EditCoursePageWrapper = props => (
const EditCoursePageWrapper = (props) => (
<MemoryRouter>
<Provider store={mockStore()}>
<EditCoursePage
Expand Down
Loading