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

feat: update react & react-dom to v17 #758

Merged
merged 19 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
5721eee
Merge branch 'master' of https://github.com/openedx/frontend-app-lear…
BilalQamar95 Jun 9, 2023
e1ca7ae
feat: update react & react-dom to v17
BilalQamar95 Jun 9, 2023
3cc7a09
Merge branch 'master' into bilalqamar95/react-upgrade-to-v17
Mashal-m Jun 14, 2023
256cd7f
Merge branch 'master' into bilalqamar95/react-upgrade-to-v17
Mashal-m Jun 14, 2023
f48f01e
build: update paragon
Jun 15, 2023
317f51c
Merge branch 'bilalqamar95/react-upgrade-to-v17' of https://github.co…
BilalQamar95 Jun 21, 2023
d32e66b
feat: replaced react-truncate with react-lines-ellipsis, updated code…
BilalQamar95 Jun 22, 2023
1814bfb
refactor: updated snapshot and fixed eslint issues
BilalQamar95 Jun 22, 2023
0879e8b
refactor: updated failing tests
BilalQamar95 Jun 22, 2023
0298012
refactor: updated tests for SearchProgramCard
BilalQamar95 Jun 23, 2023
d83c560
Merge branch 'master' of https://github.com/openedx/frontend-app-lear…
BilalQamar95 Jul 21, 2023
05c6acb
refactor: bumped enterprise, react-fontawesome & react-helmet
BilalQamar95 Jul 21, 2023
0a8b415
refactor: pinned frontend-build version to 12.8.60
BilalQamar95 Jul 24, 2023
05ed202
Merge branch 'master' of https://github.com/openedx/frontend-app-lear…
BilalQamar95 Aug 3, 2023
0e72817
Merge branch 'master' of https://github.com/openedx/frontend-app-lear…
BilalQamar95 Aug 15, 2023
000fd17
feat: replaced react-lines-ellipsis with paragon truncate, updated te…
BilalQamar95 Aug 24, 2023
0acf360
Merge branch 'master' of https://github.com/openedx/frontend-app-lear…
BilalQamar95 Aug 24, 2023
713d89f
Merge branch 'master' of https://github.com/openedx/frontend-app-lear…
BilalQamar95 Sep 11, 2023
1f74a39
Merge branch 'master' of https://github.com/openedx/frontend-app-lear…
BilalQamar95 Oct 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7,119 changes: 3,889 additions & 3,230 deletions package-lock.json

Large diffs are not rendered by default.

23 changes: 11 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
],
"dependencies": {
"@edx/brand": "npm:@edx/brand-openedx@1.2.0",
"@edx/frontend-component-footer": "12.0.0",
"@edx/frontend-component-footer": "12.1.2",
"@edx/frontend-enterprise-catalog-search": "4.7.0",
"@edx/frontend-enterprise-hotjar": "1.3.0",
"@edx/frontend-enterprise-logistration": "3.0.0",
"@edx/frontend-enterprise-utils": "3.0.0",
"@edx/frontend-enterprise-hotjar": "1.4.0",
"@edx/frontend-enterprise-logistration": "3.4.0",
"@edx/frontend-enterprise-utils": "3.4.0",
"@edx/frontend-platform": "4.6.3",
"@edx/paragon": "21.1.6",
"@edx/paragon": "20.45.4",
"@tanstack/react-query": "4.28.0",
"@tanstack/react-query-devtools": "4.29.0",
"algoliasearch": "4.6.0",
Expand All @@ -36,10 +36,10 @@
"lodash.isnil": "4.0.0",
"plotly.js-dist": "2.17.0",
"prop-types": "15.7.2",
"react": "16.14.0",
"react-dom": "16.14.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-fullstory": "1.4.0",
"react-helmet": "5.2.1",
"react-helmet": "6.1.0",
"react-instantsearch-dom": "6.38.1",
"react-parallax": "3.3.0",
"react-redux": "7.2.2",
Expand All @@ -49,7 +49,6 @@
"react-scroll": "1.8.4",
"react-string-replace": "1.1.0",
"react-transition-group": "4.4.1",
"react-truncate": "2.4.0",
"redux": "4.0.5",
"reselect": "4.0.0",
"start": "5.1.0",
Expand All @@ -63,17 +62,17 @@
"@edx/frontend-build": "12.9.4",
"@tanstack/eslint-plugin-query": "4.29.9",
"@testing-library/jest-dom": "5.11.9",
"@testing-library/react": "11.2.7",
"@testing-library/react": "12.1.5",
"@testing-library/react-hooks": "3.7.0",
"@testing-library/user-event": "13.5.0",
"@wojtekmaj/enzyme-adapter-react-17": "0.8.0",
"acorn": "8.5.0",
"axios-mock-adapter": "1.19.0",
"enzyme": "3.11.0",
"enzyme-adapter-react-16": "1.15.6",
"jest-canvas-mock": "^2.4.0",
"match-media-mock": "0.1.1",
"prettier": "2.2.1",
"react-test-renderer": "16.14.0",
"react-test-renderer": "17.0.2",
"resize-observer-polyfill": "^1.5.1"
},
"keywords": [],
Expand Down
11 changes: 3 additions & 8 deletions src/components/course/CourseRecommendationCard.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React, { useContext, useMemo } from 'react';
import PropTypes from 'prop-types';
import Truncate from 'react-truncate';
import { useHistory } from 'react-router-dom';
import { AppContext } from '@edx/frontend-platform/react';
import { Card } from '@edx/paragon';
import { Card, Truncate } from '@edx/paragon';
import { sendEnterpriseTrackEvent } from '@edx/frontend-enterprise-utils';

