Skip to content

Commit 762e290

Browse files
awais-ansarimuhammadadeeltajamuleemaanamirsundasnoreen12renovate[bot]
authored
feat: merge 2u-main into master (#1231)
* feat: added country disabling feature (#1084) * feat: added country disabling feature * fix: lint errors * test: added test case for disabled countries * refactor: combined test cases * feat: reskin of Profile MFE main page (#1114) * feat: reskin of Profile MFE main page * feat: reskin of Profile MFE main page * test: updated tests according to the changes * fix: added missing name property * test: updated test snapshot * test: added tests for reducers * feat: moved reskin logic behind env variable * test: updated tests * refactor: refactored code according to requested changes * fix: fixed lint errors * refactor: refactored code according to requested changes * refactor: refactored code according to requested changes * feat: fixed reloading issue * fix: fixed responsiveness issues on mobile view (#1133) * fix: fixed reponsiveness issues on mobile view * test: updated tests * refactor: refactored code as requested * test: added not found test case * test: updated test cases * feat: added restricted country functionality * fix: fixed test cases * test: updated snapshot * test: updated test cases * feat: made profile editable (#1212) * feat: readded editable fields to new profile view * feat: made fullname editable and updated design * test: updated test cases * refactor: refactored code based on reviews * feat: made fullname uneditable and added redirect link (#1215) * feat: made fullname uneditable and added redirect link * refactor: refactored code * refactor: refactored code * chore: rebase 2u-main with master (#1225) * fix(deps): update dependency @edx/frontend-platform to v8.3.3 (#1187) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update dependency core-js to v3.41.0 (#1188) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update `@openedx` dependencies to versions that support React 18 (#1189) * chore(deps): update dependency @openedx/frontend-build to v14.4.1 (#1191) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update react-router monorepo to v6.30.0 (#1192) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat: upgrade react to v18 (#1190) * fix(deps): update dependency @edx/frontend-platform to v8.3.4 (#1195) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update dependency @edx/frontend-component-footer to v14.4.0 (#1196) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update dependency @edx/frontend-component-header to v6.3.0 (#1197) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update dependency @edx/frontend-component-footer to v14.6.0 (#1199) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update dependency @edx/openedx-atlas to ^0.7.0 (#1200) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update dependency @edx/frontend-component-header to v6.4.0 (#1201) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat: import `FooterSlot` from component package instead of slot package (#1198) * chore(deps): update dependency glob to v11.0.2 (#1202) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update dependency @edx/frontend-component-footer to v14.7.0 (#1203) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update dependency @edx/frontend-component-footer to v14.7.1 (#1204) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update dependency core-js to v3.42.0 (#1205) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update dependency @edx/frontend-platform to v8.3.6 (#1207) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update commitlint monorepo to v19.8.1 (#1206) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update dependency @edx/frontend-platform to v8.3.7 (#1209) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update dependency @edx/frontend-component-footer to v14.7.2 (#1213) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update react-router monorepo to v6.30.1 (#1214) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update dependency @edx/frontend-platform to v8.3.9 (#1216) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update dependency @edx/frontend-component-footer to v14.9.0 (#1217) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat!: add design tokens support (#1220) BREAKING CHANGE: Pre-design-tokens theming is no longer supported. Co-authored-by: Diana Olarte <[email protected]> * fix: fixed lint issues --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Brian Smith <[email protected]> Co-authored-by: Hunia Fatima <[email protected]> Co-authored-by: Diana Olarte <[email protected]> Co-authored-by: sundasnoreen12 <[email protected]> * fix: fixed font sizing issue after applying elm theme (#1228) * Revert "fix: fixed font sizing issue after applying elm theme (#1228)" (#1232) This reverts commit a9159f6. --------- Co-authored-by: muhammadadeeltajamul <[email protected]> Co-authored-by: Muhammad Adeel Tajamul <[email protected]> Co-authored-by: Eemaan Amir <[email protected]> Co-authored-by: sundasnoreen12 <[email protected]> Co-authored-by: sundasnoreen12 <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Brian Smith <[email protected]> Co-authored-by: Hunia Fatima <[email protected]> Co-authored-by: Diana Olarte <[email protected]> Co-authored-by: eemaanamir <[email protected]>
1 parent fa7267f commit 762e290

File tree

85 files changed

+11618
-5393
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+11618
-5393
lines changed

.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@ SEARCH_CATALOG_URL=''
3131
ENABLE_SKILLS_BUILDER_PROFILE=''
3232
# Fallback in local style files
3333
PARAGON_THEME_URLS={}
34+
ENABLE_NEW_PROFILE_VIEW=''
35+
DISABLE_VISIBILITY_EDITING=''

.env.development

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,5 @@ SEARCH_CATALOG_URL='http://localhost:18000/courses'
3232
ENABLE_SKILLS_BUILDER_PROFILE=''
3333
# Fallback in local style files
3434
PARAGON_THEME_URLS={}
35+
ENABLE_NEW_PROFILE_VIEW=''
36+
DISABLE_VISIBILITY_EDITING=''

.env.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@ COLLECT_YEAR_OF_BIRTH=true
2626
APP_ID=''
2727
MFE_CONFIG_API_URL=''
2828
PARAGON_THEME_URLS={}
29+
ENABLE_NEW_PROFILE_VIEW=''
30+
DISABLE_VISIBILITY_EDITING=''

package-lock.json

Lines changed: 1849 additions & 3916 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/data/reducers.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import { combineReducers } from 'redux';
22

3-
import { reducer as profilePage } from '../profile';
3+
import { getConfig } from '@edx/frontend-platform';
4+
5+
import { reducer as profilePageReducer } from '../profile';
6+
import { reducer as newProfilePageReducer } from '../profile-v2';
7+
8+
const isNewProfileEnabled = getConfig().ENABLE_NEW_PROFILE_VIEW;
49

510
const createRootReducer = () => combineReducers({
6-
profilePage,
11+
profilePage: isNewProfileEnabled ? newProfilePageReducer : profilePageReducer,
712
});
813

914
export default createRootReducer;

src/data/sagas.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import { all } from 'redux-saga/effects';
2-
2+
import { getConfig } from '@edx/frontend-platform';
33
import { saga as profileSaga } from '../profile';
4+
import { saga as newProfileSaga } from '../profile-v2';
5+
6+
const isNewProfileEnabled = getConfig().ENABLE_NEW_PROFILE_VIEW;
47

58
export default function* rootSaga() {
69
yield all([
7-
profileSaga(),
10+
isNewProfileEnabled ? newProfileSaga() : profileSaga(),
811
]);
912
}

src/index-v2.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@use "@openedx/paragon/styles/css/core/custom-media-breakpoints" as paragonCustomMediaBreakpoints;
2+
3+
@import "~@edx/frontend-component-header/dist/index";
4+
@import "~@edx/frontend-component-footer/dist/footer";
5+
6+
@import './profile-v2/index';

src/index.jsx

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ import {
77
initialize,
88
mergeConfig,
99
subscribe,
10+
getConfig,
1011
} from '@edx/frontend-platform';
1112
import {
1213
AppProvider,
1314
ErrorPage,
1415
} from '@edx/frontend-platform/react';
1516

16-
import React, { StrictMode } from 'react';
17+
import React from 'react';
1718
// eslint-disable-next-line import/no-unresolved
1819
import { createRoot } from 'react-dom/client';
1920

@@ -23,29 +24,33 @@ import { FooterSlot } from '@edx/frontend-component-footer';
2324
import messages from './i18n';
2425
import configureStore from './data/configureStore';
2526

26-
import './index.scss';
2727
import Head from './head/Head';
2828

2929
import AppRoutes from './routes/AppRoutes';
3030

3131
const rootNode = createRoot(document.getElementById('root'));
32-
subscribe(APP_READY, () => {
32+
subscribe(APP_READY, async () => {
33+
const isNewProfileEnabled = getConfig().ENABLE_NEW_PROFILE_VIEW === 'true';
34+
if (isNewProfileEnabled) {
35+
await import('./index-v2.scss');
36+
} else {
37+
await import('./index.scss');
38+
}
3339
rootNode.render(
34-
<StrictMode>
35-
<AppProvider store={configureStore()}>
36-
<Head />
37-
<Header />
38-
<main id="main">
39-
<AppRoutes />
40-
</main>
41-
<FooterSlot />
42-
</AppProvider>
43-
</StrictMode>,
40+
<AppProvider store={configureStore()}>
41+
<Head />
42+
<Header />
43+
<main id="main">
44+
<AppRoutes isNewProfileEnabled={isNewProfileEnabled} />
45+
</main>
46+
<FooterSlot />
47+
</AppProvider>,
48+
document.getElementById('root'),
4449
);
4550
});
4651

4752
subscribe(APP_INIT_ERROR, (error) => {
48-
rootNode.render(<ErrorPage message={error.message} />);
53+
rootNode.render(<ErrorPage message={error.message} />, document.getElementById('root'));
4954
});
5055

5156
initialize({
@@ -56,6 +61,7 @@ initialize({
5661
mergeConfig({
5762
COLLECT_YEAR_OF_BIRTH: process.env.COLLECT_YEAR_OF_BIRTH,
5863
ENABLE_SKILLS_BUILDER_PROFILE: process.env.ENABLE_SKILLS_BUILDER_PROFILE,
64+
ENABLE_NEW_PROFILE_VIEW: process.env.ENABLE_NEW_PROFILE_VIEW || null,
5965
}, 'App loadConfig override handler');
6066
},
6167
},

src/pacts/frontend-app-profile-edx-platform.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@
3636
"dateJoined": "2017-06-07T00:44:23Z",
3737
"email": "[email protected]",
3838
"isActive": true,
39+
"languageProficiencies": [],
40+
"levelOfEducation": null,
3941
"name": "Lemon Seltzer",
42+
"profileImage": {},
43+
"socialLinks": [],
4044
"username": "staff",
4145
"yearOfBirth": 1901
4246
},

src/profile-v2/CertificateCard.jsx

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import { FormattedDate, FormattedMessage, useIntl } from '@edx/frontend-platform/i18n';
4+
import { Hyperlink } from '@openedx/paragon';
5+
import get from 'lodash.get';
6+
7+
import classNames from 'classnames';
8+
import professionalCertificateSVG from './assets/professional-certificate.svg';
9+
import verifiedCertificateSVG from './assets/verified-certificate.svg';
10+
import messages from './Certificates.messages';
11+
import { useIsOnMobileScreen } from './data/hooks';
12+
13+
const CertificateCard = ({
14+
certificateType,
15+
courseDisplayName,
16+
courseOrganization,
17+
modifiedDate,
18+
downloadUrl,
19+
courseId,
20+
uuid,
21+
}) => {
22+
const intl = useIntl();
23+
24+
const certificateIllustration = {
25+
professional: professionalCertificateSVG,
26+
'no-id-professional': professionalCertificateSVG,
27+
verified: verifiedCertificateSVG,
28+
honor: null,
29+
audit: null,
30+
}[certificateType] || null;
31+
32+
const isMobileView = useIsOnMobileScreen();
33+
34+
return (
35+
<div
36+
key={`${modifiedDate}-${courseId}`}
37+
className="col-auto d-flex align-items-center p-0"
38+
>
39+
<div className="col certificate p-4 border-light-400 bg-light-200 w-100 h-100">
40+
<div
41+
className="certificate-type-illustration"
42+
style={{ backgroundImage: `url(${certificateIllustration})` }}
43+
/>
44+
<div className={classNames(
45+
'd-flex flex-column position-relative p-0',
46+
{ 'max-width-304px': isMobileView },
47+
{ 'width-314px': !isMobileView },
48+
)}
49+
>
50+
<div className="w-100 color-black">
51+
<p className={classNames([
52+
'mb-0 font-weight-normal',
53+
isMobileView ? 'x-small' : 'small',
54+
])}
55+
>
56+
{intl.formatMessage(get(
57+
messages,
58+
`profile.certificates.types.${certificateType}`,
59+
messages['profile.certificates.types.unknown'],
60+
))}
61+
</p>
62+
<p className={classNames([
63+
'm-0 color-black',
64+
isMobileView ? 'h5' : 'h4',
65+
])}
66+
>
67+
{courseDisplayName}
68+
</p>
69+
<p className={classNames([
70+
'mb-0',
71+
isMobileView ? 'x-small' : 'small',
72+
])}
73+
>
74+
<FormattedMessage
75+
id="profile.certificate.organization.label"
76+
defaultMessage="From"
77+
/>
78+
</p>
79+
<h5 className="mb-0 color-black">{courseOrganization}</h5>
80+
<p className={classNames([
81+
'mb-0',
82+
isMobileView ? 'x-small' : 'small',
83+
])}
84+
>
85+
<FormattedMessage
86+
id="profile.certificate.completion.date.label"
87+
defaultMessage="Completed on {date}"
88+
values={{
89+
date: <FormattedDate value={new Date(modifiedDate)} />,
90+
}}
91+
/>
92+
</p>
93+
</div>
94+
<div className="pt-3">
95+
<Hyperlink
96+
destination={downloadUrl}
97+
target="_blank"
98+
showLaunchIcon={false}
99+
className={classNames(
100+
'btn btn-primary btn-rounded font-weight-normal px-4 py-10px',
101+
{ 'btn-sm': isMobileView },
102+
)}
103+
>
104+
{intl.formatMessage(messages['profile.certificates.view.certificate'])}
105+
</Hyperlink>
106+
</div>
107+
<p
108+
className={classNames([
109+
'mb-0 pt-3',
110+
isMobileView ? 'x-small' : 'small',
111+
])}
112+
>
113+
<FormattedMessage
114+
id="profile.certificate.uuid"
115+
defaultMessage="Credential ID {certificate_uuid}"
116+
values={{
117+
certificate_uuid: uuid,
118+
}}
119+
/>
120+
</p>
121+
</div>
122+
</div>
123+
</div>
124+
);
125+
};
126+
127+
CertificateCard.propTypes = {
128+
certificateType: PropTypes.string,
129+
courseDisplayName: PropTypes.string,
130+
courseOrganization: PropTypes.string,
131+
modifiedDate: PropTypes.string,
132+
downloadUrl: PropTypes.string,
133+
courseId: PropTypes.string.isRequired,
134+
uuid: PropTypes.string,
135+
};
136+
137+
CertificateCard.defaultProps = {
138+
certificateType: 'unknown',
139+
courseDisplayName: '',
140+
courseOrganization: '',
141+
modifiedDate: '',
142+
downloadUrl: '',
143+
uuid: '',
144+
};
145+
146+
export default CertificateCard;

0 commit comments

Comments
 (0)