Compare commits
41 Commits
sundas/INF
...
frontend-b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fa7267f17c | ||
|
|
7b754edef8 | ||
|
|
0bb7ee2fd4 | ||
|
|
335dd7819d | ||
|
|
b18a01c302 | ||
|
|
981dccf2d5 | ||
|
|
e8be148ca9 | ||
|
|
167a8bd9a8 | ||
|
|
db2336ac09 | ||
|
|
a13c25d4ea | ||
|
|
9452b72525 | ||
|
|
3601cb6c05 | ||
|
|
b73c0f0f26 | ||
|
|
37feffc0db | ||
|
|
c9d2813009 | ||
|
|
8ec67d9ed2 | ||
|
|
1d149f12ea | ||
|
|
9516ee0e92 | ||
|
|
29fd7176c8 | ||
|
|
16ddd7abba | ||
|
|
577ef6ab0b | ||
|
|
8268fa4eab | ||
|
|
5665f8a0d6 | ||
|
|
4b7a3207e0 | ||
|
|
3db0289aab | ||
|
|
85d3eca9e4 | ||
|
|
f7fd2959ac | ||
|
|
8652206aa4 | ||
|
|
7a5e03967d | ||
|
|
da19dfaadc | ||
|
|
60d960276d | ||
|
|
c8a6f9fbd8 | ||
|
|
2ef5a7baff | ||
|
|
d59c641b3d | ||
|
|
4ea80a2a09 | ||
|
|
45fe50f7f7 | ||
|
|
933a177c78 | ||
|
|
14fff570a4 | ||
|
|
3d0f3806e1 | ||
|
|
b597e2cc14 | ||
|
|
22dc85470a |
2
.env
2
.env
@@ -29,3 +29,5 @@ APP_ID=''
|
||||
MFE_CONFIG_API_URL=''
|
||||
SEARCH_CATALOG_URL=''
|
||||
ENABLE_SKILLS_BUILDER_PROFILE=''
|
||||
# Fallback in local style files
|
||||
PARAGON_THEME_URLS={}
|
||||
|
||||
@@ -30,3 +30,5 @@ APP_ID=''
|
||||
MFE_CONFIG_API_URL=''
|
||||
SEARCH_CATALOG_URL='http://localhost:18000/courses'
|
||||
ENABLE_SKILLS_BUILDER_PROFILE=''
|
||||
# Fallback in local style files
|
||||
PARAGON_THEME_URLS={}
|
||||
|
||||
@@ -25,3 +25,4 @@ LEARNER_RECORD_MFE_BASE_URL='http://localhost:1990'
|
||||
COLLECT_YEAR_OF_BIRTH=true
|
||||
APP_ID=''
|
||||
MFE_CONFIG_API_URL=''
|
||||
PARAGON_THEME_URLS={}
|
||||
|
||||
17684
package-lock.json
generated
17684
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
31
package.json
31
package.json
@@ -14,6 +14,7 @@
|
||||
"lint": "fedx-scripts eslint --ext .js --ext .jsx .",
|
||||
"snapshot": "fedx-scripts jest --updateSnapshot",
|
||||
"start": "fedx-scripts webpack-dev-server --progress",
|
||||
"dev": "PUBLIC_PATH=/profile/ MFE_CONFIG_API_URL='http://localhost:8000/api/mfe_config/v1' fedx-scripts webpack-dev-server --progress --host apps.local.openedx.io",
|
||||
"test": "TZ=UTC fedx-scripts jest --coverage --passWithNoTests",
|
||||
"stubs": "pact-stub-service ./src/pacts/frontend-app-profile-edx-platform.json --port 18000"
|
||||
},
|
||||
@@ -29,32 +30,32 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"@edx/brand": "npm:@openedx/brand-openedx@^1.2.2",
|
||||
"@edx/frontend-component-header": "^5.6.0",
|
||||
"@edx/frontend-platform": "8.1.5",
|
||||
"@edx/openedx-atlas": "^0.6.0",
|
||||
"@edx/frontend-component-footer": "^14.6.0",
|
||||
"@edx/frontend-component-header": "^6.2.0",
|
||||
"@edx/frontend-platform": "^8.3.1",
|
||||
"@edx/openedx-atlas": "^0.7.0",
|
||||
"@fortawesome/fontawesome-svg-core": "6.7.2",
|
||||
"@fortawesome/free-brands-svg-icons": "6.7.2",
|
||||
"@fortawesome/free-regular-svg-icons": "6.7.2",
|
||||
"@fortawesome/free-solid-svg-icons": "6.7.2",
|
||||
"@fortawesome/react-fontawesome": "0.2.2",
|
||||
"@openedx/frontend-slot-footer": "^1.0.2",
|
||||
"@openedx/paragon": "^22.2.2",
|
||||
"@openedx/paragon": "^23.4.5",
|
||||
"@pact-foundation/pact": "^11.0.2",
|
||||
"@redux-devtools/extension": "3.3.0",
|
||||
"classnames": "2.5.1",
|
||||
"core-js": "3.40.0",
|
||||
"core-js": "3.43.0",
|
||||
"history": "5.3.0",
|
||||
"lodash.camelcase": "4.3.0",
|
||||
"lodash.get": "4.4.2",
|
||||
"lodash.pick": "4.4.0",
|
||||
"lodash.snakecase": "4.1.1",
|
||||
"prop-types": "15.8.1",
|
||||
"react": "17.0.2",
|
||||
"react-dom": "17.0.2",
|
||||
"react": "18.3.1",
|
||||
"react-dom": "18.3.1",
|
||||
"react-helmet": "6.1.0",
|
||||
"react-redux": "7.2.9",
|
||||
"react-router": "6.29.0",
|
||||
"react-router-dom": "6.29.0",
|
||||
"react-router": "6.30.1",
|
||||
"react-router-dom": "6.30.1",
|
||||
"redux": "4.2.1",
|
||||
"redux-logger": "3.0.6",
|
||||
"redux-saga": "1.3.0",
|
||||
@@ -64,14 +65,14 @@
|
||||
"universal-cookie": "4.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "19.7.1",
|
||||
"@commitlint/config-angular": "19.7.1",
|
||||
"@commitlint/cli": "19.8.1",
|
||||
"@commitlint/config-angular": "19.8.1",
|
||||
"@edx/browserslist-config": "^1.1.1",
|
||||
"@edx/reactifex": "2.2.0",
|
||||
"@openedx/frontend-build": "14.2.2",
|
||||
"@openedx/frontend-build": "^14.3.3",
|
||||
"@testing-library/jest-dom": "6.6.3",
|
||||
"@testing-library/react": "12.1.5",
|
||||
"glob": "11.0.1",
|
||||
"@testing-library/react": "14.3.1",
|
||||
"glob": "11.0.3",
|
||||
"reactifex": "1.1.1",
|
||||
"redux-mock-store": "1.5.5"
|
||||
}
|
||||
|
||||
@@ -13,11 +13,12 @@ import {
|
||||
ErrorPage,
|
||||
} from '@edx/frontend-platform/react';
|
||||
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import React, { StrictMode } from 'react';
|
||||
// eslint-disable-next-line import/no-unresolved
|
||||
import { createRoot } from 'react-dom/client';
|
||||
|
||||
import Header from '@edx/frontend-component-header';
|
||||
import FooterSlot from '@openedx/frontend-slot-footer';
|
||||
import { FooterSlot } from '@edx/frontend-component-footer';
|
||||
|
||||
import messages from './i18n';
|
||||
import configureStore from './data/configureStore';
|
||||
@@ -27,22 +28,24 @@ import Head from './head/Head';
|
||||
|
||||
import AppRoutes from './routes/AppRoutes';
|
||||
|
||||
const rootNode = createRoot(document.getElementById('root'));
|
||||
subscribe(APP_READY, () => {
|
||||
ReactDOM.render(
|
||||
<AppProvider store={configureStore()}>
|
||||
<Head />
|
||||
<Header />
|
||||
<main id="main">
|
||||
<AppRoutes />
|
||||
</main>
|
||||
<FooterSlot />
|
||||
</AppProvider>,
|
||||
document.getElementById('root'),
|
||||
rootNode.render(
|
||||
<StrictMode>
|
||||
<AppProvider store={configureStore()}>
|
||||
<Head />
|
||||
<Header />
|
||||
<main id="main">
|
||||
<AppRoutes />
|
||||
</main>
|
||||
<FooterSlot />
|
||||
</AppProvider>
|
||||
</StrictMode>,
|
||||
);
|
||||
});
|
||||
|
||||
subscribe(APP_INIT_ERROR, (error) => {
|
||||
ReactDOM.render(<ErrorPage message={error.message} />, document.getElementById('root'));
|
||||
rootNode.render(<ErrorPage message={error.message} />);
|
||||
});
|
||||
|
||||
initialize({
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
@import "~@edx/brand/paragon/fonts";
|
||||
@import "~@edx/brand/paragon/variables";
|
||||
@import "~@openedx/paragon/scss/core/core";
|
||||
@import "~@edx/brand/paragon/overrides";
|
||||
@use "@openedx/paragon/styles/css/core/custom-media-breakpoints" as paragonCustomMediaBreakpoints;
|
||||
|
||||
@import "~@edx/frontend-component-header/dist/index";
|
||||
@import "~@edx/frontend-component-footer/dist/footer";
|
||||
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
# Footer Slot
|
||||
|
||||
### Slot ID: `footer_slot`
|
||||
### Slot ID: `org.openedx.frontend.layout.footer.v1`
|
||||
|
||||
### Slot ID Aliases
|
||||
* `footer_slot`
|
||||
|
||||
## Description
|
||||
|
||||
This slot is used to replace/modify/hide the footer.
|
||||
|
||||
The implementation of the `FooterSlot` component lives in [the `frontend-slot-footer` repository](https://github.com/openedx/frontend-slot-footer/).
|
||||
The implementation of the `FooterSlot` component lives in [the `frontend-component-footer` repository](https://github.com/openedx/frontend-component-footer/).
|
||||
|
||||
## Example
|
||||
|
||||
@@ -23,7 +26,7 @@ import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-frame
|
||||
|
||||
const config = {
|
||||
pluginSlots: {
|
||||
footer_slot: {
|
||||
'org.openedx.frontend.layout.footer.v1': {
|
||||
plugins: [
|
||||
{
|
||||
// Hide the default footer
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# `frontend-app-profile` Plugin Slots
|
||||
|
||||
* [`footer_slot`](./FooterSlot/)
|
||||
* [`org.openedx.frontend.layout.footer.v1`](./FooterSlot/)
|
||||
|
||||
@@ -29,7 +29,6 @@ module.exports = {
|
||||
drafts: {},
|
||||
isLoadingProfile: false,
|
||||
isAuthenticatedUserProfile: true,
|
||||
countries: [],
|
||||
},
|
||||
router: {
|
||||
location: {
|
||||
|
||||
@@ -125,8 +125,7 @@ module.exports = {
|
||||
}
|
||||
],
|
||||
drafts: {},
|
||||
isLoadingProfile: false,
|
||||
countries: [],
|
||||
isLoadingProfile: false
|
||||
},
|
||||
router: {
|
||||
location: {
|
||||
|
||||
@@ -86,7 +86,6 @@ module.exports = {
|
||||
drafts: {},
|
||||
isLoadingProfile: false,
|
||||
learningGoal: 'advance_career',
|
||||
countries: [],
|
||||
},
|
||||
router: {
|
||||
location: {
|
||||
|
||||
@@ -124,7 +124,6 @@ module.exports = {
|
||||
createdDate: '2019-03-04T19:31:39.896806Z'
|
||||
}
|
||||
],
|
||||
countries:[{code:"AX", name:"Åland Islands"},{code:"AL", name:"Albania"}],
|
||||
drafts: {},
|
||||
isLoadingProfile: false
|
||||
},
|
||||
|
||||
@@ -65,9 +65,10 @@ exports[`<ProfilePage /> Renders correctly in various states successfully redire
|
||||
Upload Photo
|
||||
</button>
|
||||
</div>
|
||||
<iconmock
|
||||
<div
|
||||
aria-hidden="true"
|
||||
class="text-muted"
|
||||
data-testid="IconMock"
|
||||
focusable="false"
|
||||
role="img"
|
||||
viewbox="0 0 24 24"
|
||||
@@ -976,11 +977,1256 @@ exports[`<ProfilePage /> Renders correctly in various states test country edit w
|
||||
>
|
||||
|
||||
</option>
|
||||
<option
|
||||
value="AF"
|
||||
>
|
||||
Afghanistan
|
||||
</option>
|
||||
<option
|
||||
value="AL"
|
||||
>
|
||||
Albania
|
||||
</option>
|
||||
<option
|
||||
value="DZ"
|
||||
>
|
||||
Algeria
|
||||
</option>
|
||||
<option
|
||||
value="AS"
|
||||
>
|
||||
American Samoa
|
||||
</option>
|
||||
<option
|
||||
value="AD"
|
||||
>
|
||||
Andorra
|
||||
</option>
|
||||
<option
|
||||
value="AO"
|
||||
>
|
||||
Angola
|
||||
</option>
|
||||
<option
|
||||
value="AI"
|
||||
>
|
||||
Anguilla
|
||||
</option>
|
||||
<option
|
||||
value="AQ"
|
||||
>
|
||||
Antarctica
|
||||
</option>
|
||||
<option
|
||||
value="AG"
|
||||
>
|
||||
Antigua and Barbuda
|
||||
</option>
|
||||
<option
|
||||
value="AR"
|
||||
>
|
||||
Argentina
|
||||
</option>
|
||||
<option
|
||||
value="AM"
|
||||
>
|
||||
Armenia
|
||||
</option>
|
||||
<option
|
||||
value="AW"
|
||||
>
|
||||
Aruba
|
||||
</option>
|
||||
<option
|
||||
value="AU"
|
||||
>
|
||||
Australia
|
||||
</option>
|
||||
<option
|
||||
value="AT"
|
||||
>
|
||||
Austria
|
||||
</option>
|
||||
<option
|
||||
value="AZ"
|
||||
>
|
||||
Azerbaijan
|
||||
</option>
|
||||
<option
|
||||
value="BS"
|
||||
>
|
||||
Bahamas
|
||||
</option>
|
||||
<option
|
||||
value="BH"
|
||||
>
|
||||
Bahrain
|
||||
</option>
|
||||
<option
|
||||
value="BD"
|
||||
>
|
||||
Bangladesh
|
||||
</option>
|
||||
<option
|
||||
value="BB"
|
||||
>
|
||||
Barbados
|
||||
</option>
|
||||
<option
|
||||
value="BY"
|
||||
>
|
||||
Belarus
|
||||
</option>
|
||||
<option
|
||||
value="BE"
|
||||
>
|
||||
Belgium
|
||||
</option>
|
||||
<option
|
||||
value="BZ"
|
||||
>
|
||||
Belize
|
||||
</option>
|
||||
<option
|
||||
value="BJ"
|
||||
>
|
||||
Benin
|
||||
</option>
|
||||
<option
|
||||
value="BM"
|
||||
>
|
||||
Bermuda
|
||||
</option>
|
||||
<option
|
||||
value="BT"
|
||||
>
|
||||
Bhutan
|
||||
</option>
|
||||
<option
|
||||
value="BO"
|
||||
>
|
||||
Bolivia
|
||||
</option>
|
||||
<option
|
||||
value="BA"
|
||||
>
|
||||
Bosnia and Herzegovina
|
||||
</option>
|
||||
<option
|
||||
value="BW"
|
||||
>
|
||||
Botswana
|
||||
</option>
|
||||
<option
|
||||
value="BV"
|
||||
>
|
||||
Bouvet Island
|
||||
</option>
|
||||
<option
|
||||
value="BR"
|
||||
>
|
||||
Brazil
|
||||
</option>
|
||||
<option
|
||||
value="IO"
|
||||
>
|
||||
British Indian Ocean Territory
|
||||
</option>
|
||||
<option
|
||||
value="BN"
|
||||
>
|
||||
Brunei Darussalam
|
||||
</option>
|
||||
<option
|
||||
value="BG"
|
||||
>
|
||||
Bulgaria
|
||||
</option>
|
||||
<option
|
||||
value="BF"
|
||||
>
|
||||
Burkina Faso
|
||||
</option>
|
||||
<option
|
||||
value="BI"
|
||||
>
|
||||
Burundi
|
||||
</option>
|
||||
<option
|
||||
value="KH"
|
||||
>
|
||||
Cambodia
|
||||
</option>
|
||||
<option
|
||||
value="CM"
|
||||
>
|
||||
Cameroon
|
||||
</option>
|
||||
<option
|
||||
value="CA"
|
||||
>
|
||||
Canada
|
||||
</option>
|
||||
<option
|
||||
value="CV"
|
||||
>
|
||||
Cape Verde
|
||||
</option>
|
||||
<option
|
||||
value="KY"
|
||||
>
|
||||
Cayman Islands
|
||||
</option>
|
||||
<option
|
||||
value="CF"
|
||||
>
|
||||
Central African Republic
|
||||
</option>
|
||||
<option
|
||||
value="TD"
|
||||
>
|
||||
Chad
|
||||
</option>
|
||||
<option
|
||||
value="CL"
|
||||
>
|
||||
Chile
|
||||
</option>
|
||||
<option
|
||||
value="CN"
|
||||
>
|
||||
China
|
||||
</option>
|
||||
<option
|
||||
value="CX"
|
||||
>
|
||||
Christmas Island
|
||||
</option>
|
||||
<option
|
||||
value="CC"
|
||||
>
|
||||
Cocos (Keeling) Islands
|
||||
</option>
|
||||
<option
|
||||
value="CO"
|
||||
>
|
||||
Colombia
|
||||
</option>
|
||||
<option
|
||||
value="KM"
|
||||
>
|
||||
Comoros
|
||||
</option>
|
||||
<option
|
||||
value="CG"
|
||||
>
|
||||
Congo
|
||||
</option>
|
||||
<option
|
||||
value="CD"
|
||||
>
|
||||
Congo, the Democratic Republic of the
|
||||
</option>
|
||||
<option
|
||||
value="CK"
|
||||
>
|
||||
Cook Islands
|
||||
</option>
|
||||
<option
|
||||
value="CR"
|
||||
>
|
||||
Costa Rica
|
||||
</option>
|
||||
<option
|
||||
value="CI"
|
||||
>
|
||||
Cote D'Ivoire
|
||||
</option>
|
||||
<option
|
||||
value="HR"
|
||||
>
|
||||
Croatia
|
||||
</option>
|
||||
<option
|
||||
value="CU"
|
||||
>
|
||||
Cuba
|
||||
</option>
|
||||
<option
|
||||
value="CY"
|
||||
>
|
||||
Cyprus
|
||||
</option>
|
||||
<option
|
||||
value="CZ"
|
||||
>
|
||||
Czech Republic
|
||||
</option>
|
||||
<option
|
||||
value="DK"
|
||||
>
|
||||
Denmark
|
||||
</option>
|
||||
<option
|
||||
value="DJ"
|
||||
>
|
||||
Djibouti
|
||||
</option>
|
||||
<option
|
||||
value="DM"
|
||||
>
|
||||
Dominica
|
||||
</option>
|
||||
<option
|
||||
value="DO"
|
||||
>
|
||||
Dominican Republic
|
||||
</option>
|
||||
<option
|
||||
value="EC"
|
||||
>
|
||||
Ecuador
|
||||
</option>
|
||||
<option
|
||||
value="EG"
|
||||
>
|
||||
Egypt
|
||||
</option>
|
||||
<option
|
||||
value="SV"
|
||||
>
|
||||
El Salvador
|
||||
</option>
|
||||
<option
|
||||
value="GQ"
|
||||
>
|
||||
Equatorial Guinea
|
||||
</option>
|
||||
<option
|
||||
value="ER"
|
||||
>
|
||||
Eritrea
|
||||
</option>
|
||||
<option
|
||||
value="EE"
|
||||
>
|
||||
Estonia
|
||||
</option>
|
||||
<option
|
||||
value="ET"
|
||||
>
|
||||
Ethiopia
|
||||
</option>
|
||||
<option
|
||||
value="FK"
|
||||
>
|
||||
Falkland Islands (Malvinas)
|
||||
</option>
|
||||
<option
|
||||
value="FO"
|
||||
>
|
||||
Faroe Islands
|
||||
</option>
|
||||
<option
|
||||
value="FJ"
|
||||
>
|
||||
Fiji
|
||||
</option>
|
||||
<option
|
||||
value="FI"
|
||||
>
|
||||
Finland
|
||||
</option>
|
||||
<option
|
||||
value="FR"
|
||||
>
|
||||
France
|
||||
</option>
|
||||
<option
|
||||
value="GF"
|
||||
>
|
||||
French Guiana
|
||||
</option>
|
||||
<option
|
||||
value="PF"
|
||||
>
|
||||
French Polynesia
|
||||
</option>
|
||||
<option
|
||||
value="TF"
|
||||
>
|
||||
French Southern Territories
|
||||
</option>
|
||||
<option
|
||||
value="GA"
|
||||
>
|
||||
Gabon
|
||||
</option>
|
||||
<option
|
||||
value="GM"
|
||||
>
|
||||
Gambia
|
||||
</option>
|
||||
<option
|
||||
value="GE"
|
||||
>
|
||||
Georgia
|
||||
</option>
|
||||
<option
|
||||
value="DE"
|
||||
>
|
||||
Germany
|
||||
</option>
|
||||
<option
|
||||
value="GH"
|
||||
>
|
||||
Ghana
|
||||
</option>
|
||||
<option
|
||||
value="GI"
|
||||
>
|
||||
Gibraltar
|
||||
</option>
|
||||
<option
|
||||
value="GR"
|
||||
>
|
||||
Greece
|
||||
</option>
|
||||
<option
|
||||
value="GL"
|
||||
>
|
||||
Greenland
|
||||
</option>
|
||||
<option
|
||||
value="GD"
|
||||
>
|
||||
Grenada
|
||||
</option>
|
||||
<option
|
||||
value="GP"
|
||||
>
|
||||
Guadeloupe
|
||||
</option>
|
||||
<option
|
||||
value="GU"
|
||||
>
|
||||
Guam
|
||||
</option>
|
||||
<option
|
||||
value="GT"
|
||||
>
|
||||
Guatemala
|
||||
</option>
|
||||
<option
|
||||
value="GN"
|
||||
>
|
||||
Guinea
|
||||
</option>
|
||||
<option
|
||||
value="GW"
|
||||
>
|
||||
Guinea-Bissau
|
||||
</option>
|
||||
<option
|
||||
value="GY"
|
||||
>
|
||||
Guyana
|
||||
</option>
|
||||
<option
|
||||
value="HT"
|
||||
>
|
||||
Haiti
|
||||
</option>
|
||||
<option
|
||||
value="HM"
|
||||
>
|
||||
Heard Island and Mcdonald Islands
|
||||
</option>
|
||||
<option
|
||||
value="VA"
|
||||
>
|
||||
Holy See (Vatican City State)
|
||||
</option>
|
||||
<option
|
||||
value="HN"
|
||||
>
|
||||
Honduras
|
||||
</option>
|
||||
<option
|
||||
value="HK"
|
||||
>
|
||||
Hong Kong
|
||||
</option>
|
||||
<option
|
||||
value="HU"
|
||||
>
|
||||
Hungary
|
||||
</option>
|
||||
<option
|
||||
value="IS"
|
||||
>
|
||||
Iceland
|
||||
</option>
|
||||
<option
|
||||
value="IN"
|
||||
>
|
||||
India
|
||||
</option>
|
||||
<option
|
||||
value="ID"
|
||||
>
|
||||
Indonesia
|
||||
</option>
|
||||
<option
|
||||
value="IR"
|
||||
>
|
||||
Iran, Islamic Republic of
|
||||
</option>
|
||||
<option
|
||||
value="IQ"
|
||||
>
|
||||
Iraq
|
||||
</option>
|
||||
<option
|
||||
value="IE"
|
||||
>
|
||||
Ireland
|
||||
</option>
|
||||
<option
|
||||
value="IL"
|
||||
>
|
||||
Israel
|
||||
</option>
|
||||
<option
|
||||
value="IT"
|
||||
>
|
||||
Italy
|
||||
</option>
|
||||
<option
|
||||
value="JM"
|
||||
>
|
||||
Jamaica
|
||||
</option>
|
||||
<option
|
||||
value="JP"
|
||||
>
|
||||
Japan
|
||||
</option>
|
||||
<option
|
||||
value="JO"
|
||||
>
|
||||
Jordan
|
||||
</option>
|
||||
<option
|
||||
value="KZ"
|
||||
>
|
||||
Kazakhstan
|
||||
</option>
|
||||
<option
|
||||
value="KE"
|
||||
>
|
||||
Kenya
|
||||
</option>
|
||||
<option
|
||||
value="KI"
|
||||
>
|
||||
Kiribati
|
||||
</option>
|
||||
<option
|
||||
value="KP"
|
||||
>
|
||||
North Korea
|
||||
</option>
|
||||
<option
|
||||
value="KR"
|
||||
>
|
||||
South Korea
|
||||
</option>
|
||||
<option
|
||||
value="KW"
|
||||
>
|
||||
Kuwait
|
||||
</option>
|
||||
<option
|
||||
value="KG"
|
||||
>
|
||||
Kyrgyzstan
|
||||
</option>
|
||||
<option
|
||||
value="LA"
|
||||
>
|
||||
Lao People's Democratic Republic
|
||||
</option>
|
||||
<option
|
||||
value="LV"
|
||||
>
|
||||
Latvia
|
||||
</option>
|
||||
<option
|
||||
value="LB"
|
||||
>
|
||||
Lebanon
|
||||
</option>
|
||||
<option
|
||||
value="LS"
|
||||
>
|
||||
Lesotho
|
||||
</option>
|
||||
<option
|
||||
value="LR"
|
||||
>
|
||||
Liberia
|
||||
</option>
|
||||
<option
|
||||
value="LY"
|
||||
>
|
||||
Libya
|
||||
</option>
|
||||
<option
|
||||
value="LI"
|
||||
>
|
||||
Liechtenstein
|
||||
</option>
|
||||
<option
|
||||
value="LT"
|
||||
>
|
||||
Lithuania
|
||||
</option>
|
||||
<option
|
||||
value="LU"
|
||||
>
|
||||
Luxembourg
|
||||
</option>
|
||||
<option
|
||||
value="MO"
|
||||
>
|
||||
Macao
|
||||
</option>
|
||||
<option
|
||||
value="MG"
|
||||
>
|
||||
Madagascar
|
||||
</option>
|
||||
<option
|
||||
value="MW"
|
||||
>
|
||||
Malawi
|
||||
</option>
|
||||
<option
|
||||
value="MY"
|
||||
>
|
||||
Malaysia
|
||||
</option>
|
||||
<option
|
||||
value="MV"
|
||||
>
|
||||
Maldives
|
||||
</option>
|
||||
<option
|
||||
value="ML"
|
||||
>
|
||||
Mali
|
||||
</option>
|
||||
<option
|
||||
value="MT"
|
||||
>
|
||||
Malta
|
||||
</option>
|
||||
<option
|
||||
value="MH"
|
||||
>
|
||||
Marshall Islands
|
||||
</option>
|
||||
<option
|
||||
value="MQ"
|
||||
>
|
||||
Martinique
|
||||
</option>
|
||||
<option
|
||||
value="MR"
|
||||
>
|
||||
Mauritania
|
||||
</option>
|
||||
<option
|
||||
value="MU"
|
||||
>
|
||||
Mauritius
|
||||
</option>
|
||||
<option
|
||||
value="YT"
|
||||
>
|
||||
Mayotte
|
||||
</option>
|
||||
<option
|
||||
value="MX"
|
||||
>
|
||||
Mexico
|
||||
</option>
|
||||
<option
|
||||
value="FM"
|
||||
>
|
||||
Micronesia, Federated States of
|
||||
</option>
|
||||
<option
|
||||
value="MD"
|
||||
>
|
||||
Moldova, Republic of
|
||||
</option>
|
||||
<option
|
||||
value="MC"
|
||||
>
|
||||
Monaco
|
||||
</option>
|
||||
<option
|
||||
value="MN"
|
||||
>
|
||||
Mongolia
|
||||
</option>
|
||||
<option
|
||||
value="MS"
|
||||
>
|
||||
Montserrat
|
||||
</option>
|
||||
<option
|
||||
value="MA"
|
||||
>
|
||||
Morocco
|
||||
</option>
|
||||
<option
|
||||
value="MZ"
|
||||
>
|
||||
Mozambique
|
||||
</option>
|
||||
<option
|
||||
value="MM"
|
||||
>
|
||||
Myanmar
|
||||
</option>
|
||||
<option
|
||||
value="NA"
|
||||
>
|
||||
Namibia
|
||||
</option>
|
||||
<option
|
||||
value="NR"
|
||||
>
|
||||
Nauru
|
||||
</option>
|
||||
<option
|
||||
value="NP"
|
||||
>
|
||||
Nepal
|
||||
</option>
|
||||
<option
|
||||
value="NL"
|
||||
>
|
||||
Netherlands
|
||||
</option>
|
||||
<option
|
||||
value="NC"
|
||||
>
|
||||
New Caledonia
|
||||
</option>
|
||||
<option
|
||||
value="NZ"
|
||||
>
|
||||
New Zealand
|
||||
</option>
|
||||
<option
|
||||
value="NI"
|
||||
>
|
||||
Nicaragua
|
||||
</option>
|
||||
<option
|
||||
value="NE"
|
||||
>
|
||||
Niger
|
||||
</option>
|
||||
<option
|
||||
value="NG"
|
||||
>
|
||||
Nigeria
|
||||
</option>
|
||||
<option
|
||||
value="NU"
|
||||
>
|
||||
Niue
|
||||
</option>
|
||||
<option
|
||||
value="NF"
|
||||
>
|
||||
Norfolk Island
|
||||
</option>
|
||||
<option
|
||||
value="MK"
|
||||
>
|
||||
North Macedonia, Republic of
|
||||
</option>
|
||||
<option
|
||||
value="MP"
|
||||
>
|
||||
Northern Mariana Islands
|
||||
</option>
|
||||
<option
|
||||
value="NO"
|
||||
>
|
||||
Norway
|
||||
</option>
|
||||
<option
|
||||
value="OM"
|
||||
>
|
||||
Oman
|
||||
</option>
|
||||
<option
|
||||
value="PK"
|
||||
>
|
||||
Pakistan
|
||||
</option>
|
||||
<option
|
||||
value="PW"
|
||||
>
|
||||
Palau
|
||||
</option>
|
||||
<option
|
||||
value="PS"
|
||||
>
|
||||
Palestinian Territory, Occupied
|
||||
</option>
|
||||
<option
|
||||
value="PA"
|
||||
>
|
||||
Panama
|
||||
</option>
|
||||
<option
|
||||
value="PG"
|
||||
>
|
||||
Papua New Guinea
|
||||
</option>
|
||||
<option
|
||||
value="PY"
|
||||
>
|
||||
Paraguay
|
||||
</option>
|
||||
<option
|
||||
value="PE"
|
||||
>
|
||||
Peru
|
||||
</option>
|
||||
<option
|
||||
value="PH"
|
||||
>
|
||||
Philippines
|
||||
</option>
|
||||
<option
|
||||
value="PN"
|
||||
>
|
||||
Pitcairn
|
||||
</option>
|
||||
<option
|
||||
value="PL"
|
||||
>
|
||||
Poland
|
||||
</option>
|
||||
<option
|
||||
value="PT"
|
||||
>
|
||||
Portugal
|
||||
</option>
|
||||
<option
|
||||
value="PR"
|
||||
>
|
||||
Puerto Rico
|
||||
</option>
|
||||
<option
|
||||
value="QA"
|
||||
>
|
||||
Qatar
|
||||
</option>
|
||||
<option
|
||||
value="RE"
|
||||
>
|
||||
Reunion
|
||||
</option>
|
||||
<option
|
||||
value="RO"
|
||||
>
|
||||
Romania
|
||||
</option>
|
||||
<option
|
||||
value="RU"
|
||||
>
|
||||
Russian Federation
|
||||
</option>
|
||||
<option
|
||||
value="RW"
|
||||
>
|
||||
Rwanda
|
||||
</option>
|
||||
<option
|
||||
value="SH"
|
||||
>
|
||||
Saint Helena
|
||||
</option>
|
||||
<option
|
||||
value="KN"
|
||||
>
|
||||
Saint Kitts and Nevis
|
||||
</option>
|
||||
<option
|
||||
value="LC"
|
||||
>
|
||||
Saint Lucia
|
||||
</option>
|
||||
<option
|
||||
value="PM"
|
||||
>
|
||||
Saint Pierre and Miquelon
|
||||
</option>
|
||||
<option
|
||||
value="VC"
|
||||
>
|
||||
Saint Vincent and the Grenadines
|
||||
</option>
|
||||
<option
|
||||
value="WS"
|
||||
>
|
||||
Samoa
|
||||
</option>
|
||||
<option
|
||||
value="SM"
|
||||
>
|
||||
San Marino
|
||||
</option>
|
||||
<option
|
||||
value="ST"
|
||||
>
|
||||
Sao Tome and Principe
|
||||
</option>
|
||||
<option
|
||||
value="SA"
|
||||
>
|
||||
Saudi Arabia
|
||||
</option>
|
||||
<option
|
||||
value="SN"
|
||||
>
|
||||
Senegal
|
||||
</option>
|
||||
<option
|
||||
value="SC"
|
||||
>
|
||||
Seychelles
|
||||
</option>
|
||||
<option
|
||||
value="SL"
|
||||
>
|
||||
Sierra Leone
|
||||
</option>
|
||||
<option
|
||||
value="SG"
|
||||
>
|
||||
Singapore
|
||||
</option>
|
||||
<option
|
||||
value="SK"
|
||||
>
|
||||
Slovakia
|
||||
</option>
|
||||
<option
|
||||
value="SI"
|
||||
>
|
||||
Slovenia
|
||||
</option>
|
||||
<option
|
||||
value="SB"
|
||||
>
|
||||
Solomon Islands
|
||||
</option>
|
||||
<option
|
||||
value="SO"
|
||||
>
|
||||
Somalia
|
||||
</option>
|
||||
<option
|
||||
value="ZA"
|
||||
>
|
||||
South Africa
|
||||
</option>
|
||||
<option
|
||||
value="GS"
|
||||
>
|
||||
South Georgia and the South Sandwich Islands
|
||||
</option>
|
||||
<option
|
||||
value="ES"
|
||||
>
|
||||
Spain
|
||||
</option>
|
||||
<option
|
||||
value="LK"
|
||||
>
|
||||
Sri Lanka
|
||||
</option>
|
||||
<option
|
||||
value="SD"
|
||||
>
|
||||
Sudan
|
||||
</option>
|
||||
<option
|
||||
value="SR"
|
||||
>
|
||||
Suriname
|
||||
</option>
|
||||
<option
|
||||
value="SJ"
|
||||
>
|
||||
Svalbard and Jan Mayen
|
||||
</option>
|
||||
<option
|
||||
value="SZ"
|
||||
>
|
||||
Swaziland
|
||||
</option>
|
||||
<option
|
||||
value="SE"
|
||||
>
|
||||
Sweden
|
||||
</option>
|
||||
<option
|
||||
value="CH"
|
||||
>
|
||||
Switzerland
|
||||
</option>
|
||||
<option
|
||||
value="SY"
|
||||
>
|
||||
Syrian Arab Republic
|
||||
</option>
|
||||
<option
|
||||
value="TW"
|
||||
>
|
||||
Taiwan
|
||||
</option>
|
||||
<option
|
||||
value="TJ"
|
||||
>
|
||||
Tajikistan
|
||||
</option>
|
||||
<option
|
||||
value="TZ"
|
||||
>
|
||||
Tanzania, United Republic of
|
||||
</option>
|
||||
<option
|
||||
value="TH"
|
||||
>
|
||||
Thailand
|
||||
</option>
|
||||
<option
|
||||
value="TL"
|
||||
>
|
||||
Timor-Leste
|
||||
</option>
|
||||
<option
|
||||
value="TG"
|
||||
>
|
||||
Togo
|
||||
</option>
|
||||
<option
|
||||
value="TK"
|
||||
>
|
||||
Tokelau
|
||||
</option>
|
||||
<option
|
||||
value="TO"
|
||||
>
|
||||
Tonga
|
||||
</option>
|
||||
<option
|
||||
value="TT"
|
||||
>
|
||||
Trinidad and Tobago
|
||||
</option>
|
||||
<option
|
||||
value="TN"
|
||||
>
|
||||
Tunisia
|
||||
</option>
|
||||
<option
|
||||
value="TR"
|
||||
>
|
||||
Turkey
|
||||
</option>
|
||||
<option
|
||||
value="TM"
|
||||
>
|
||||
Turkmenistan
|
||||
</option>
|
||||
<option
|
||||
value="TC"
|
||||
>
|
||||
Turks and Caicos Islands
|
||||
</option>
|
||||
<option
|
||||
value="TV"
|
||||
>
|
||||
Tuvalu
|
||||
</option>
|
||||
<option
|
||||
value="UG"
|
||||
>
|
||||
Uganda
|
||||
</option>
|
||||
<option
|
||||
value="UA"
|
||||
>
|
||||
Ukraine
|
||||
</option>
|
||||
<option
|
||||
value="AE"
|
||||
>
|
||||
United Arab Emirates
|
||||
</option>
|
||||
<option
|
||||
value="GB"
|
||||
>
|
||||
United Kingdom
|
||||
</option>
|
||||
<option
|
||||
value="US"
|
||||
>
|
||||
United States of America
|
||||
</option>
|
||||
<option
|
||||
value="UM"
|
||||
>
|
||||
United States Minor Outlying Islands
|
||||
</option>
|
||||
<option
|
||||
value="UY"
|
||||
>
|
||||
Uruguay
|
||||
</option>
|
||||
<option
|
||||
value="UZ"
|
||||
>
|
||||
Uzbekistan
|
||||
</option>
|
||||
<option
|
||||
value="VU"
|
||||
>
|
||||
Vanuatu
|
||||
</option>
|
||||
<option
|
||||
value="VE"
|
||||
>
|
||||
Venezuela
|
||||
</option>
|
||||
<option
|
||||
value="VN"
|
||||
>
|
||||
Viet Nam
|
||||
</option>
|
||||
<option
|
||||
value="VG"
|
||||
>
|
||||
Virgin Islands, British
|
||||
</option>
|
||||
<option
|
||||
value="VI"
|
||||
>
|
||||
Virgin Islands, U.S.
|
||||
</option>
|
||||
<option
|
||||
value="WF"
|
||||
>
|
||||
Wallis and Futuna
|
||||
</option>
|
||||
<option
|
||||
value="EH"
|
||||
>
|
||||
Western Sahara
|
||||
</option>
|
||||
<option
|
||||
value="YE"
|
||||
>
|
||||
Yemen
|
||||
</option>
|
||||
<option
|
||||
value="ZM"
|
||||
>
|
||||
Zambia
|
||||
</option>
|
||||
<option
|
||||
value="ZW"
|
||||
>
|
||||
Zimbabwe
|
||||
</option>
|
||||
<option
|
||||
value="AX"
|
||||
>
|
||||
Åland Islands
|
||||
</option>
|
||||
<option
|
||||
value="BQ"
|
||||
>
|
||||
Bonaire, Sint Eustatius and Saba
|
||||
</option>
|
||||
<option
|
||||
value="CW"
|
||||
>
|
||||
Curaçao
|
||||
</option>
|
||||
<option
|
||||
value="GG"
|
||||
>
|
||||
Guernsey
|
||||
</option>
|
||||
<option
|
||||
value="IM"
|
||||
>
|
||||
Isle of Man
|
||||
</option>
|
||||
<option
|
||||
value="JE"
|
||||
>
|
||||
Jersey
|
||||
</option>
|
||||
<option
|
||||
value="ME"
|
||||
>
|
||||
Montenegro
|
||||
</option>
|
||||
<option
|
||||
value="BL"
|
||||
>
|
||||
Saint Barthélemy
|
||||
</option>
|
||||
<option
|
||||
value="MF"
|
||||
>
|
||||
Saint Martin (French part)
|
||||
</option>
|
||||
<option
|
||||
value="RS"
|
||||
>
|
||||
Serbia
|
||||
</option>
|
||||
<option
|
||||
value="SX"
|
||||
>
|
||||
Sint Maarten (Dutch part)
|
||||
</option>
|
||||
<option
|
||||
value="SS"
|
||||
>
|
||||
South Sudan
|
||||
</option>
|
||||
<option
|
||||
value="XK"
|
||||
>
|
||||
Kosovo
|
||||
</option>
|
||||
</select>
|
||||
<div
|
||||
class="pgn__form-control-description pgn__form-text pgn__form-text-invalid"
|
||||
@@ -4522,9 +5768,10 @@ exports[`<ProfilePage /> Renders correctly in various states viewing other profi
|
||||
<div
|
||||
class="profile-avatar rounded-circle bg-light"
|
||||
>
|
||||
<iconmock
|
||||
<div
|
||||
aria-hidden="true"
|
||||
class="text-muted"
|
||||
data-testid="IconMock"
|
||||
focusable="false"
|
||||
role="img"
|
||||
viewbox="0 0 24 24"
|
||||
|
||||
@@ -25,14 +25,12 @@ export const fetchProfileSuccess = (
|
||||
preferences,
|
||||
courseCertificates,
|
||||
isAuthenticatedUserProfile,
|
||||
countries,
|
||||
) => ({
|
||||
type: FETCH_PROFILE.SUCCESS,
|
||||
account,
|
||||
preferences,
|
||||
courseCertificates,
|
||||
isAuthenticatedUserProfile,
|
||||
countries,
|
||||
});
|
||||
|
||||
export const fetchProfileReset = () => ({
|
||||
|
||||
@@ -22,12 +22,7 @@ const SOCIAL = {
|
||||
},
|
||||
};
|
||||
|
||||
const FIELD_LABELS = {
|
||||
COUNTRY: 'country',
|
||||
};
|
||||
|
||||
export {
|
||||
EDUCATION_LEVELS,
|
||||
SOCIAL,
|
||||
FIELD_LABELS,
|
||||
};
|
||||
|
||||
@@ -22,7 +22,6 @@ export const initialState = {
|
||||
drafts: {},
|
||||
isLoadingProfile: true,
|
||||
isAuthenticatedUserProfile: false,
|
||||
countries: [],
|
||||
};
|
||||
|
||||
const profilePage = (state = initialState, action = {}) => {
|
||||
@@ -43,7 +42,6 @@ const profilePage = (state = initialState, action = {}) => {
|
||||
courseCertificates: action.courseCertificates,
|
||||
isLoadingProfile: false,
|
||||
isAuthenticatedUserProfile: action.isAuthenticatedUserProfile,
|
||||
countries: action.countries,
|
||||
};
|
||||
case SAVE_PROFILE.BEGIN:
|
||||
return {
|
||||
|
||||
@@ -41,7 +41,6 @@ export function* handleFetchProfile(action) {
|
||||
let preferences = {};
|
||||
let account = userAccount;
|
||||
let courseCertificates = null;
|
||||
let countries = [];
|
||||
|
||||
try {
|
||||
yield put(fetchProfileBegin());
|
||||
@@ -50,7 +49,6 @@ export function* handleFetchProfile(action) {
|
||||
const calls = [
|
||||
call(ProfileApiService.getAccount, username),
|
||||
call(ProfileApiService.getCourseCertificates, username),
|
||||
call(ProfileApiService.getCountryList),
|
||||
];
|
||||
|
||||
if (isAuthenticatedUserProfile) {
|
||||
@@ -63,9 +61,9 @@ export function* handleFetchProfile(action) {
|
||||
const result = yield all(calls);
|
||||
|
||||
if (isAuthenticatedUserProfile) {
|
||||
[account, courseCertificates, countries, preferences] = result;
|
||||
[account, courseCertificates, preferences] = result;
|
||||
} else {
|
||||
[account, courseCertificates, countries] = result;
|
||||
[account, courseCertificates] = result;
|
||||
}
|
||||
|
||||
// Set initial visibility values for account
|
||||
@@ -91,7 +89,6 @@ export function* handleFetchProfile(action) {
|
||||
preferences,
|
||||
courseCertificates,
|
||||
isAuthenticatedUserProfile,
|
||||
countries,
|
||||
));
|
||||
|
||||
yield put(fetchProfileReset());
|
||||
|
||||
@@ -19,7 +19,6 @@ jest.mock('./services', () => ({
|
||||
getPreferences: jest.fn(),
|
||||
getAccount: jest.fn(),
|
||||
getCourseCertificates: jest.fn(),
|
||||
getCountryList: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.mock('@edx/frontend-platform/auth', () => ({
|
||||
@@ -69,19 +68,17 @@ describe('RootSaga', () => {
|
||||
const action = profileActions.fetchProfile('gonzo');
|
||||
const gen = handleFetchProfile(action);
|
||||
|
||||
const result = [userAccount, [1, 2, 3], [], { preferences: 'stuff' }];
|
||||
const result = [userAccount, [1, 2, 3], { preferences: 'stuff' }];
|
||||
|
||||
expect(gen.next().value).toEqual(select(userAccountSelector));
|
||||
expect(gen.next(selectorData).value).toEqual(put(profileActions.fetchProfileBegin()));
|
||||
expect(gen.next().value).toEqual(all([
|
||||
call(ProfileApiService.getAccount, 'gonzo'),
|
||||
call(ProfileApiService.getCourseCertificates, 'gonzo'),
|
||||
call(ProfileApiService.getCountryList),
|
||||
call(ProfileApiService.getPreferences, 'gonzo'),
|
||||
|
||||
]));
|
||||
expect(gen.next(result).value)
|
||||
.toEqual(put(profileActions.fetchProfileSuccess(userAccount, result[3], result[1], true, [])));
|
||||
.toEqual(put(profileActions.fetchProfileSuccess(userAccount, result[2], result[1], true)));
|
||||
expect(gen.next().value).toEqual(put(profileActions.fetchProfileReset()));
|
||||
expect(gen.next().value).toBeUndefined();
|
||||
});
|
||||
@@ -91,7 +88,6 @@ describe('RootSaga', () => {
|
||||
username: 'gonzo',
|
||||
other: 'data',
|
||||
};
|
||||
const countries = [{ code: 'AX', name: 'Åland Islands' }, { code: 'AL', name: 'Albania' }];
|
||||
getAuthenticatedUser.mockReturnValue(userAccount);
|
||||
const selectorData = {
|
||||
userAccount,
|
||||
@@ -100,17 +96,16 @@ describe('RootSaga', () => {
|
||||
const action = profileActions.fetchProfile('booyah');
|
||||
const gen = handleFetchProfile(action);
|
||||
|
||||
const result = [{}, [1, 2, 3], countries];
|
||||
const result = [{}, [1, 2, 3]];
|
||||
|
||||
expect(gen.next().value).toEqual(select(userAccountSelector));
|
||||
expect(gen.next(selectorData).value).toEqual(put(profileActions.fetchProfileBegin()));
|
||||
expect(gen.next().value).toEqual(all([
|
||||
call(ProfileApiService.getAccount, 'booyah'),
|
||||
call(ProfileApiService.getCourseCertificates, 'booyah'),
|
||||
call(ProfileApiService.getCountryList),
|
||||
]));
|
||||
expect(gen.next(result).value)
|
||||
.toEqual(put(profileActions.fetchProfileSuccess(result[0], {}, result[1], false, countries)));
|
||||
.toEqual(put(profileActions.fetchProfileSuccess(result[0], {}, result[1], false)));
|
||||
expect(gen.next().value).toEqual(put(profileActions.fetchProfileReset()));
|
||||
expect(gen.next().value).toBeUndefined();
|
||||
});
|
||||
|
||||
@@ -23,7 +23,6 @@ export const isLoadingProfileSelector = state => state.profilePage.isLoadingProf
|
||||
export const currentlyEditingFieldSelector = state => state.profilePage.currentlyEditingField;
|
||||
export const accountErrorsSelector = state => state.profilePage.errors;
|
||||
export const isAuthenticatedUserProfileSelector = state => state.profilePage.isAuthenticatedUserProfile;
|
||||
export const countriesSelector = state => state.profilePage.countries;
|
||||
|
||||
export const editableFormModeSelector = createSelector(
|
||||
profileAccountSelector,
|
||||
@@ -113,15 +112,7 @@ export const sortedLanguagesSelector = createSelector(
|
||||
|
||||
export const sortedCountriesSelector = createSelector(
|
||||
localeSelector,
|
||||
countriesSelector,
|
||||
profileAccountSelector,
|
||||
(locale, countries, profileAccount) => {
|
||||
const countryList = getCountryList(locale);
|
||||
const countriesCodes = new Set(countries.map(({ code }) => code));
|
||||
const userCountryCode = profileAccount.country;
|
||||
|
||||
return countryList.filter(({ code }) => code === userCountryCode || countriesCodes.has(code));
|
||||
},
|
||||
locale => getCountryList(locale),
|
||||
);
|
||||
|
||||
export const preferredLanguageSelector = createSelector(
|
||||
@@ -139,12 +130,10 @@ export const countrySelector = createSelector(
|
||||
editableFormSelector,
|
||||
sortedCountriesSelector,
|
||||
countryMessagesSelector,
|
||||
countriesSelector,
|
||||
(editableForm, sortedCountries, countryMessages, countries) => ({
|
||||
(editableForm, sortedCountries, countryMessages) => ({
|
||||
...editableForm,
|
||||
sortedCountries,
|
||||
countryMessages,
|
||||
countries,
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ import { ensureConfig, getConfig } from '@edx/frontend-platform';
|
||||
import { getAuthenticatedHttpClient as getHttpClient } from '@edx/frontend-platform/auth';
|
||||
import { logError } from '@edx/frontend-platform/logging';
|
||||
import { camelCaseObject, convertKeyNames, snakeCaseObject } from '../utils';
|
||||
import { FIELD_LABELS } from './constants';
|
||||
|
||||
ensureConfig(['LMS_BASE_URL'], 'Profile API service');
|
||||
|
||||
@@ -148,21 +147,3 @@ export async function getCourseCertificates(username) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
function extractCountryList(data) {
|
||||
return data?.fields
|
||||
.find(({ name }) => name === FIELD_LABELS.COUNTRY)
|
||||
?.options?.map(({ value, name }) => ({ code: value, name })) || [];
|
||||
}
|
||||
|
||||
export async function getCountryList() {
|
||||
const url = `${getConfig().LMS_BASE_URL}/user_api/v1/account/registration/`;
|
||||
|
||||
try {
|
||||
const { data } = await getHttpClient().get(url);
|
||||
return extractCountryList(data);
|
||||
} catch (e) {
|
||||
logError(e);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ class Country extends React.Component {
|
||||
this.handleSubmit = this.handleSubmit.bind(this);
|
||||
this.handleClose = this.handleClose.bind(this);
|
||||
this.handleOpen = this.handleOpen.bind(this);
|
||||
this.isDisabledCountry = this.isDisabledCountry.bind(this);
|
||||
}
|
||||
|
||||
handleChange(e) {
|
||||
@@ -47,12 +46,6 @@ class Country extends React.Component {
|
||||
this.props.openHandler(this.props.formId);
|
||||
}
|
||||
|
||||
isDisabledCountry = (country) => {
|
||||
const { countries } = this.props;
|
||||
|
||||
return countries.length > 0 && !new Set(countries.map(({ code }) => code)).has(country);
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
formId,
|
||||
@@ -92,7 +85,7 @@ class Country extends React.Component {
|
||||
>
|
||||
<option value=""> </option>
|
||||
{sortedCountries.map(({ code, name }) => (
|
||||
<option key={code} value={code} disabled={this.isDisabledCountry(code)}>{name}</option>
|
||||
<option key={code} value={code}>{name}</option>
|
||||
))}
|
||||
</select>
|
||||
{error !== null && (
|
||||
@@ -164,10 +157,6 @@ Country.propTypes = {
|
||||
code: PropTypes.string.isRequired,
|
||||
name: PropTypes.string.isRequired,
|
||||
})).isRequired,
|
||||
countries: PropTypes.arrayOf(PropTypes.shape({
|
||||
code: PropTypes.string.isRequired,
|
||||
name: PropTypes.string.isRequired,
|
||||
})).isRequired,
|
||||
countryMessages: PropTypes.objectOf(PropTypes.string).isRequired,
|
||||
|
||||
// Actions
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
position: absolute;
|
||||
left: 1.5rem;
|
||||
top: 5.25rem;
|
||||
color: $gray-500;
|
||||
color: var(--pgn-color-gray-500);
|
||||
line-height: 0.9rem;
|
||||
font-size: 0.8rem;
|
||||
font-style: normal;
|
||||
@@ -42,12 +42,12 @@
|
||||
|
||||
.icon-visibility-off {
|
||||
height: 1rem;
|
||||
color: $gray-500;
|
||||
color: var(--pgn-color-gray-500);
|
||||
}
|
||||
|
||||
.profile-page {
|
||||
.edit-section-header {
|
||||
@extend .h6;
|
||||
font-size: var(--pgn-typography-font-size-h6-base);
|
||||
display: block;
|
||||
font-weight: normal;
|
||||
letter-spacing: 0;
|
||||
@@ -55,11 +55,11 @@
|
||||
}
|
||||
|
||||
label.edit-section-header {
|
||||
margin-bottom: $spacer * .5;
|
||||
margin-bottom: calc(var(--pgn-spacing-spacer-base) * .5);
|
||||
}
|
||||
|
||||
.profile-avatar-wrap {
|
||||
@include media-breakpoint-up(md) {
|
||||
@media (--pgn-size-breakpoint-min-width-md) {
|
||||
max-width: 12rem;
|
||||
margin-right: 0;
|
||||
margin-top: -8rem;
|
||||
@@ -77,25 +77,25 @@
|
||||
align-items: center;
|
||||
border-radius: 50%;
|
||||
|
||||
@include media-breakpoint-up(md) {
|
||||
@media (--pgn-size-breakpoint-min-width-md) {
|
||||
background: linear-gradient(to top, rgba(0,0,0,.65) 4rem, rgba(0,0,0,0) 4rem);
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.btn {
|
||||
text-decoration: none;
|
||||
@include media-breakpoint-up(md) {
|
||||
@media (--pgn-size-breakpoint-min-width-md) {
|
||||
margin-bottom: 1.2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.dropdown {
|
||||
@include media-breakpoint-up(md) {
|
||||
@media (--pgn-size-breakpoint-min-width-md) {
|
||||
margin-bottom: 1.2rem;
|
||||
}
|
||||
|
||||
.btn {
|
||||
color: $white;
|
||||
color: var(--pgn-color-white);
|
||||
background: transparent;
|
||||
border-color: transparent;
|
||||
margin: 0;
|
||||
@@ -108,7 +108,7 @@
|
||||
height: 5rem;
|
||||
position: relative;
|
||||
|
||||
@include media-breakpoint-up(md) {
|
||||
@media (--pgn-size-breakpoint-min-width-md) {
|
||||
width: 12rem;
|
||||
height: 12rem;
|
||||
}
|
||||
@@ -128,7 +128,7 @@
|
||||
border-radius:0;
|
||||
transition: opacity 200ms ease;
|
||||
|
||||
@include media-breakpoint-up(md) {
|
||||
@media (--pgn-size-breakpoint-min-width-md) {
|
||||
height: 4rem;
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
position: relative;
|
||||
|
||||
.certificate-title {
|
||||
font-family: $font-family-serif;
|
||||
font-family: var(--pgn-typography-font-family-serif);
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user