import { getPrimaryPartnerLogo, isDefinedAndNotNull } from '../../utils/common';
Expand Down Expand Up @@ -60,15 +59,11 @@ const CourseRecommendationCard = ({ course, isPartnerRecommendation }) => {

<Card.Header
title={(
<Truncate lines={3} trimWhitespace>
{course.title}
</Truncate>
<Truncate maxLine={3}>{course.title}</Truncate>
)}
subtitle={course.owners?.length > 0 && (
<p className="partner">
<Truncate lines={1} trimWhitespace>
{course.owners.map(partner => partner.name).join(', ')}
</Truncate>
<Truncate maxLine={1}>{course.owners.map(partner => partner.name).join(', ')}</Truncate>
</p>
)}
/>
Expand Down
5 changes: 0 additions & 5 deletions src/components/course/tests/CourseRecommendationCard.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ jest.mock('@edx/frontend-enterprise-utils', () => ({
sendEnterpriseTrackEvent: jest.fn(),
}));

jest.mock('react-truncate', () => ({
__esModule: true,
default: ({ children }) => children,
}));

const TEST_UUID = '1234053423-4212-21323-45fdf';
const initialAppState = {
enterpriseConfig: {
Expand Down
5 changes: 0 additions & 5 deletions src/components/course/tests/CourseRecommendations.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ jest.mock('@edx/frontend-enterprise-utils', () => ({
hasFeatureFlagEnabled: jest.fn(),
}));

jest.mock('react-truncate', () => ({
__esModule: true,
default: ({ children }) => children,
}));

const TEST_UUID = '1234053423-4212-21323-45fdf';
const initialAppState = {
enterpriseConfig: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ jest.mock('@edx/frontend-enterprise-utils', () => ({
sendEnterpriseTrackEvent: jest.fn(),
}));

jest.mock('react-truncate', () => ({
__esModule: true,
default: ({ children }) => children,
}));

// eslint-disable-next-line no-console
console.error = jest.fn();

Expand Down
7 changes: 2 additions & 5 deletions src/components/pathway-progress/PathwayProgressCard.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useContext } from 'react';
import { Card } from '@edx/paragon';
import Truncate from 'react-truncate';
import { Card, Truncate } from '@edx/paragon';
import PropTypes from 'prop-types';
import { useHistory } from 'react-router-dom';
import { AppContext } from '@edx/frontend-platform/react';
Expand Down Expand Up @@ -28,9 +27,7 @@ const PathwayProgressCard = ({ pathway: { learnerPathwayProgress } }) => {
/>
<Card.Header
title={(
<Truncate lines={2} trimWhitespace>
{learnerPathwayProgress.title}
</Truncate>
<Truncate maxLine={2}>{learnerPathwayProgress.title}</Truncate>
)}
/>
<Card.Section />
Expand Down
9 changes: 4 additions & 5 deletions src/components/pathway/SearchPathwayCard.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React, { useContext, useMemo } from 'react';
import PropTypes from 'prop-types';
import Truncate from 'react-truncate';
import { useHistory } from 'react-router-dom';
import { AppContext } from '@edx/frontend-platform/react';
import { getConfig } from '@edx/frontend-platform/config';
import { camelCaseObject } from '@edx/frontend-platform/utils';
import { Badge, Card, Stack } from '@edx/paragon';
import {
Badge, Card, Stack, Truncate,
} from '@edx/paragon';
import { sendEnterpriseTrackEvent } from '@edx/frontend-enterprise-utils';

import {
Expand Down Expand Up @@ -111,9 +112,7 @@ const SearchPathwayCard = ({
/>
<Card.Header
title={(
<Truncate lines={3} trimWhitespace>
{pathway.title}
</Truncate>
<Truncate maxLine={3}>{pathway.title}</Truncate>
)}
/>
<Card.Section>
Expand Down
5 changes: 0 additions & 5 deletions src/components/pathway/tests/SearchPathwayCard.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ import { TEST_ENTERPRISE_SLUG, TEST_ENTERPRISE_UUID } from './constants';
import { PATHWAY_SEARCH_EVENT_NAME, PATHWAY_SKILL_QUIZ_EVENT_NAME } from '../constants';
import { renderWithRouter } from '../../../utils/tests';

jest.mock('react-truncate', () => ({
__esModule: true,
default: ({ children }) => children,
}));

jest.mock('@edx/frontend-enterprise-utils', () => {
const originalModule = jest.requireActual('@edx/frontend-enterprise-utils');
return ({
Expand Down
9 changes: 3 additions & 6 deletions src/components/program-progress/ProgramListingCard.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import {
breakpoints, Card,
breakpoints, Card, Truncate,
} from '@edx/paragon';
import React, { useContext, useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import { useHistory } from 'react-router-dom';

import { AppContext } from '@edx/frontend-platform/react';

import Truncate from 'react-truncate';
import { getProgramIcon } from '../course/data/utils';
import { ProgressCategoryBubbles } from '../progress-category-bubbles';

Expand Down Expand Up @@ -70,12 +69,10 @@ const ProgramListingCard = ({ program }) => {

<Card.Header
title={(
<Truncate lines={2} trimWhitespace>
{program.title}
</Truncate>
<Truncate maxLine={2}>{program.title}</Truncate>
)}
subtitle={program.authoringOrganizations?.length > 0 ? (
<Truncate lines={2} trimWhitespace>
<Truncate maxLine={2}>
{program.authoringOrganizations.map(org => org.key).join(', ')}
</Truncate>
) : undefined}
Expand Down
9 changes: 3 additions & 6 deletions src/components/search/SearchCourseCard.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React, { useContext, useMemo } from 'react';
import PropTypes from 'prop-types';
import Truncate from 'react-truncate';
import { useHistory } from 'react-router-dom';
import { AppContext } from '@edx/frontend-platform/react';
import { getConfig } from '@edx/frontend-platform/config';
import { camelCaseObject } from '@edx/frontend-platform/utils';
import { Card } from '@edx/paragon';
import { Card, Truncate } from '@edx/paragon';
import { sendEnterpriseTrackEvent } from '@edx/frontend-enterprise-utils';

import { getPrimaryPartnerLogo, isDefinedAndNotNull } from '../../utils/common';
Expand Down Expand Up @@ -107,12 +106,10 @@ const SearchCourseCard = ({
/>
<Card.Header
title={(
<Truncate lines={3} trimWhitespace>
{course.title}
</Truncate>
<Truncate maxLine={3}>{course.title}</Truncate>
)}
subtitle={course.partners?.length > 0 && (
<Truncate lines={2} trimWhitespace>
<Truncate maxLine={2}>
{course.partners.map(partner => partner.name).join(', ')}
</Truncate>
)}
Expand Down
11 changes: 5 additions & 6 deletions src/components/search/SearchProgramCard.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React, { useContext, useMemo } from 'react';
import PropTypes from 'prop-types';
import Truncate from 'react-truncate';
import { useHistory } from 'react-router-dom';
import { AppContext } from '@edx/frontend-platform/react';
import { getAuthenticatedUser } from '@edx/frontend-platform/auth';
import { camelCaseObject } from '@edx/frontend-platform/utils';
import { Badge, Card, Icon } from '@edx/paragon';
import {
Badge, Card, Icon, Truncate,
} from '@edx/paragon';
import { Program } from '@edx/paragon/icons';
import { sendEnterpriseTrackEvent } from '@edx/frontend-enterprise-utils';

Expand Down Expand Up @@ -111,13 +112,11 @@ const SearchProgramCard = ({ hit, isLoading, ...rest }) => {
/>
<Card.Header
title={(
<Truncate lines={3} trimWhitespace>
{program.title}
</Truncate>
<Truncate maxLine={3}>{program.title}</Truncate>
)}
subtitle={
program.authoringOrganizations?.length > 0 && (
<Truncate lines={2} trimWhitespace>
<Truncate maxLine={2}>
{program.authoringOrganizations.map(org => org.key).join(', ')}
</Truncate>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React, { useContext } from 'react';
import PropTypes from 'prop-types';
import Truncate from 'react-truncate';
import { useHistory } from 'react-router-dom';
import { AppContext } from '@edx/frontend-platform/react';
import { Card } from '@edx/paragon';
import { Card, Truncate } from '@edx/paragon';
import { sendEnterpriseTrackEvent } from '@edx/frontend-enterprise-utils';
import cardImageCapFallbackSrc from '@edx/brand/paragon/images/card-imagecap-fallback.png';

Expand Down Expand Up @@ -69,14 +68,10 @@ const HighlightedContentCard = ({
/>
<Card.Header
title={(
<Truncate lines={3} trimWhitespace>
{title}
</Truncate>
<Truncate maxLine={3}>{title}</Truncate>
)}
subtitle={authoringOrganizations?.content && (
<Truncate lines={2} trimWhitespace>
{authoringOrganizations.content}
</Truncate>
<Truncate maxLine={2}>{authoringOrganizations.content}</Truncate>
)}
/>
<Card.Section />
Expand Down
5 changes: 0 additions & 5 deletions src/components/search/tests/SearchCourseCard.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ import * as courseSearchUtils from '../utils';
import { renderWithRouter } from '../../../utils/tests';
import { TEST_ENTERPRISE_SLUG, TEST_IMAGE_URL } from './constants';

jest.mock('react-truncate', () => ({
__esModule: true,
default: ({ children }) => children,
}));

const SearchCourseCardWithAppContext = (props) => (
<AppContext.Provider
value={{
Expand Down
4 changes: 0 additions & 4 deletions src/components/search/tests/SearchProgramCard.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ import { TEST_ENTERPRISE_SLUG } from './constants';

const userId = 'batman';
const enterpriseUuid = '11111111-1111-1111-1111-111111111111';
jest.mock('react-truncate', () => ({
__esModule: true,
default: ({ children }) => children,
}));

jest.mock('@edx/frontend-platform/auth', () => ({
...jest.requireActual('@edx/frontend-platform/auth'),
Expand Down
16 changes: 6 additions & 10 deletions src/components/skills-quiz/CourseCard.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, { useContext, useMemo } from 'react';
import { Badge, Card, Stack } from '@edx/paragon';
import {
Badge, Card, Stack, Truncate,
} from '@edx/paragon';
import { useHistory } from 'react-router-dom';
import Truncate from 'react-truncate';
import { AppContext } from '@edx/frontend-platform/react';
import PropTypes from 'prop-types';
import { getAuthenticatedUser } from '@edx/frontend-platform/auth';
Expand Down Expand Up @@ -62,18 +63,13 @@ const CourseCard = ({
/>
<Card.Header
title={(
<Truncate
lines={course.skillNames?.length < 5 ? 3 : 2}
trimWhitespace
>
<Truncate maxLine={course.skillNames?.length < 5 ? 3 : 2}>
{course.title}
</Truncate>
)}
subtitle={course.partners.length > 0 && (
<Truncate lines={2} trimWhitespace>
{course.partners
.map((partner) => partner.name)
.join(', ')}
<Truncate maxLine={2}>
{course.partners.map((partner) => partner.name).join(', ')}
</Truncate>
)}
/>
Expand Down
7 changes: 3 additions & 4 deletions src/components/skills-quiz/SearchProgramCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ import React, {
} from 'react';
import PropTypes from 'prop-types';
import { v4 as uuidv4 } from 'uuid';
import Truncate from 'react-truncate';
import { useHistory } from 'react-router-dom';
import { AppContext } from '@edx/frontend-platform/react';
import { getAuthenticatedUser } from '@edx/frontend-platform/auth';
import { camelCaseObject } from '@edx/frontend-platform/utils';
import {
Badge, Card, Icon, Alert, CardGrid, Stack,
Badge, Card, Icon, Alert, CardGrid, Stack, Truncate,
} from '@edx/paragon';
import { Program, ZoomOut } from '@edx/paragon/icons';
import { sendEnterpriseTrackEvent } from '@edx/frontend-enterprise-utils';
Expand Down Expand Up @@ -196,12 +195,12 @@ const SearchProgramCard = ({ index }) => {
/>
<Card.Header
title={(
<Truncate lines={3} trimWhitespace>
<Truncate maxLine={3}>
{program.title}
</Truncate>
)}
subtitle={program.authoringOrganizations?.length > 0 && (
<Truncate lines={2} trimWhitespace>
<Truncate maxLine={2}>
{program.authoringOrganizations.map(org => org.key).join(', ')}
</Truncate>
)}
Expand Down
5 changes: 0 additions & 5 deletions src/components/skills-quiz/tests/SearchCourseCard.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ jest.mock('@edx/frontend-enterprise-utils', () => ({
sendEnterpriseTrackEvent: jest.fn(),
}));

jest.mock('react-truncate', () => ({
__esModule: true,
default: ({ children }) => children,
}));

const TEST_COURSE_KEY = 'test-course-key';
const TEST_TITLE = 'Test Title';
const TEST_CARD_IMG_URL = 'https://fake.image';
Expand Down