Compare commits
213 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2494ad2b57 | ||
|
|
3b2a2bfa95 | ||
|
|
30b91791e3 | ||
|
|
08592aeec7 | ||
|
|
c1d143ace2 | ||
|
|
54a879aec2 | ||
|
|
b5b37f1d64 | ||
|
|
36be99ace0 | ||
|
|
222bc19bd0 | ||
|
|
3d827e64ea | ||
|
|
8a247abd6a | ||
|
|
a6943fbaeb | ||
|
|
19292cd5b6 | ||
|
|
b6374a5c05 | ||
|
|
f6a4036b49 | ||
|
|
12a845ad33 | ||
|
|
a4a7456726 | ||
|
|
6fdf73fed3 | ||
|
|
32b8079744 | ||
|
|
b9f7fe74c8 | ||
|
|
5a259a76df | ||
|
|
d2ad5ee2a4 | ||
|
|
67fefe814b | ||
|
|
9a5b1fa5e7 | ||
|
|
55f21aeeaa | ||
|
|
fc24e61a1c | ||
|
|
bace8286fd | ||
|
|
665653e9a5 | ||
|
|
0cc2282c44 | ||
|
|
455ffd345c | ||
|
|
dde02a0739 | ||
|
|
81cb72f10b | ||
|
|
e285a91408 | ||
|
|
50142adb85 | ||
|
|
7281804fbd | ||
|
|
b446534992 | ||
|
|
3adc305aec | ||
|
|
65446ce9c3 | ||
|
|
f3637b5624 | ||
|
|
3c1d2152aa | ||
|
|
48b22ea41e | ||
|
|
ed76e40862 | ||
|
|
d5b07cc38f | ||
|
|
b9509bb890 | ||
|
|
c87a1049c8 | ||
|
|
e0c22e781d | ||
|
|
f1605d1f27 | ||
|
|
5d7826c26c | ||
|
|
5d075b0cdc | ||
|
|
1a86685f11 | ||
|
|
e31597509c | ||
|
|
c79c137fd6 | ||
|
|
76f735ed39 | ||
|
|
2298791aeb | ||
|
|
9f48ccc66b | ||
|
|
398479d2e7 | ||
|
|
3d6d815373 | ||
|
|
287bf50a46 | ||
|
|
677e872320 | ||
|
|
d8ecfd6fa3 | ||
|
|
9a6074868b | ||
|
|
077ecf38a4 | ||
|
|
7d6aa276ec | ||
|
|
115e69fad3 | ||
|
|
3e04f76c81 | ||
|
|
83eeb88eab | ||
|
|
a05570ed37 | ||
|
|
058a846978 | ||
|
|
04cd95824e | ||
|
|
678b95f60d | ||
|
|
599f513624 | ||
|
|
e8ce471f6f | ||
|
|
4e727748af | ||
|
|
79c5bbff68 | ||
|
|
a95b600a00 | ||
|
|
464e952a1e | ||
|
|
018ca18a4e | ||
|
|
4b89e7561f | ||
|
|
da08e721c2 | ||
|
|
d037e96a0c | ||
|
|
050dd30d8f | ||
|
|
3dd41030d3 | ||
|
|
27228f093d | ||
|
|
83f3241e26 | ||
|
|
e153aefc13 | ||
|
|
936c8714b7 | ||
|
|
6b18f28933 | ||
|
|
0ce451cfd2 | ||
|
|
42e831a693 | ||
|
|
9af7eaf587 | ||
|
|
3fbbde1044 | ||
|
|
c3f0282be4 | ||
|
|
ceb9c13542 | ||
|
|
7229bff3ff | ||
|
|
0695d4f400 | ||
|
|
de8783c708 | ||
|
|
e2540bc3a0 | ||
|
|
ffb5a765e2 | ||
|
|
952e543217 | ||
|
|
0e6a272f2b | ||
|
|
45a1da9f5e | ||
|
|
022515d1d2 | ||
|
|
2d737aae7f | ||
|
|
4c4db14eac | ||
|
|
911cea6a0e | ||
|
|
a52ddfd9bd | ||
|
|
8175ba897a | ||
|
|
cfda72b2e2 | ||
|
|
4483a734bc | ||
|
|
db1903cdce | ||
|
|
71851b13a6 | ||
|
|
6efa31092d | ||
|
|
c3541a3d79 | ||
|
|
dad01fcd78 | ||
|
|
30e6eed60d | ||
|
|
de69ed3dd9 | ||
|
|
1d55df323f | ||
|
|
4e718f85de | ||
|
|
a211547a1d | ||
|
|
784e9afccf | ||
|
|
4b23d8c4e4 | ||
|
|
6d02e63d08 | ||
|
|
b1feed2443 | ||
|
|
cabf4e3f27 | ||
|
|
78a40d47c1 | ||
|
|
c7178afe6b | ||
|
|
18a6840037 | ||
|
|
583a487c38 | ||
|
|
3276496523 | ||
|
|
7ab55175b5 | ||
|
|
72e82005c0 | ||
|
|
c4df727178 | ||
|
|
1f6766175d | ||
|
|
2ac8988a9b | ||
|
|
642be093c7 | ||
|
|
86939a2559 | ||
|
|
8ed18f3d69 | ||
|
|
061746da9f | ||
|
|
de77aa5f0c | ||
|
|
7034d10536 | ||
|
|
4ce7311809 | ||
|
|
e76f5b6937 | ||
|
|
f8fc794458 | ||
|
|
a5069edd94 | ||
|
|
2543926c95 | ||
|
|
c5eb43a2a5 | ||
|
|
256fa5c9d8 | ||
|
|
267cce9f89 | ||
|
|
4f59c80a12 | ||
|
|
59afd596ab | ||
|
|
0c83268163 | ||
|
|
c5f5fa9281 | ||
|
|
e247aee372 | ||
|
|
f6ae5a4bdd | ||
|
|
057d16d3c1 | ||
|
|
93bb38d0bd | ||
|
|
01405eaff9 | ||
|
|
59fa6e2a35 | ||
|
|
9fc3a0e835 | ||
|
|
22e157adf6 | ||
|
|
6b81f69eba | ||
|
|
cefa84006c | ||
|
|
a54309dd63 | ||
|
|
aeb0fd2be7 | ||
|
|
26eb2bb4c7 | ||
|
|
8083079954 | ||
|
|
d4fc8489ea | ||
|
|
4020a81bd4 | ||
|
|
acf1adba80 | ||
|
|
a204ff8c03 | ||
|
|
e8ccc4b707 | ||
|
|
4d86780c73 | ||
|
|
fdbb83f51e | ||
|
|
f6e4664d37 | ||
|
|
65177fcdcc | ||
|
|
7601249fb6 | ||
|
|
c8ef3dad93 | ||
|
|
b02fe00c71 | ||
|
|
4404aede33 | ||
|
|
1b0edb10c4 | ||
|
|
546adff45e | ||
|
|
94b14fd618 | ||
|
|
5b8a9a587b | ||
|
|
2650cb59b3 | ||
|
|
bc2b13175a | ||
|
|
85e8094833 | ||
|
|
aff8dda3ee | ||
|
|
51b505552d | ||
|
|
3648f1b6be | ||
|
|
c78b6964b9 | ||
|
|
664d05134b | ||
|
|
b969522cd0 | ||
|
|
0cd8210ea7 | ||
|
|
1c763c2102 | ||
|
|
073003284a | ||
|
|
92fdf85c9a | ||
|
|
5ee8a8c75c | ||
|
|
536d67404f | ||
|
|
9d99bfcec6 | ||
|
|
3180c9d973 | ||
|
|
1645274d9f | ||
|
|
84e43cb038 | ||
|
|
994b21c0c1 | ||
|
|
940b45ba7e | ||
|
|
4efa0a07ae | ||
|
|
2bd6879bda | ||
|
|
b479f0b376 | ||
|
|
dfdcbc0a8d | ||
|
|
c3b02a2946 | ||
|
|
f6c1a8bcc1 | ||
|
|
6c02962e0d | ||
|
|
acaf98f0b1 | ||
|
|
64f55150b6 |
@@ -1,4 +1,6 @@
|
|||||||
ACCESS_TOKEN_COOKIE_NAME=edx-jwt-cookie-header-payload
|
ACCESS_TOKEN_COOKIE_NAME=edx-jwt-cookie-header-payload
|
||||||
|
ACCOUNT_PROFILE_URL=http://localhost:1995
|
||||||
|
ACCOUNT_SETTINGS_URL=http://localhost:1997
|
||||||
BASE_URL=localhost:8080
|
BASE_URL=localhost:8080
|
||||||
CREDENTIALS_BASE_URL=http://localhost:18150
|
CREDENTIALS_BASE_URL=http://localhost:18150
|
||||||
CSRF_TOKEN_API_PATH=/csrf/api/v1/token
|
CSRF_TOKEN_API_PATH=/csrf/api/v1/token
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||||
const { createConfig } = require('@edx/frontend-build');
|
const { createConfig } = require('@edx/frontend-build');
|
||||||
|
|
||||||
module.exports = createConfig('eslint');
|
module.exports = createConfig('eslint');
|
||||||
|
|||||||
@@ -16,4 +16,4 @@ jobs:
|
|||||||
secrets:
|
secrets:
|
||||||
GITHUB_APP_ID: ${{ secrets.GRAPHQL_AUTH_APP_ID }}
|
GITHUB_APP_ID: ${{ secrets.GRAPHQL_AUTH_APP_ID }}
|
||||||
GITHUB_APP_PRIVATE_KEY: ${{ secrets.GRAPHQL_AUTH_APP_PEM }}
|
GITHUB_APP_PRIVATE_KEY: ${{ secrets.GRAPHQL_AUTH_APP_PEM }}
|
||||||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_ISSUE_BOT_TOKEN }}
|
SLACK_BOT_TOKEN: ${{ secrets.SLACK_ISSUE_BOT_TOKEN }}
|
||||||
|
|||||||
20
.github/workflows/add-remove-label-on-comment.yml
vendored
Normal file
20
.github/workflows/add-remove-label-on-comment.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# This workflow runs when a comment is made on the ticket
|
||||||
|
# If the comment starts with "label: " it tries to apply
|
||||||
|
# the label indicated in rest of comment.
|
||||||
|
# If the comment starts with "remove label: ", it tries
|
||||||
|
# to remove the indicated label.
|
||||||
|
# Note: Labels are allowed to have spaces and this script does
|
||||||
|
# not parse spaces (as often a space is legitimate), so the command
|
||||||
|
# "label: really long lots of words label" will apply the
|
||||||
|
# label "really long lots of words label"
|
||||||
|
|
||||||
|
name: Allows for the adding and removing of labels via comment
|
||||||
|
|
||||||
|
on:
|
||||||
|
issue_comment:
|
||||||
|
types: [created]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
add_remove_labels:
|
||||||
|
uses: openedx/.github/.github/workflows/add-remove-label-on-comment.yml@master
|
||||||
|
|
||||||
13
.github/workflows/ci.yml
vendored
13
.github/workflows/ci.yml
vendored
@@ -9,18 +9,17 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
tests:
|
tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
node: [16]
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
- name: Setup Nodejs Env
|
||||||
|
run: echo "NODE_VER=`cat .nvmrc`" >> $GITHUB_ENV
|
||||||
- name: Setup Nodejs
|
- name: Setup Nodejs
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node }}
|
node-version: ${{ env.NODE_VER }}
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
- name: Validate package-lock.json changes
|
- name: Validate package-lock.json changes
|
||||||
@@ -34,4 +33,4 @@ jobs:
|
|||||||
- name: i18n_extract
|
- name: i18n_extract
|
||||||
run: npm run i18n_extract
|
run: npm run i18n_extract
|
||||||
- name: Coverage
|
- name: Coverage
|
||||||
uses: codecov/codecov-action@v2
|
uses: codecov/codecov-action@v3
|
||||||
|
|||||||
3
.github/workflows/lockfileversion-check.yml
vendored
3
.github/workflows/lockfileversion-check.yml
vendored
@@ -10,5 +10,4 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
version-check:
|
version-check:
|
||||||
uses: openedx/.github/.github/workflows/lockfileversion-check.yml@master
|
uses: openedx/.github/.github/workflows/lockfile-check.yml@master
|
||||||
|
|
||||||
|
|||||||
13
.github/workflows/release.yml
vendored
13
.github/workflows/release.yml
vendored
@@ -3,19 +3,22 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
- alpha
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
name: Release
|
name: Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
- name: Setup Nodejs Env
|
||||||
|
run: echo "NODE_VER=`cat .nvmrc`" >> $GITHUB_ENV
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 16
|
node-version: ${{ env.NODE_VER }}
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
- name: Validate package-lock.json changes
|
- name: Validate package-lock.json changes
|
||||||
@@ -27,11 +30,11 @@ jobs:
|
|||||||
- name: i18n_extract
|
- name: i18n_extract
|
||||||
run: npm run i18n_extract
|
run: npm run i18n_extract
|
||||||
- name: Coverage
|
- name: Coverage
|
||||||
uses: codecov/codecov-action@v2
|
uses: codecov/codecov-action@v3
|
||||||
- name: Build
|
- name: Build
|
||||||
run: npm run build
|
run: npm run build
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: cycjimmy/semantic-release-action@v2
|
uses: cycjimmy/semantic-release-action@v3
|
||||||
with:
|
with:
|
||||||
semantic_version: 16
|
semantic_version: 16
|
||||||
env:
|
env:
|
||||||
|
|||||||
12
.github/workflows/self-assign-issue.yml
vendored
Normal file
12
.github/workflows/self-assign-issue.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# This workflow runs when a comment is made on the ticket
|
||||||
|
# If the comment starts with "assign me" it assigns the author to the
|
||||||
|
# ticket (case insensitive)
|
||||||
|
|
||||||
|
name: Assign comment author to ticket if they say "assign me"
|
||||||
|
on:
|
||||||
|
issue_comment:
|
||||||
|
types: [created]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
self_assign_by_comment:
|
||||||
|
uses: openedx/.github/.github/workflows/self-assign-issue.yml@master
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
"branch": "master",
|
"branches": [
|
||||||
|
"master",
|
||||||
|
{name: "alpha", prerelease: true}
|
||||||
|
],
|
||||||
"tagFormat": "v${version}",
|
"tagFormat": "v${version}",
|
||||||
"verifyConditions": [
|
"verifyConditions": [
|
||||||
"@semantic-release/npm",
|
"@semantic-release/npm",
|
||||||
|
|||||||
14
Makefile
14
Makefile
@@ -1,14 +1,12 @@
|
|||||||
transifex_resource = frontend-component-header
|
export TRANSIFEX_RESOURCE = frontend-component-header
|
||||||
transifex_langs = "ar,fr,es_419,zh_CN,pt,it,de,uk,ru,hi,fr_CA"
|
transifex_langs = "ar,fr,es_419,zh_CN,pt,it,de,uk,ru,hi,fr_CA"
|
||||||
|
|
||||||
transifex_utils = ./node_modules/.bin/transifex-utils.js
|
transifex_utils = ./node_modules/.bin/transifex-utils.js
|
||||||
i18n = ./src/i18n
|
i18n = ./src/i18n
|
||||||
transifex_input = $(i18n)/transifex_input.json
|
transifex_input = $(i18n)/transifex_input.json
|
||||||
tx_url1 = https://www.transifex.com/api/2/project/edx-platform/resource/$(transifex_resource)/translation/en/strings/
|
|
||||||
tx_url2 = https://www.transifex.com/api/2/project/edx-platform/resource/$(transifex_resource)/source/
|
|
||||||
|
|
||||||
# This directory must match .babelrc .
|
# This directory must match .babelrc .
|
||||||
transifex_temp = ./temp/babel-plugin-react-intl
|
transifex_temp = ./temp/babel-plugin-formatjs
|
||||||
|
|
||||||
build:
|
build:
|
||||||
rm -rf ./dist
|
rm -rf ./dist
|
||||||
@@ -19,7 +17,7 @@ build:
|
|||||||
@rm -rf dist/__mocks__
|
@rm -rf dist/__mocks__
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
npm install
|
npm ci
|
||||||
|
|
||||||
i18n.extract:
|
i18n.extract:
|
||||||
# Pulling display strings from .jsx files into .json files...
|
# Pulling display strings from .jsx files into .json files...
|
||||||
@@ -42,11 +40,11 @@ push_translations:
|
|||||||
# Pushing strings to Transifex...
|
# Pushing strings to Transifex...
|
||||||
tx push -s
|
tx push -s
|
||||||
# Fetching hashes from Transifex...
|
# Fetching hashes from Transifex...
|
||||||
./node_modules/reactifex/bash_scripts/get_hashed_strings.sh $(tx_url1)
|
./node_modules/@edx/reactifex/bash_scripts/get_hashed_strings_v3.sh
|
||||||
# Writing out comments to file...
|
# Writing out comments to file...
|
||||||
$(transifex_utils) $(transifex_temp) --comments
|
$(transifex_utils) $(transifex_temp) --comments --v3-scripts-path
|
||||||
# Pushing comments to Transifex...
|
# Pushing comments to Transifex...
|
||||||
./node_modules/reactifex/bash_scripts/put_comments.sh $(tx_url2)
|
./node_modules/@edx/reactifex/bash_scripts/put_comments_v3.sh
|
||||||
|
|
||||||
# Pulls translations from Transifex.
|
# Pulls translations from Transifex.
|
||||||
pull_translations:
|
pull_translations:
|
||||||
|
|||||||
126
README.rst
126
README.rst
@@ -2,22 +2,42 @@
|
|||||||
frontend-component-header
|
frontend-component-header
|
||||||
#########################
|
#########################
|
||||||
|
|
||||||
|Build Status| |Codecov| |npm_version| |npm_downloads| |license| |semantic-release|
|
|license| |Build Status| |Codecov| |npm_version| |npm_downloads| |semantic-release|
|
||||||
|
|
||||||
********
|
********
|
||||||
Overview
|
Purpose
|
||||||
********
|
********
|
||||||
|
|
||||||
A generic header for Open edX micro-frontend applications.
|
A generic header for Open edX micro-frontend applications.
|
||||||
|
|
||||||
************
|
************
|
||||||
Requirements
|
Getting Started
|
||||||
************
|
************
|
||||||
|
|
||||||
|
Prerequisites
|
||||||
|
=============
|
||||||
|
|
||||||
|
The `devstack`_ is currently recommended as a development environment for your
|
||||||
|
new MFE. If you start it with ``make dev.up.lms`` that should give you
|
||||||
|
everything you need as a companion to this frontend.
|
||||||
|
|
||||||
|
Note that it is also possible to use `Tutor`_ to develop an MFE. You can refer
|
||||||
|
to the `relevant tutor-mfe documentation`_ to get started using it.
|
||||||
|
|
||||||
|
.. _Devstack: https://github.com/openedx/devstack
|
||||||
|
|
||||||
|
.. _Tutor: https://github.com/overhangio/tutor
|
||||||
|
|
||||||
|
.. _relevant tutor-mfe documentation: https://github.com/overhangio/tutor-mfe#mfe-development
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
============
|
||||||
|
|
||||||
This component uses ``@edx/frontend-platform`` services such as i18n, analytics, configuration, and the ``AppContext`` React component, and expects that it has been loaded into a micro-frontend that has been properly initialized via ``@edx/frontend-platform``'s ``initialize`` function. `Please visit the frontend template application to see an example. <https://github.com/openedx/frontend-template-application/blob/master/src/index.jsx>`_
|
This component uses ``@edx/frontend-platform`` services such as i18n, analytics, configuration, and the ``AppContext`` React component, and expects that it has been loaded into a micro-frontend that has been properly initialized via ``@edx/frontend-platform``'s ``initialize`` function. `Please visit the frontend template application to see an example. <https://github.com/openedx/frontend-template-application/blob/master/src/index.jsx>`_
|
||||||
|
|
||||||
|
|
||||||
Environment Variables
|
Environment Variables
|
||||||
=====================
|
====================
|
||||||
|
|
||||||
* ``LMS_BASE_URL`` - The URL of the LMS of your Open edX instance.
|
* ``LMS_BASE_URL`` - The URL of the LMS of your Open edX instance.
|
||||||
* ``LOGOUT_URL`` - The URL of the API endpoint which performs a user logout.
|
* ``LOGOUT_URL`` - The URL of the API endpoint which performs a user logout.
|
||||||
@@ -26,13 +46,14 @@ Environment Variables
|
|||||||
Defaults to "localhost" in development.
|
Defaults to "localhost" in development.
|
||||||
* ``LOGO_URL`` - The URL of the site's logo. This logo is displayed in the header.
|
* ``LOGO_URL`` - The URL of the site's logo. This logo is displayed in the header.
|
||||||
* ``ORDER_HISTORY_URL`` - The URL of the order history page.
|
* ``ORDER_HISTORY_URL`` - The URL of the order history page.
|
||||||
|
* ``ACCOUNT_PROFILE_URL`` - The URL of the account profile page.
|
||||||
|
* ``ACCOUNT_SETTINGS_URL`` - The URL of the account settings page.
|
||||||
* ``AUTHN_MINIMAL_HEADER`` - A boolean flag which hides the main menu, user menu, and logged-out
|
* ``AUTHN_MINIMAL_HEADER`` - A boolean flag which hides the main menu, user menu, and logged-out
|
||||||
menu items when truthy. This is intended to be used in micro-frontends like
|
menu items when truthy. This is intended to be used in micro-frontends like
|
||||||
frontend-app-authentication in which these menus are considered distractions from the user's task.
|
frontend-app-authentication in which these menus are considered distractions from the user's task.
|
||||||
|
|
||||||
************
|
|
||||||
Installation
|
Installation
|
||||||
************
|
============
|
||||||
|
|
||||||
To install this header into your Open edX micro-frontend, run the following command in your MFE:
|
To install this header into your Open edX micro-frontend, run the following command in your MFE:
|
||||||
|
|
||||||
@@ -40,9 +61,33 @@ To install this header into your Open edX micro-frontend, run the following comm
|
|||||||
|
|
||||||
This will make the component available to be imported into your application.
|
This will make the component available to be imported into your application.
|
||||||
|
|
||||||
*****
|
Cloning and Startup
|
||||||
|
===================
|
||||||
|
|
||||||
|
.. code-block::
|
||||||
|
|
||||||
|
|
||||||
|
1. Clone your new repo:
|
||||||
|
|
||||||
|
``git clone https://github.com/openedx/frontend-component-header.git``
|
||||||
|
|
||||||
|
2. Use node v18.x.
|
||||||
|
|
||||||
|
The current version of the micro-frontend build scripts support node 18.
|
||||||
|
Using other major versions of node *may* work, but this is unsupported. For
|
||||||
|
convenience, this repository includes an .nvmrc file to help in setting the
|
||||||
|
correct node version via `nvm <https://github.com/nvm-sh/nvm>`_.
|
||||||
|
|
||||||
|
3. Install npm dependencies:
|
||||||
|
|
||||||
|
``cd frontend-component-header && npm ci``
|
||||||
|
|
||||||
|
4. Start the dev server:
|
||||||
|
|
||||||
|
``npm start``
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
*****
|
=====
|
||||||
|
|
||||||
This library has the following exports:
|
This library has the following exports:
|
||||||
|
|
||||||
@@ -56,14 +101,12 @@ Examples
|
|||||||
* `An example of component and messages usage. <https://github.com/openedx/frontend-template-application/blob/3355bb3a96232390e9056f35b06ffa8f105ed7ca/src/index.jsx#L21>`_
|
* `An example of component and messages usage. <https://github.com/openedx/frontend-template-application/blob/3355bb3a96232390e9056f35b06ffa8f105ed7ca/src/index.jsx#L21>`_
|
||||||
* `An example of SCSS file usage. <https://github.com/openedx/frontend-template-application/blob/3cd5485bf387b8c479baf6b02bf59e3061dc3465/src/index.scss#L8>`_
|
* `An example of SCSS file usage. <https://github.com/openedx/frontend-template-application/blob/3cd5485bf387b8c479baf6b02bf59e3061dc3465/src/index.scss#L8>`_
|
||||||
|
|
||||||
|
|
||||||
***********
|
|
||||||
Development
|
Development
|
||||||
***********
|
===========
|
||||||
|
|
||||||
Install dependencies::
|
Install dependencies::
|
||||||
|
|
||||||
npm i
|
npm ci
|
||||||
|
|
||||||
Start the development server::
|
Start the development server::
|
||||||
|
|
||||||
@@ -73,6 +116,63 @@ Build a production distribution::
|
|||||||
|
|
||||||
npm run build
|
npm run build
|
||||||
|
|
||||||
|
License
|
||||||
|
=======
|
||||||
|
|
||||||
|
The code in this repository is licensed under the AGPLv3 unless otherwise
|
||||||
|
noted.
|
||||||
|
|
||||||
|
Please see `LICENSE <LICENSE>`_ for details.
|
||||||
|
|
||||||
|
Contributing
|
||||||
|
============
|
||||||
|
|
||||||
|
Contributions are very welcome. Please read `How To Contribute`_ for details.
|
||||||
|
|
||||||
|
.. _How To Contribute: https://openedx.org/r/how-to-contribute
|
||||||
|
|
||||||
|
This project is currently accepting all types of contributions, bug fixes,
|
||||||
|
security fixes, maintenance work, or new features. However, please make sure
|
||||||
|
to have a discussion about your new feature idea with the maintainers prior to
|
||||||
|
beginning development to maximize the chances of your change being accepted.
|
||||||
|
You can start a conversation by creating a new issue on this repo summarizing
|
||||||
|
your idea.
|
||||||
|
|
||||||
|
Getting Help
|
||||||
|
===========
|
||||||
|
|
||||||
|
If you're having trouble, we have discussion forums at
|
||||||
|
https://discuss.openedx.org where you can connect with others in the community.
|
||||||
|
|
||||||
|
Our real-time conversations are on Slack. You can request a `Slack
|
||||||
|
invitation`_, then join our `community Slack workspace`_. Because this is a
|
||||||
|
frontend repository, the best place to discuss it would be in the `#wg-frontend
|
||||||
|
channel`_.
|
||||||
|
|
||||||
|
For anything non-trivial, the best path is to open an issue in this repository
|
||||||
|
with as many details about the issue you are facing as you can provide.
|
||||||
|
|
||||||
|
https://github.com/openedx/frontend-component-header/issues
|
||||||
|
|
||||||
|
For more information about these options, see the `Getting Help`_ page.
|
||||||
|
|
||||||
|
.. _Slack invitation: https://openedx.org/slack
|
||||||
|
.. _community Slack workspace: https://openedx.slack.com/
|
||||||
|
.. _#wg-frontend channel: https://openedx.slack.com/archives/C04BM6YC7A6
|
||||||
|
.. _Getting Help: https://openedx.org/community/connect
|
||||||
|
|
||||||
|
The Open edX Code of Conduct
|
||||||
|
============================
|
||||||
|
|
||||||
|
All community members are expected to follow the `Open edX Code of Conduct`_.
|
||||||
|
|
||||||
|
.. _Open edX Code of Conduct: https://openedx.org/code-of-conduct/
|
||||||
|
|
||||||
|
Reporting Security Issues
|
||||||
|
=========================
|
||||||
|
|
||||||
|
Please do not report security issues in public. Please email security@openedx.org.
|
||||||
|
|
||||||
.. |Build Status| image:: https://api.travis-ci.com/edx/frontend-component-header.svg?branch=master
|
.. |Build Status| image:: https://api.travis-ci.com/edx/frontend-component-header.svg?branch=master
|
||||||
:target: https://travis-ci.com/edx/frontend-component-header
|
:target: https://travis-ci.com/edx/frontend-component-header
|
||||||
.. |Codecov| image:: https://img.shields.io/codecov/c/github/edx/frontend-component-header
|
.. |Codecov| image:: https://img.shields.io/codecov/c/github/edx/frontend-component-header
|
||||||
@@ -84,4 +184,4 @@ Build a production distribution::
|
|||||||
.. |license| image:: https://img.shields.io/npm/l/@edx/frontend-component-header.svg
|
.. |license| image:: https://img.shields.io/npm/l/@edx/frontend-component-header.svg
|
||||||
:target: @edx/frontend-component-header
|
:target: @edx/frontend-component-header
|
||||||
.. |semantic-release| image:: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
|
.. |semantic-release| image:: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
|
||||||
:target: https://github.com/semantic-release/semantic-release
|
:target: https://github.com/semantic-release/semantic-release
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
const { createConfig } = require('@edx/frontend-build');
|
const { createConfig } = require('@openedx/frontend-build');
|
||||||
|
|
||||||
module.exports = createConfig('babel-preserve-modules');
|
module.exports = createConfig('babel-preserve-modules');
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { AppContext, AppProvider } from '@edx/frontend-platform/react';
|
|||||||
import Header from '@edx/frontend-component-header';
|
import Header from '@edx/frontend-component-header';
|
||||||
|
|
||||||
import './index.scss';
|
import './index.scss';
|
||||||
|
import StudioHeader from '../src/studio-header/StudioHeader';
|
||||||
|
|
||||||
subscribe(APP_READY, () => {
|
subscribe(APP_READY, () => {
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
@@ -32,7 +33,35 @@ subscribe(APP_READY, () => {
|
|||||||
}}>
|
}}>
|
||||||
<Header />
|
<Header />
|
||||||
</AppContext.Provider>
|
</AppContext.Provider>
|
||||||
<h5 className="mt-2">Logged in state</h5>
|
<h5 className="mt-2 mb-5">Logged in state</h5>
|
||||||
|
<AppContext.Provider value={{
|
||||||
|
authenticatedUser: {
|
||||||
|
userId: '123abc',
|
||||||
|
username: 'testuser',
|
||||||
|
roles: [],
|
||||||
|
administrator: false,
|
||||||
|
},
|
||||||
|
config: getConfig(),
|
||||||
|
}}>
|
||||||
|
<StudioHeader
|
||||||
|
number="run123"
|
||||||
|
org="testX"
|
||||||
|
title="Course Name"
|
||||||
|
isHiddenMainMenu={false}
|
||||||
|
mainMenuDropdowns={[
|
||||||
|
{
|
||||||
|
id: 'content-dropdown',
|
||||||
|
buttonTitle: 'Content',
|
||||||
|
items: [{
|
||||||
|
href: '#',
|
||||||
|
title: 'Outline',
|
||||||
|
}],
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
outlineLink="#"
|
||||||
|
/>
|
||||||
|
</AppContext.Provider>
|
||||||
|
<h5 className="mt-2">Logged in state for Studio header</h5>
|
||||||
</AppProvider>,
|
</AppProvider>,
|
||||||
document.getElementById('root'),
|
document.getElementById('root'),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
@import "@edx/brand/paragon/fonts";
|
@import "@edx/brand/paragon/fonts";
|
||||||
@import "@edx/brand/paragon/variables";
|
@import "@edx/brand/paragon/variables";
|
||||||
@import "@edx/paragon/scss/core/core";
|
@import "@openedx/paragon/scss/core/core";
|
||||||
@import "@edx/brand/paragon/overrides";
|
@import "@edx/brand/paragon/overrides";
|
||||||
|
|
||||||
@import "@edx/frontend-component-header/index";
|
@import "@edx/frontend-component-header/index";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const { createConfig } = require('@edx/frontend-build');
|
const { createConfig } = require('@openedx/frontend-build');
|
||||||
|
|
||||||
module.exports = createConfig('jest', {
|
module.exports = createConfig('jest', {
|
||||||
setupFilesAfterEnv: [
|
setupFilesAfterEnv: [
|
||||||
|
|||||||
42910
package-lock.json
generated
42910
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
63
package.json
63
package.json
@@ -8,7 +8,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "make build",
|
"build": "make build",
|
||||||
"i18n_extract": "BABEL_ENV=i18n fedx-scripts babel src --quiet > /dev/null",
|
"i18n_extract": "fedx-scripts formatjs extract",
|
||||||
"lint": "fedx-scripts eslint --ext .js --ext .jsx .",
|
"lint": "fedx-scripts eslint --ext .js --ext .jsx .",
|
||||||
"snapshot": "fedx-scripts jest --updateSnapshot",
|
"snapshot": "fedx-scripts jest --updateSnapshot",
|
||||||
"start": "fedx-scripts webpack-dev-server --progress",
|
"start": "fedx-scripts webpack-dev-server --progress",
|
||||||
@@ -33,44 +33,43 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/openedx/frontend-component-header#readme",
|
"homepage": "https://github.com/openedx/frontend-component-header#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@edx/brand": "npm:@edx/brand-openedx@1.1.0",
|
"@edx/brand": "npm:@openedx/brand-openedx@^1.2.2",
|
||||||
"@edx/frontend-build": "11.0.2",
|
"@edx/browserslist-config": "^1.1.1",
|
||||||
"@edx/frontend-platform": "2.6.2",
|
"@edx/frontend-platform": "6.2.0",
|
||||||
"@edx/paragon": "19.25.3",
|
"@edx/reactifex": "^2.1.1",
|
||||||
"codecov": "3.8.3",
|
"@openedx/frontend-build": "13.0.27",
|
||||||
"enzyme": "3.11.0",
|
"@openedx/paragon": "22.0.0",
|
||||||
"enzyme-adapter-react-16": "1.15.6",
|
"@testing-library/dom": "9.3.4",
|
||||||
"husky": "7.0.4",
|
"@testing-library/jest-dom": "5.17.0",
|
||||||
"prop-types": "15.8.1",
|
"@testing-library/react": "10.4.9",
|
||||||
"react": "16.14.0",
|
"husky": "8.0.3",
|
||||||
"react-dom": "16.14.0",
|
"jest": "29.7.0",
|
||||||
"react-redux": "7.2.9",
|
|
||||||
"react-router-dom": "5.3.4",
|
|
||||||
"react-test-renderer": "16.14.0",
|
|
||||||
"reactifex": "1.1.1",
|
|
||||||
"redux": "4.2.0",
|
|
||||||
"redux-saga": "1.1.3",
|
|
||||||
"@testing-library/dom": "8.18.1",
|
|
||||||
"@testing-library/jest-dom": "5.16.5",
|
|
||||||
"jest": "28.1.3",
|
|
||||||
"jest-chain": "1.1.6",
|
"jest-chain": "1.1.6",
|
||||||
"@testing-library/react": "10.4.9"
|
"prop-types": "15.8.1",
|
||||||
|
"react": "17.0.2",
|
||||||
|
"react-dom": "17.0.2",
|
||||||
|
"react-redux": "7.2.9",
|
||||||
|
"react-router-dom": "6.21.3",
|
||||||
|
"react-test-renderer": "17.0.2",
|
||||||
|
"redux": "4.2.1",
|
||||||
|
"redux-saga": "1.3.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@fortawesome/fontawesome-svg-core": "6.5.1",
|
||||||
|
"@fortawesome/free-brands-svg-icons": "6.5.1",
|
||||||
|
"@fortawesome/free-regular-svg-icons": "6.5.1",
|
||||||
|
"@fortawesome/free-solid-svg-icons": "6.5.1",
|
||||||
|
"@fortawesome/react-fontawesome": "^0.2.0",
|
||||||
|
"axios-mock-adapter": "1.22.0",
|
||||||
"babel-polyfill": "6.26.0",
|
"babel-polyfill": "6.26.0",
|
||||||
"react-responsive": "8.2.0",
|
"react-responsive": "8.2.0",
|
||||||
"react-transition-group": "4.4.5",
|
"react-transition-group": "4.4.5"
|
||||||
"@fortawesome/fontawesome-svg-core": "1.2.36",
|
|
||||||
"@fortawesome/free-brands-svg-icons": "5.15.4",
|
|
||||||
"@fortawesome/free-regular-svg-icons": "5.15.4",
|
|
||||||
"@fortawesome/free-solid-svg-icons": "5.15.4",
|
|
||||||
"@fortawesome/react-fontawesome": "^0.2.0"
|
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@edx/frontend-platform": "^2.0.0",
|
"@edx/frontend-platform": "^7.0.0",
|
||||||
"@edx/paragon": ">= 7.0.0 < 21.0.0",
|
|
||||||
"prop-types": "^15.5.10",
|
"prop-types": "^15.5.10",
|
||||||
"react": "^16.9.0",
|
"react": "^16.9.0 || ^17.0.0",
|
||||||
"react-dom": "^16.9.0"
|
"react-dom": "^16.9.0 || ^17.0.0",
|
||||||
|
"@openedx/paragon": ">= 21.5.7 < 23.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,11 @@
|
|||||||
"pin"
|
"pin"
|
||||||
],
|
],
|
||||||
"automerge": true
|
"automerge": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"matchPackagePatterns": ["@edx", "@openedx"],
|
||||||
|
"matchUpdateTypes": ["minor", "patch"],
|
||||||
|
"automerge": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"timezone": "America/New_York"
|
"timezone": "America/New_York"
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ import PropTypes from 'prop-types';
|
|||||||
|
|
||||||
import { AvatarIcon } from './Icons';
|
import { AvatarIcon } from './Icons';
|
||||||
|
|
||||||
function Avatar({
|
const Avatar = ({
|
||||||
size,
|
size,
|
||||||
src,
|
src,
|
||||||
alt,
|
alt,
|
||||||
className,
|
className,
|
||||||
}) {
|
}) => {
|
||||||
const avatar = src ? (
|
const avatar = src ? (
|
||||||
<img className="d-block w-100 h-100" src={src} alt={alt} />
|
<img className="d-block w-100 h-100" src={src} alt={alt} />
|
||||||
) : (
|
) : (
|
||||||
@@ -23,7 +23,7 @@ function Avatar({
|
|||||||
{avatar}
|
{avatar}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
Avatar.propTypes = {
|
Avatar.propTypes = {
|
||||||
src: PropTypes.string,
|
src: PropTypes.string,
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ subscribe(APP_CONFIG_INITIALIZED, () => {
|
|||||||
}, 'Header additional config');
|
}, 'Header additional config');
|
||||||
});
|
});
|
||||||
|
|
||||||
function Header({ intl }) {
|
const Header = ({ intl }) => {
|
||||||
const { authenticatedUser, config } = useContext(AppContext);
|
const { authenticatedUser, config } = useContext(AppContext);
|
||||||
|
|
||||||
const mainMenu = [
|
const mainMenu = [
|
||||||
@@ -55,12 +55,12 @@ function Header({ intl }) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'item',
|
type: 'item',
|
||||||
href: `${config.LMS_BASE_URL}/u/${authenticatedUser.username}`,
|
href: `${config.ACCOUNT_PROFILE_URL}/u/${authenticatedUser.username}`,
|
||||||
content: intl.formatMessage(messages['header.user.menu.profile']),
|
content: intl.formatMessage(messages['header.user.menu.profile']),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'item',
|
type: 'item',
|
||||||
href: `${config.LMS_BASE_URL}/account/settings`,
|
href: config.ACCOUNT_SETTINGS_URL,
|
||||||
content: intl.formatMessage(messages['header.user.menu.account.settings']),
|
content: intl.formatMessage(messages['header.user.menu.account.settings']),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -110,7 +110,7 @@ function Header({ intl }) {
|
|||||||
</Responsive>
|
</Responsive>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
Header.propTypes = {
|
Header.propTypes = {
|
||||||
intl: intlShape.isRequired,
|
intl: intlShape.isRequired,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable react/prop-types */
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { IntlProvider } from '@edx/frontend-platform/i18n';
|
import { IntlProvider } from '@edx/frontend-platform/i18n';
|
||||||
import TestRenderer from 'react-test-renderer';
|
import TestRenderer from 'react-test-renderer';
|
||||||
@@ -6,28 +7,31 @@ import { Context as ResponsiveContext } from 'react-responsive';
|
|||||||
|
|
||||||
import Header from './index';
|
import Header from './index';
|
||||||
|
|
||||||
|
const HeaderComponent = ({ width, contextValue }) => (
|
||||||
|
<ResponsiveContext.Provider value={width}>
|
||||||
|
<IntlProvider locale="en" messages={{}}>
|
||||||
|
<AppContext.Provider
|
||||||
|
value={contextValue}
|
||||||
|
>
|
||||||
|
<Header />
|
||||||
|
</AppContext.Provider>
|
||||||
|
</IntlProvider>
|
||||||
|
</ResponsiveContext.Provider>
|
||||||
|
);
|
||||||
|
|
||||||
describe('<Header />', () => {
|
describe('<Header />', () => {
|
||||||
it('renders correctly for anonymous desktop', () => {
|
it('renders correctly for anonymous desktop', () => {
|
||||||
const component = (
|
const contextValue = {
|
||||||
<ResponsiveContext.Provider value={{ width: 1280 }}>
|
authenticatedUser: null,
|
||||||
<IntlProvider locale="en" messages={{}}>
|
config: {
|
||||||
<AppContext.Provider
|
LMS_BASE_URL: process.env.LMS_BASE_URL,
|
||||||
value={{
|
SITE_NAME: process.env.SITE_NAME,
|
||||||
authenticatedUser: null,
|
LOGIN_URL: process.env.LOGIN_URL,
|
||||||
config: {
|
LOGOUT_URL: process.env.LOGOUT_URL,
|
||||||
LMS_BASE_URL: process.env.LMS_BASE_URL,
|
LOGO_URL: process.env.LOGO_URL,
|
||||||
SITE_NAME: process.env.SITE_NAME,
|
},
|
||||||
LOGIN_URL: process.env.LOGIN_URL,
|
};
|
||||||
LOGOUT_URL: process.env.LOGOUT_URL,
|
const component = <HeaderComponent width={{ width: 1280 }} contextValue={contextValue} />;
|
||||||
LOGO_URL: process.env.LOGO_URL,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Header />
|
|
||||||
</AppContext.Provider>
|
|
||||||
</IntlProvider>
|
|
||||||
</ResponsiveContext.Provider>
|
|
||||||
);
|
|
||||||
|
|
||||||
const wrapper = TestRenderer.create(component);
|
const wrapper = TestRenderer.create(component);
|
||||||
|
|
||||||
@@ -35,31 +39,22 @@ describe('<Header />', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('renders correctly for authenticated desktop', () => {
|
it('renders correctly for authenticated desktop', () => {
|
||||||
const component = (
|
const contextValue = {
|
||||||
<ResponsiveContext.Provider value={{ width: 1280 }}>
|
authenticatedUser: {
|
||||||
<IntlProvider locale="en" messages={{}}>
|
userId: 'abc123',
|
||||||
<AppContext.Provider
|
username: 'edX',
|
||||||
value={{
|
roles: [],
|
||||||
authenticatedUser: {
|
administrator: false,
|
||||||
userId: 'abc123',
|
},
|
||||||
username: 'edX',
|
config: {
|
||||||
roles: [],
|
LMS_BASE_URL: process.env.LMS_BASE_URL,
|
||||||
administrator: false,
|
SITE_NAME: process.env.SITE_NAME,
|
||||||
},
|
LOGIN_URL: process.env.LOGIN_URL,
|
||||||
config: {
|
LOGOUT_URL: process.env.LOGOUT_URL,
|
||||||
LMS_BASE_URL: process.env.LMS_BASE_URL,
|
LOGO_URL: process.env.LOGO_URL,
|
||||||
SITE_NAME: process.env.SITE_NAME,
|
},
|
||||||
LOGIN_URL: process.env.LOGIN_URL,
|
};
|
||||||
LOGOUT_URL: process.env.LOGOUT_URL,
|
const component = <HeaderComponent width={{ width: 1280 }} contextValue={contextValue} />;
|
||||||
LOGO_URL: process.env.LOGO_URL,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Header />
|
|
||||||
</AppContext.Provider>
|
|
||||||
</IntlProvider>
|
|
||||||
</ResponsiveContext.Provider>
|
|
||||||
);
|
|
||||||
|
|
||||||
const wrapper = TestRenderer.create(component);
|
const wrapper = TestRenderer.create(component);
|
||||||
|
|
||||||
@@ -67,26 +62,17 @@ describe('<Header />', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('renders correctly for anonymous mobile', () => {
|
it('renders correctly for anonymous mobile', () => {
|
||||||
const component = (
|
const contextValue = {
|
||||||
<ResponsiveContext.Provider value={{ width: 500 }}>
|
authenticatedUser: null,
|
||||||
<IntlProvider locale="en" messages={{}}>
|
config: {
|
||||||
<AppContext.Provider
|
LMS_BASE_URL: process.env.LMS_BASE_URL,
|
||||||
value={{
|
SITE_NAME: process.env.SITE_NAME,
|
||||||
authenticatedUser: null,
|
LOGIN_URL: process.env.LOGIN_URL,
|
||||||
config: {
|
LOGOUT_URL: process.env.LOGOUT_URL,
|
||||||
LMS_BASE_URL: process.env.LMS_BASE_URL,
|
LOGO_URL: process.env.LOGO_URL,
|
||||||
SITE_NAME: process.env.SITE_NAME,
|
},
|
||||||
LOGIN_URL: process.env.LOGIN_URL,
|
};
|
||||||
LOGOUT_URL: process.env.LOGOUT_URL,
|
const component = <HeaderComponent width={{ width: 500 }} contextValue={contextValue} />;
|
||||||
LOGO_URL: process.env.LOGO_URL,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Header />
|
|
||||||
</AppContext.Provider>
|
|
||||||
</IntlProvider>
|
|
||||||
</ResponsiveContext.Provider>
|
|
||||||
);
|
|
||||||
|
|
||||||
const wrapper = TestRenderer.create(component);
|
const wrapper = TestRenderer.create(component);
|
||||||
|
|
||||||
@@ -94,31 +80,22 @@ describe('<Header />', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('renders correctly for authenticated mobile', () => {
|
it('renders correctly for authenticated mobile', () => {
|
||||||
const component = (
|
const contextValue = {
|
||||||
<ResponsiveContext.Provider value={{ width: 500 }}>
|
authenticatedUser: {
|
||||||
<IntlProvider locale="en" messages={{}}>
|
userId: 'abc123',
|
||||||
<AppContext.Provider
|
username: 'edX',
|
||||||
value={{
|
roles: [],
|
||||||
authenticatedUser: {
|
administrator: false,
|
||||||
userId: 'abc123',
|
},
|
||||||
username: 'edX',
|
config: {
|
||||||
roles: [],
|
LMS_BASE_URL: process.env.LMS_BASE_URL,
|
||||||
administrator: false,
|
SITE_NAME: process.env.SITE_NAME,
|
||||||
},
|
LOGIN_URL: process.env.LOGIN_URL,
|
||||||
config: {
|
LOGOUT_URL: process.env.LOGOUT_URL,
|
||||||
LMS_BASE_URL: process.env.LMS_BASE_URL,
|
LOGO_URL: process.env.LOGO_URL,
|
||||||
SITE_NAME: process.env.SITE_NAME,
|
},
|
||||||
LOGIN_URL: process.env.LOGIN_URL,
|
};
|
||||||
LOGOUT_URL: process.env.LOGOUT_URL,
|
const component = <HeaderComponent width={{ width: 500 }} contextValue={contextValue} />;
|
||||||
LOGO_URL: process.env.LOGO_URL,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Header />
|
|
||||||
</AppContext.Provider>
|
|
||||||
</IntlProvider>
|
|
||||||
</ResponsiveContext.Provider>
|
|
||||||
);
|
|
||||||
|
|
||||||
const wrapper = TestRenderer.create(component);
|
const wrapper = TestRenderer.create(component);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
export const MenuIcon = props => (
|
export const MenuIcon = (props) => (
|
||||||
<svg
|
<svg
|
||||||
width="24px"
|
width="24px"
|
||||||
height="24px"
|
height="24px"
|
||||||
@@ -14,7 +14,7 @@ export const MenuIcon = props => (
|
|||||||
</svg>
|
</svg>
|
||||||
);
|
);
|
||||||
|
|
||||||
export const AvatarIcon = props => (
|
export const AvatarIcon = (props) => (
|
||||||
<svg
|
<svg
|
||||||
width="24px"
|
width="24px"
|
||||||
height="24px"
|
height="24px"
|
||||||
@@ -29,7 +29,7 @@ export const AvatarIcon = props => (
|
|||||||
</svg>
|
</svg>
|
||||||
);
|
);
|
||||||
|
|
||||||
export const CaretIcon = props => (
|
export const CaretIcon = (props) => (
|
||||||
<svg
|
<svg
|
||||||
width="16px"
|
width="16px"
|
||||||
height="16px"
|
height="16px"
|
||||||
|
|||||||
22
src/Logo.jsx
22
src/Logo.jsx
@@ -1,29 +1,25 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
function Logo({ src, alt, ...attributes }) {
|
const Logo = ({ src, alt, ...attributes }) => (
|
||||||
return (
|
<img src={src} alt={alt} {...attributes} />
|
||||||
<img src={src} alt={alt} {...attributes} />
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Logo.propTypes = {
|
Logo.propTypes = {
|
||||||
src: PropTypes.string.isRequired,
|
src: PropTypes.string.isRequired,
|
||||||
alt: PropTypes.string.isRequired,
|
alt: PropTypes.string.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
function LinkedLogo({
|
const LinkedLogo = ({
|
||||||
href,
|
href,
|
||||||
src,
|
src,
|
||||||
alt,
|
alt,
|
||||||
...attributes
|
...attributes
|
||||||
}) {
|
}) => (
|
||||||
return (
|
<a href={href} {...attributes}>
|
||||||
<a href={href} {...attributes}>
|
<img className="d-block" src={src} alt={alt} />
|
||||||
<img className="d-block" src={src} alt={alt} />
|
</a>
|
||||||
</a>
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
LinkedLogo.propTypes = {
|
LinkedLogo.propTypes = {
|
||||||
href: PropTypes.string.isRequired,
|
href: PropTypes.string.isRequired,
|
||||||
|
|||||||
@@ -2,12 +2,10 @@ import React from 'react';
|
|||||||
import { CSSTransition } from 'react-transition-group';
|
import { CSSTransition } from 'react-transition-group';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
function MenuTrigger({ tag, className, ...attributes }) {
|
const MenuTrigger = ({ tag, className, ...attributes }) => React.createElement(tag, {
|
||||||
return React.createElement(tag, {
|
className: `menu-trigger ${className}`,
|
||||||
className: `menu-trigger ${className}`,
|
...attributes,
|
||||||
...attributes,
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
MenuTrigger.propTypes = {
|
MenuTrigger.propTypes = {
|
||||||
tag: PropTypes.string,
|
tag: PropTypes.string,
|
||||||
className: PropTypes.string,
|
className: PropTypes.string,
|
||||||
@@ -16,14 +14,13 @@ MenuTrigger.defaultProps = {
|
|||||||
tag: 'div',
|
tag: 'div',
|
||||||
className: null,
|
className: null,
|
||||||
};
|
};
|
||||||
const MenuTriggerType = <MenuTrigger />.type;
|
const MenuTriggerComp = <MenuTrigger />;
|
||||||
|
const MenuTriggerType = MenuTriggerComp.type;
|
||||||
|
|
||||||
function MenuContent({ tag, className, ...attributes }) {
|
const MenuContent = ({ tag, className, ...attributes }) => React.createElement(tag, {
|
||||||
return React.createElement(tag, {
|
className: ['menu-content', className].join(' '),
|
||||||
className: ['menu-content', className].join(' '),
|
...attributes,
|
||||||
...attributes,
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
MenuContent.propTypes = {
|
MenuContent.propTypes = {
|
||||||
tag: PropTypes.string,
|
tag: PropTypes.string,
|
||||||
className: PropTypes.string,
|
className: PropTypes.string,
|
||||||
|
|||||||
@@ -1,199 +0,0 @@
|
|||||||
import React, { useContext } from 'react';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
|
||||||
import { AppContext } from '@edx/frontend-platform/react';
|
|
||||||
import {
|
|
||||||
APP_CONFIG_INITIALIZED,
|
|
||||||
ensureConfig,
|
|
||||||
getConfig,
|
|
||||||
mergeConfig,
|
|
||||||
subscribe,
|
|
||||||
} from '@edx/frontend-platform';
|
|
||||||
import { ActionRow } from '@edx/paragon';
|
|
||||||
|
|
||||||
import { Menu, MenuTrigger, MenuContent } from './Menu';
|
|
||||||
import Avatar from './Avatar';
|
|
||||||
import { LinkedLogo, Logo } from './Logo';
|
|
||||||
|
|
||||||
import { CaretIcon } from './Icons';
|
|
||||||
|
|
||||||
import messages from './Header.messages';
|
|
||||||
|
|
||||||
ensureConfig([
|
|
||||||
'STUDIO_BASE_URL',
|
|
||||||
'LOGOUT_URL',
|
|
||||||
'LOGIN_URL',
|
|
||||||
'SITE_NAME',
|
|
||||||
'LOGO_URL',
|
|
||||||
'ORDER_HISTORY_URL',
|
|
||||||
], 'StudioHeader component');
|
|
||||||
|
|
||||||
subscribe(APP_CONFIG_INITIALIZED, () => {
|
|
||||||
mergeConfig({
|
|
||||||
AUTHN_MINIMAL_HEADER: !!process.env.AUTHN_MINIMAL_HEADER,
|
|
||||||
}, 'StudioHeader additional config');
|
|
||||||
});
|
|
||||||
|
|
||||||
class StudioDesktopHeaderBase extends React.Component {
|
|
||||||
constructor(props) { // eslint-disable-line no-useless-constructor
|
|
||||||
super(props);
|
|
||||||
}
|
|
||||||
|
|
||||||
renderUserMenu() {
|
|
||||||
const {
|
|
||||||
userMenu,
|
|
||||||
avatar,
|
|
||||||
username,
|
|
||||||
intl,
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Menu transitionClassName="menu-dropdown" transitionTimeout={250}>
|
|
||||||
<MenuTrigger
|
|
||||||
tag="button"
|
|
||||||
aria-label={intl.formatMessage(messages['header.label.account.menu.for'], { username })}
|
|
||||||
className="btn btn-outline-primary d-inline-flex align-items-center pl-2 pr-3"
|
|
||||||
>
|
|
||||||
<Avatar size="1.5em" src={avatar} alt="" className="mr-2" />
|
|
||||||
{username} <CaretIcon role="img" aria-hidden focusable="false" />
|
|
||||||
</MenuTrigger>
|
|
||||||
<MenuContent className="mb-0 dropdown-menu show dropdown-menu-right pin-right shadow py-2">
|
|
||||||
{userMenu.map(({ type, href, content }) => (
|
|
||||||
<a className={`dropdown-${type}`} key={`${type}-${content}`} href={href}>{content}</a>
|
|
||||||
))}
|
|
||||||
</MenuContent>
|
|
||||||
</Menu>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
renderLoggedOutItems() {
|
|
||||||
const { loggedOutItems } = this.props;
|
|
||||||
|
|
||||||
return loggedOutItems.map((item, i, arr) => (
|
|
||||||
<a
|
|
||||||
key={`${item.type}-${item.content}`}
|
|
||||||
className={i < arr.length - 1 ? 'btn mr-2 btn-link' : 'btn mr-2 btn-outline-primary'}
|
|
||||||
href={item.href}
|
|
||||||
>
|
|
||||||
{item.content}
|
|
||||||
</a>
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
logo,
|
|
||||||
logoAltText,
|
|
||||||
logoDestination,
|
|
||||||
loggedIn,
|
|
||||||
intl,
|
|
||||||
actionRowContent,
|
|
||||||
} = this.props;
|
|
||||||
const logoProps = { src: logo, alt: logoAltText, href: logoDestination };
|
|
||||||
const logoClasses = getConfig().AUTHN_MINIMAL_HEADER ? 'mw-100' : null;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<header className="site-header-desktop">
|
|
||||||
<a className="nav-skip sr-only sr-only-focusable" href="#main">{intl.formatMessage(messages['header.label.skip.nav'])}</a>
|
|
||||||
<div className={`container-fluid ${logoClasses}`}>
|
|
||||||
<div className="nav-container position-relative d-flex align-items-center">
|
|
||||||
{logoDestination === null ? <Logo className="logo" src={logo} alt={logoAltText} /> : <LinkedLogo className="logo" {...logoProps} />}
|
|
||||||
<ActionRow>
|
|
||||||
{actionRowContent}
|
|
||||||
<nav
|
|
||||||
aria-label={intl.formatMessage(messages['header.label.secondary.nav'])}
|
|
||||||
className="nav secondary-menu-container align-items-center ml-auto"
|
|
||||||
>
|
|
||||||
{loggedIn ? this.renderUserMenu() : this.renderLoggedOutItems()}
|
|
||||||
</nav>
|
|
||||||
</ActionRow>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
StudioDesktopHeaderBase.propTypes = {
|
|
||||||
userMenu: PropTypes.arrayOf(PropTypes.shape({
|
|
||||||
type: PropTypes.oneOf(['item', 'menu']),
|
|
||||||
href: PropTypes.string,
|
|
||||||
content: PropTypes.string,
|
|
||||||
})),
|
|
||||||
loggedOutItems: PropTypes.arrayOf(PropTypes.shape({
|
|
||||||
type: PropTypes.oneOf(['item', 'menu']),
|
|
||||||
href: PropTypes.string,
|
|
||||||
content: PropTypes.string,
|
|
||||||
})),
|
|
||||||
logo: PropTypes.string,
|
|
||||||
logoAltText: PropTypes.string,
|
|
||||||
logoDestination: PropTypes.string,
|
|
||||||
avatar: PropTypes.string,
|
|
||||||
username: PropTypes.string,
|
|
||||||
loggedIn: PropTypes.bool,
|
|
||||||
actionRowContent: PropTypes.element,
|
|
||||||
|
|
||||||
// i18n
|
|
||||||
intl: intlShape.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
StudioDesktopHeaderBase.defaultProps = {
|
|
||||||
userMenu: [],
|
|
||||||
loggedOutItems: [],
|
|
||||||
logo: null,
|
|
||||||
logoAltText: null,
|
|
||||||
logoDestination: null,
|
|
||||||
avatar: null,
|
|
||||||
username: null,
|
|
||||||
loggedIn: false,
|
|
||||||
actionRowContent: null,
|
|
||||||
};
|
|
||||||
|
|
||||||
const StudioDesktopHeader = injectIntl(StudioDesktopHeaderBase);
|
|
||||||
|
|
||||||
function StudioHeader({ intl, actionRowContent }) {
|
|
||||||
const { authenticatedUser, config } = useContext(AppContext);
|
|
||||||
|
|
||||||
const userMenu = authenticatedUser === null ? [] : [
|
|
||||||
{
|
|
||||||
type: 'item',
|
|
||||||
href: `${config.STUDIO_BASE_URL}`,
|
|
||||||
content: intl.formatMessage(messages['header.user.menu.studio.home']),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'item',
|
|
||||||
href: `${config.STUDIO_BASE_URL}/maintenance`,
|
|
||||||
content: intl.formatMessage(messages['header.user.menu.studio.maintenance']),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'item',
|
|
||||||
href: config.LOGOUT_URL,
|
|
||||||
content: intl.formatMessage(messages['header.user.menu.logout']),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const props = {
|
|
||||||
logo: config.LOGO_URL,
|
|
||||||
logoAltText: config.SITE_NAME,
|
|
||||||
logoDestination: config.STUDIO_BASE_URL,
|
|
||||||
loggedIn: authenticatedUser !== null,
|
|
||||||
username: authenticatedUser !== null ? authenticatedUser.username : null,
|
|
||||||
avatar: authenticatedUser !== null ? authenticatedUser.avatar : null,
|
|
||||||
actionRowContent,
|
|
||||||
userMenu,
|
|
||||||
loggedOutItems: [],
|
|
||||||
};
|
|
||||||
|
|
||||||
return <StudioDesktopHeader {...props} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
StudioHeader.propTypes = {
|
|
||||||
intl: intlShape.isRequired,
|
|
||||||
actionRowContent: PropTypes.element,
|
|
||||||
};
|
|
||||||
|
|
||||||
StudioHeader.defaultProps = {
|
|
||||||
actionRowContent: <></>,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default injectIntl(StudioHeader);
|
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import { IntlProvider } from '@edx/frontend-platform/i18n';
|
|
||||||
import TestRenderer from 'react-test-renderer';
|
|
||||||
import { Link } from 'react-router-dom';
|
|
||||||
import { AppContext } from '@edx/frontend-platform/react';
|
|
||||||
import {
|
|
||||||
ActionRow,
|
|
||||||
Button,
|
|
||||||
Dropdown,
|
|
||||||
} from '@edx/paragon';
|
|
||||||
|
|
||||||
import { StudioHeader } from './index';
|
|
||||||
|
|
||||||
describe('<StudioHeader />', () => {
|
|
||||||
it('renders correctly', () => {
|
|
||||||
const component = (
|
|
||||||
<IntlProvider locale="en" messages={{}}>
|
|
||||||
<AppContext.Provider
|
|
||||||
value={{
|
|
||||||
authenticatedUser: {
|
|
||||||
userId: 'abc123',
|
|
||||||
username: 'edX',
|
|
||||||
roles: [],
|
|
||||||
administrator: false,
|
|
||||||
},
|
|
||||||
config: {
|
|
||||||
STUDIO_BASE_URL: process.env.STUDIO_BASE_URL,
|
|
||||||
SITE_NAME: process.env.SITE_NAME,
|
|
||||||
LOGIN_URL: process.env.LOGIN_URL,
|
|
||||||
LOGOUT_URL: process.env.LOGOUT_URL,
|
|
||||||
LOGO_URL: process.env.LOGO_URL,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<StudioHeader />
|
|
||||||
</AppContext.Provider>
|
|
||||||
</IntlProvider>
|
|
||||||
);
|
|
||||||
|
|
||||||
const wrapper = TestRenderer.create(component);
|
|
||||||
|
|
||||||
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('renders correctly with optional action row content', () => {
|
|
||||||
const actionRowContent = (
|
|
||||||
<>
|
|
||||||
<Dropdown>
|
|
||||||
<Dropdown.Toggle variant="outline-primary" id="library-header-menu-dropdown">
|
|
||||||
Settings
|
|
||||||
</Dropdown.Toggle>
|
|
||||||
<Dropdown.Menu>
|
|
||||||
<Dropdown.Item as={Link} to="#">Dropdown Item 1</Dropdown.Item>
|
|
||||||
<Dropdown.Item as={Link} to="#">Dropdown Item 2</Dropdown.Item>
|
|
||||||
<Dropdown.Item as={Link} to="#">Dropdown Item 3</Dropdown.Item>
|
|
||||||
</Dropdown.Menu>
|
|
||||||
</Dropdown>
|
|
||||||
<ActionRow.Spacer />
|
|
||||||
<Button
|
|
||||||
variant="tertiary"
|
|
||||||
href="#"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
target="_blank"
|
|
||||||
title="Help Button"
|
|
||||||
>Help
|
|
||||||
</Button>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
|
|
||||||
const component = (
|
|
||||||
<IntlProvider locale="en" messages={{}}>
|
|
||||||
<AppContext.Provider
|
|
||||||
value={{
|
|
||||||
authenticatedUser: {
|
|
||||||
userId: 'abc123',
|
|
||||||
username: 'edX',
|
|
||||||
roles: [],
|
|
||||||
administrator: false,
|
|
||||||
},
|
|
||||||
config: {
|
|
||||||
STUDIO_BASE_URL: process.env.STUDIO_BASE_URL,
|
|
||||||
SITE_NAME: process.env.SITE_NAME,
|
|
||||||
LOGIN_URL: process.env.LOGIN_URL,
|
|
||||||
LOGOUT_URL: process.env.LOGOUT_URL,
|
|
||||||
LOGO_URL: process.env.LOGO_URL,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<StudioHeader actionRowContent={actionRowContent} />
|
|
||||||
</AppContext.Provider>
|
|
||||||
</IntlProvider>
|
|
||||||
);
|
|
||||||
|
|
||||||
const wrapper = TestRenderer.create(component);
|
|
||||||
|
|
||||||
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,226 +0,0 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
||||||
|
|
||||||
exports[`<StudioHeader /> renders correctly 1`] = `
|
|
||||||
<header
|
|
||||||
className="site-header-desktop"
|
|
||||||
>
|
|
||||||
<a
|
|
||||||
className="nav-skip sr-only sr-only-focusable"
|
|
||||||
href="#main"
|
|
||||||
>
|
|
||||||
Skip to main content
|
|
||||||
</a>
|
|
||||||
<div
|
|
||||||
className="container-fluid null"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
className="nav-container position-relative d-flex align-items-center"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
alt="edX"
|
|
||||||
className="logo"
|
|
||||||
src="https://edx-cdn.org/v3/default/logo.svg"
|
|
||||||
/>
|
|
||||||
<div
|
|
||||||
className="pgn__action-row"
|
|
||||||
>
|
|
||||||
<nav
|
|
||||||
aria-label="Secondary"
|
|
||||||
className="nav secondary-menu-container align-items-center ml-auto"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
className="menu null"
|
|
||||||
onKeyDown={[Function]}
|
|
||||||
onMouseEnter={[Function]}
|
|
||||||
onMouseLeave={[Function]}
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
aria-expanded={false}
|
|
||||||
aria-haspopup="menu"
|
|
||||||
aria-label="Account menu for edX"
|
|
||||||
className="menu-trigger btn btn-outline-primary d-inline-flex align-items-center pl-2 pr-3"
|
|
||||||
onClick={[Function]}
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
className="avatar overflow-hidden d-inline-flex rounded-circle mr-2"
|
|
||||||
style={
|
|
||||||
Object {
|
|
||||||
"height": "1.5em",
|
|
||||||
"width": "1.5em",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
aria-hidden={true}
|
|
||||||
focusable="false"
|
|
||||||
height="24px"
|
|
||||||
role="img"
|
|
||||||
style={
|
|
||||||
Object {
|
|
||||||
"height": "1.5em",
|
|
||||||
"width": "1.5em",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
version="1.1"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
width="24px"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
d="M4.10255106,18.1351061 C4.7170266,16.0581859 8.01891846,14.4720277 12,14.4720277 C15.9810815,14.4720277 19.2829734,16.0581859 19.8974489,18.1351061 C21.215206,16.4412566 22,14.3122775 22,12 C22,6.4771525 17.5228475,2 12,2 C6.4771525,2 2,6.4771525 2,12 C2,14.3122775 2.78479405,16.4412566 4.10255106,18.1351061 Z M12,24 C5.372583,24 0,18.627417 0,12 C0,5.372583 5.372583,0 12,0 C18.627417,0 24,5.372583 24,12 C24,18.627417 18.627417,24 12,24 Z M12,13 C9.790861,13 8,11.209139 8,9 C8,6.790861 9.790861,5 12,5 C14.209139,5 16,6.790861 16,9 C16,11.209139 14.209139,13 12,13 Z"
|
|
||||||
fill="currentColor"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</span>
|
|
||||||
edX
|
|
||||||
|
|
||||||
<svg
|
|
||||||
aria-hidden={true}
|
|
||||||
focusable="false"
|
|
||||||
height="16px"
|
|
||||||
role="img"
|
|
||||||
version="1.1"
|
|
||||||
viewBox="0 0 16 16"
|
|
||||||
width="16px"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
d="M7,4 L7,8 L11,8 L11,10 L5,10 L5,4 L7,4 Z"
|
|
||||||
fill="currentColor"
|
|
||||||
transform="translate(8.000000, 7.000000) rotate(-45.000000) translate(-8.000000, -7.000000) "
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`<StudioHeader /> renders correctly with optional action row content 1`] = `
|
|
||||||
<header
|
|
||||||
className="site-header-desktop"
|
|
||||||
>
|
|
||||||
<a
|
|
||||||
className="nav-skip sr-only sr-only-focusable"
|
|
||||||
href="#main"
|
|
||||||
>
|
|
||||||
Skip to main content
|
|
||||||
</a>
|
|
||||||
<div
|
|
||||||
className="container-fluid null"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
className="nav-container position-relative d-flex align-items-center"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
alt="edX"
|
|
||||||
className="logo"
|
|
||||||
src="https://edx-cdn.org/v3/default/logo.svg"
|
|
||||||
/>
|
|
||||||
<div
|
|
||||||
className="pgn__action-row"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
className="dropdown"
|
|
||||||
data-testid="dropdown"
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
aria-expanded={false}
|
|
||||||
aria-haspopup={true}
|
|
||||||
className="dropdown-toggle btn btn-outline-primary"
|
|
||||||
disabled={false}
|
|
||||||
id="library-header-menu-dropdown"
|
|
||||||
onClick={[Function]}
|
|
||||||
type="button"
|
|
||||||
>
|
|
||||||
Settings
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<span
|
|
||||||
className="pgn__action-row-spacer"
|
|
||||||
/>
|
|
||||||
<a
|
|
||||||
className="btn btn-tertiary"
|
|
||||||
href="#"
|
|
||||||
onClick={[Function]}
|
|
||||||
onKeyDown={[Function]}
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
role="button"
|
|
||||||
target="_blank"
|
|
||||||
title="Help Button"
|
|
||||||
>
|
|
||||||
Help
|
|
||||||
</a>
|
|
||||||
<nav
|
|
||||||
aria-label="Secondary"
|
|
||||||
className="nav secondary-menu-container align-items-center ml-auto"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
className="menu null"
|
|
||||||
onKeyDown={[Function]}
|
|
||||||
onMouseEnter={[Function]}
|
|
||||||
onMouseLeave={[Function]}
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
aria-expanded={false}
|
|
||||||
aria-haspopup="menu"
|
|
||||||
aria-label="Account menu for edX"
|
|
||||||
className="menu-trigger btn btn-outline-primary d-inline-flex align-items-center pl-2 pr-3"
|
|
||||||
onClick={[Function]}
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
className="avatar overflow-hidden d-inline-flex rounded-circle mr-2"
|
|
||||||
style={
|
|
||||||
Object {
|
|
||||||
"height": "1.5em",
|
|
||||||
"width": "1.5em",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
aria-hidden={true}
|
|
||||||
focusable="false"
|
|
||||||
height="24px"
|
|
||||||
role="img"
|
|
||||||
style={
|
|
||||||
Object {
|
|
||||||
"height": "1.5em",
|
|
||||||
"width": "1.5em",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
version="1.1"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
width="24px"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
d="M4.10255106,18.1351061 C4.7170266,16.0581859 8.01891846,14.4720277 12,14.4720277 C15.9810815,14.4720277 19.2829734,16.0581859 19.8974489,18.1351061 C21.215206,16.4412566 22,14.3122775 22,12 C22,6.4771525 17.5228475,2 12,2 C6.4771525,2 2,6.4771525 2,12 C2,14.3122775 2.78479405,16.4412566 4.10255106,18.1351061 Z M12,24 C5.372583,24 0,18.627417 0,12 C0,5.372583 5.372583,0 12,0 C18.627417,0 24,5.372583 24,12 C24,18.627417 18.627417,24 12,24 Z M12,13 C9.790861,13 8,11.209139 8,9 C8,6.790861 9.790861,5 12,5 C14.209139,5 16,6.790861 16,9 C16,11.209139 14.209139,13 12,13 Z"
|
|
||||||
fill="currentColor"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</span>
|
|
||||||
edX
|
|
||||||
|
|
||||||
<svg
|
|
||||||
aria-hidden={true}
|
|
||||||
focusable="false"
|
|
||||||
height="16px"
|
|
||||||
role="img"
|
|
||||||
version="1.1"
|
|
||||||
viewBox="0 0 16 16"
|
|
||||||
width="16px"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
d="M7,4 L7,8 L11,8 L11,10 L5,10 L5,4 L7,4 Z"
|
|
||||||
fill="currentColor"
|
|
||||||
transform="translate(8.000000, 7.000000) rotate(-45.000000) translate(-8.000000, -7.000000) "
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
`;
|
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
{
|
{
|
||||||
"general.register.sentenceCase": "التسجيل",
|
|
||||||
"general.signIn.sentenceCase": "تسجيل الدخول",
|
|
||||||
"header.links.courses": "المساقات",
|
"header.links.courses": "المساقات",
|
||||||
"header.links.programs": "البرامج",
|
"header.links.programs": "البرامج",
|
||||||
"header.links.content.search": "اكتشف الجديد",
|
"header.links.content.search": "اكتشف الجديد",
|
||||||
@@ -23,11 +21,16 @@
|
|||||||
"header.label.secondary.nav": "القائمة الثانوية",
|
"header.label.secondary.nav": "القائمة الثانوية",
|
||||||
"header.label.skip.nav": "التخطي إلى المحتوى الرئيسي",
|
"header.label.skip.nav": "التخطي إلى المحتوى الرئيسي",
|
||||||
"header.label.app.nav": "تطبيق",
|
"header.label.app.nav": "تطبيق",
|
||||||
|
"general.register.sentenceCase": "التسجيل",
|
||||||
|
"general.signIn.sentenceCase": "تسجيل الدخول",
|
||||||
"header.menu.dashboard.label": "لوحة المعلومات",
|
"header.menu.dashboard.label": "لوحة المعلومات",
|
||||||
"header.help.label": "المساعدة",
|
"header.help.label": "المساعدة",
|
||||||
"header.menu.profile.label": "الملف الشخصي",
|
"header.menu.profile.label": "الملف الشخصي",
|
||||||
"header.menu.account.label": "الحساب",
|
"header.menu.account.label": "الحساب",
|
||||||
"header.menu.orderHistory.label": "سجل الطلبيات",
|
"header.menu.orderHistory.label": "سجل الطلبيات",
|
||||||
"header.navigation.skipNavLink": "التخطي إلى المحتوى الرئيسي",
|
"header.navigation.skipNavLink": "التخطي إلى المحتوى الرئيسي",
|
||||||
"header.menu.signOut.label": "تسجيل الخروج"
|
"header.menu.signOut.label": "تسجيل الخروج",
|
||||||
|
"header.user.menu.studio": "صفحة الاستوديو الرئيسية",
|
||||||
|
"header.user.menu.maintenance": "الصيانة",
|
||||||
|
"header.label.courseOutline": "الرجوع إلى مخطط المساق الكلّي في الاستوديو"
|
||||||
}
|
}
|
||||||
@@ -1,33 +1,36 @@
|
|||||||
{
|
{
|
||||||
"general.register.sentenceCase": "Register",
|
"header.links.courses": "Kurse",
|
||||||
"general.signIn.sentenceCase": "Sign in",
|
"header.links.programs": "Programme",
|
||||||
"header.links.courses": "Courses",
|
"header.links.content.search": "",
|
||||||
"header.links.programs": "Programs",
|
"header.links.schools": "",
|
||||||
"header.links.content.search": "Discover New",
|
"header.user.menu.dashboard": "Meine Kurse",
|
||||||
"header.links.schools": "Schools & Partners",
|
"header.user.menu.profile": "",
|
||||||
"header.user.menu.dashboard": "Dashboard",
|
"header.user.menu.account.settings": "Konto",
|
||||||
"header.user.menu.profile": "Profile",
|
"header.user.menu.order.history": "",
|
||||||
"header.user.menu.account.settings": "Account",
|
"header.user.menu.logout": "Abmelden",
|
||||||
"header.user.menu.order.history": "Order History",
|
|
||||||
"header.user.menu.logout": "Logout",
|
|
||||||
"header.user.menu.login": "Login",
|
"header.user.menu.login": "Login",
|
||||||
"header.user.menu.register": "Sign Up",
|
"header.user.menu.register": "",
|
||||||
"header.user.menu.studio.home": "Studio Home",
|
"header.user.menu.studio.home": "",
|
||||||
"header.user.menu.studio.maintenance": "Maintenance",
|
"header.user.menu.studio.maintenance": "",
|
||||||
"header.label.account.nav": "Account",
|
"header.label.account.nav": "Konto",
|
||||||
"header.label.account.menu": "Account Menu",
|
"header.label.account.menu": "",
|
||||||
"header.label.account.menu.for": "Account menu for {username}",
|
"header.label.account.menu.for": "",
|
||||||
"header.label.main.nav": "Main",
|
"header.label.main.nav": "",
|
||||||
"header.label.main.menu": "Main Menu",
|
"header.label.main.menu": "",
|
||||||
"header.label.main.header": "Main",
|
"header.label.main.header": "",
|
||||||
"header.label.secondary.nav": "Secondary",
|
"header.label.secondary.nav": "Sekundarschule",
|
||||||
"header.label.skip.nav": "Skip to main content",
|
"header.label.skip.nav": "Springe zum Hauptthema",
|
||||||
"header.label.app.nav": "App",
|
"header.label.app.nav": "",
|
||||||
"header.menu.dashboard.label": "Dashboard",
|
"general.register.sentenceCase": "",
|
||||||
"header.help.label": "Help",
|
"general.signIn.sentenceCase": "",
|
||||||
"header.menu.profile.label": "Profile",
|
"header.menu.dashboard.label": "Meine Kurse",
|
||||||
"header.menu.account.label": "Account",
|
"header.help.label": "Hilfe",
|
||||||
"header.menu.orderHistory.label": "Order History",
|
"header.menu.profile.label": "",
|
||||||
"header.navigation.skipNavLink": "Skip to main content.",
|
"header.menu.account.label": "Konto",
|
||||||
"header.menu.signOut.label": "Sign Out"
|
"header.menu.orderHistory.label": "",
|
||||||
|
"header.navigation.skipNavLink": "",
|
||||||
|
"header.menu.signOut.label": "Abmelden",
|
||||||
|
"header.user.menu.studio": "",
|
||||||
|
"header.user.menu.maintenance": "",
|
||||||
|
"header.label.courseOutline": ""
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
{
|
{
|
||||||
"general.register.sentenceCase": "Registrarse",
|
|
||||||
"general.signIn.sentenceCase": "Iniciar sesión",
|
|
||||||
"header.links.courses": "Cursos",
|
"header.links.courses": "Cursos",
|
||||||
"header.links.programs": "Programas",
|
"header.links.programs": "Programas",
|
||||||
"header.links.content.search": "Encontrar nuevo",
|
"header.links.content.search": "Encontrar nuevo",
|
||||||
@@ -23,11 +21,16 @@
|
|||||||
"header.label.secondary.nav": "Secondary",
|
"header.label.secondary.nav": "Secondary",
|
||||||
"header.label.skip.nav": "Ir al contenido principal",
|
"header.label.skip.nav": "Ir al contenido principal",
|
||||||
"header.label.app.nav": "Aplicación",
|
"header.label.app.nav": "Aplicación",
|
||||||
|
"general.register.sentenceCase": "Registrarse",
|
||||||
|
"general.signIn.sentenceCase": "Iniciar sesión",
|
||||||
"header.menu.dashboard.label": "Panel de Control",
|
"header.menu.dashboard.label": "Panel de Control",
|
||||||
"header.help.label": "Ayuda",
|
"header.help.label": "Ayuda",
|
||||||
"header.menu.profile.label": "Perfil",
|
"header.menu.profile.label": "Perfil",
|
||||||
"header.menu.account.label": "Cuenta",
|
"header.menu.account.label": "Cuenta",
|
||||||
"header.menu.orderHistory.label": "Historial de órdenes",
|
"header.menu.orderHistory.label": "Historial de órdenes",
|
||||||
"header.navigation.skipNavLink": "Dirígete al contenido principal.",
|
"header.navigation.skipNavLink": "Dirígete al contenido principal.",
|
||||||
"header.menu.signOut.label": "Cerrar sesión"
|
"header.menu.signOut.label": "Cerrar sesión",
|
||||||
|
"header.user.menu.studio": "Inicio Studio",
|
||||||
|
"header.user.menu.maintenance": "Mantenimiento",
|
||||||
|
"header.label.courseOutline": "Volver al esquema del curso en Studio"
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
{
|
{
|
||||||
"general.register.sentenceCase": "S'inscrire",
|
|
||||||
"general.signIn.sentenceCase": "Connectez-vous",
|
|
||||||
"header.links.courses": "Cours",
|
"header.links.courses": "Cours",
|
||||||
"header.links.programs": "Programmes",
|
"header.links.programs": "Programmes",
|
||||||
"header.links.content.search": "Explorer les cours",
|
"header.links.content.search": "Explorer les cours",
|
||||||
@@ -23,11 +21,16 @@
|
|||||||
"header.label.secondary.nav": "Secondaire",
|
"header.label.secondary.nav": "Secondaire",
|
||||||
"header.label.skip.nav": "Passer au contenu principal",
|
"header.label.skip.nav": "Passer au contenu principal",
|
||||||
"header.label.app.nav": "Application",
|
"header.label.app.nav": "Application",
|
||||||
|
"general.register.sentenceCase": "S'inscrire",
|
||||||
|
"general.signIn.sentenceCase": "Connectez-vous",
|
||||||
"header.menu.dashboard.label": "Tableau de bord",
|
"header.menu.dashboard.label": "Tableau de bord",
|
||||||
"header.help.label": "Aide",
|
"header.help.label": "Aide",
|
||||||
"header.menu.profile.label": "Profil",
|
"header.menu.profile.label": "Profil",
|
||||||
"header.menu.account.label": "Compte",
|
"header.menu.account.label": "Compte",
|
||||||
"header.menu.orderHistory.label": "Historique des commandes",
|
"header.menu.orderHistory.label": "Historique des commandes",
|
||||||
"header.navigation.skipNavLink": "Passer au contenu principal",
|
"header.navigation.skipNavLink": "Passer au contenu principal",
|
||||||
"header.menu.signOut.label": "Se déconnecter"
|
"header.menu.signOut.label": "Se déconnecter",
|
||||||
|
"header.user.menu.studio": "Accueil Studio",
|
||||||
|
"header.user.menu.maintenance": "Maintenance",
|
||||||
|
"header.label.courseOutline": "Retour au plan de cours dans Studio"
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
{
|
{
|
||||||
"general.register.sentenceCase": "Inscription",
|
|
||||||
"general.signIn.sentenceCase": "Connexion",
|
|
||||||
"header.links.courses": "Cours",
|
"header.links.courses": "Cours",
|
||||||
"header.links.programs": "Programmes",
|
"header.links.programs": "Programmes",
|
||||||
"header.links.content.search": "Découvrir les nouveautés",
|
"header.links.content.search": "Découvrir les nouveautés",
|
||||||
@@ -23,11 +21,16 @@
|
|||||||
"header.label.secondary.nav": "Secondaire",
|
"header.label.secondary.nav": "Secondaire",
|
||||||
"header.label.skip.nav": "Passer au contenu de cette vue",
|
"header.label.skip.nav": "Passer au contenu de cette vue",
|
||||||
"header.label.app.nav": "Application",
|
"header.label.app.nav": "Application",
|
||||||
|
"general.register.sentenceCase": "Inscription",
|
||||||
|
"general.signIn.sentenceCase": "Connexion",
|
||||||
"header.menu.dashboard.label": "Tableau de bord",
|
"header.menu.dashboard.label": "Tableau de bord",
|
||||||
"header.help.label": "Aide",
|
"header.help.label": "Aide",
|
||||||
"header.menu.profile.label": "Profil",
|
"header.menu.profile.label": "Profil",
|
||||||
"header.menu.account.label": "Compte",
|
"header.menu.account.label": "Compte",
|
||||||
"header.menu.orderHistory.label": "Historique des commandes",
|
"header.menu.orderHistory.label": "Historique des commandes",
|
||||||
"header.navigation.skipNavLink": "Passer au contenu principal.",
|
"header.navigation.skipNavLink": "Passer au contenu principal.",
|
||||||
"header.menu.signOut.label": "Se déconnecter"
|
"header.menu.signOut.label": "Se déconnecter",
|
||||||
|
"header.user.menu.studio": "Accueil Studio",
|
||||||
|
"header.user.menu.maintenance": "Entretien",
|
||||||
|
"header.label.courseOutline": "Retour au plan de cours dans Studio"
|
||||||
}
|
}
|
||||||
@@ -1,33 +1,36 @@
|
|||||||
{
|
{
|
||||||
"general.register.sentenceCase": "Register",
|
"header.links.courses": "पाठ्यक्रम",
|
||||||
"general.signIn.sentenceCase": "Sign in",
|
"header.links.programs": "कार्यक्रमों",
|
||||||
"header.links.courses": "Courses",
|
"header.links.content.search": "नया खोजें",
|
||||||
"header.links.programs": "Programs",
|
"header.links.schools": "स्कूलों और भागीदारों",
|
||||||
"header.links.content.search": "Discover New",
|
"header.user.menu.dashboard": "डैशबोर्ड",
|
||||||
"header.links.schools": "Schools & Partners",
|
"header.user.menu.profile": "प्रोफ़ाइल",
|
||||||
"header.user.menu.dashboard": "Dashboard",
|
"header.user.menu.account.settings": "खाता",
|
||||||
"header.user.menu.profile": "Profile",
|
"header.user.menu.order.history": "ऑर्डर इतिहास",
|
||||||
"header.user.menu.account.settings": "Account",
|
"header.user.menu.logout": "लॉग आउट",
|
||||||
"header.user.menu.order.history": "Order History",
|
"header.user.menu.login": "लॉगिन",
|
||||||
"header.user.menu.logout": "Logout",
|
"header.user.menu.register": "साइन अप",
|
||||||
"header.user.menu.login": "Login",
|
"header.user.menu.studio.home": "स्टूडियो होम",
|
||||||
"header.user.menu.register": "Sign Up",
|
"header.user.menu.studio.maintenance": "अनुरक्षण करना",
|
||||||
"header.user.menu.studio.home": "Studio Home",
|
"header.label.account.nav": "खाता",
|
||||||
"header.user.menu.studio.maintenance": "Maintenance",
|
"header.label.account.menu": "खाता मेनू",
|
||||||
"header.label.account.nav": "Account",
|
"header.label.account.menu.for": "{username} के लिए खाता मेनू",
|
||||||
"header.label.account.menu": "Account Menu",
|
"header.label.main.nav": "मुख्य",
|
||||||
"header.label.account.menu.for": "Account menu for {username}",
|
"header.label.main.menu": "मुख्य मेनू",
|
||||||
"header.label.main.nav": "Main",
|
"header.label.main.header": "मुख्य",
|
||||||
"header.label.main.menu": "Main Menu",
|
"header.label.secondary.nav": "माध्यमिक",
|
||||||
"header.label.main.header": "Main",
|
"header.label.skip.nav": "मुख्य विषयवस्तु में जाएं",
|
||||||
"header.label.secondary.nav": "Secondary",
|
"header.label.app.nav": "ऐप",
|
||||||
"header.label.skip.nav": "Skip to main content",
|
"general.register.sentenceCase": "रजिस्टर करें",
|
||||||
"header.label.app.nav": "App",
|
"general.signIn.sentenceCase": "साइन इन करें",
|
||||||
"header.menu.dashboard.label": "Dashboard",
|
"header.menu.dashboard.label": "डैशबोर्ड",
|
||||||
"header.help.label": "Help",
|
"header.help.label": "मदद",
|
||||||
"header.menu.profile.label": "Profile",
|
"header.menu.profile.label": "प्रोफ़ाइल",
|
||||||
"header.menu.account.label": "Account",
|
"header.menu.account.label": "खाता",
|
||||||
"header.menu.orderHistory.label": "Order History",
|
"header.menu.orderHistory.label": "ऑर्डर इतिहास",
|
||||||
"header.navigation.skipNavLink": "Skip to main content.",
|
"header.navigation.skipNavLink": "मुख्य सामग्री पर जाएँ।",
|
||||||
"header.menu.signOut.label": "Sign Out"
|
"header.menu.signOut.label": "साइन आउट करें",
|
||||||
|
"header.user.menu.studio": "स्टूडियो होम",
|
||||||
|
"header.user.menu.maintenance": "अनुरक्षण करना",
|
||||||
|
"header.label.courseOutline": "स्टूडियो में पाठ्यक्रम की रूपरेखा पर वापस जाएँ"
|
||||||
}
|
}
|
||||||
@@ -1,33 +1,36 @@
|
|||||||
{
|
{
|
||||||
"general.register.sentenceCase": "Register",
|
"header.links.courses": "Corsi",
|
||||||
"general.signIn.sentenceCase": "Sign in",
|
"header.links.programs": "",
|
||||||
"header.links.courses": "Courses",
|
"header.links.content.search": "",
|
||||||
"header.links.programs": "Programs",
|
"header.links.schools": "Scuole e Partner",
|
||||||
"header.links.content.search": "Discover New",
|
"header.user.menu.dashboard": "Pannello di controllo",
|
||||||
"header.links.schools": "Schools & Partners",
|
"header.user.menu.profile": "Profilo",
|
||||||
"header.user.menu.dashboard": "Dashboard",
|
|
||||||
"header.user.menu.profile": "Profile",
|
|
||||||
"header.user.menu.account.settings": "Account",
|
"header.user.menu.account.settings": "Account",
|
||||||
"header.user.menu.order.history": "Order History",
|
"header.user.menu.order.history": "Cronologia Ordini",
|
||||||
"header.user.menu.logout": "Logout",
|
"header.user.menu.logout": "",
|
||||||
"header.user.menu.login": "Login",
|
"header.user.menu.login": "",
|
||||||
"header.user.menu.register": "Sign Up",
|
"header.user.menu.register": "Registrazione",
|
||||||
"header.user.menu.studio.home": "Studio Home",
|
"header.user.menu.studio.home": "",
|
||||||
"header.user.menu.studio.maintenance": "Maintenance",
|
"header.user.menu.studio.maintenance": "",
|
||||||
"header.label.account.nav": "Account",
|
"header.label.account.nav": "Account",
|
||||||
"header.label.account.menu": "Account Menu",
|
"header.label.account.menu": "",
|
||||||
"header.label.account.menu.for": "Account menu for {username}",
|
"header.label.account.menu.for": "",
|
||||||
"header.label.main.nav": "Main",
|
"header.label.main.nav": "",
|
||||||
"header.label.main.menu": "Main Menu",
|
"header.label.main.menu": "",
|
||||||
"header.label.main.header": "Main",
|
"header.label.main.header": "",
|
||||||
"header.label.secondary.nav": "Secondary",
|
"header.label.secondary.nav": "",
|
||||||
"header.label.skip.nav": "Skip to main content",
|
"header.label.skip.nav": "Passa al contenuto principale",
|
||||||
"header.label.app.nav": "App",
|
"header.label.app.nav": "",
|
||||||
"header.menu.dashboard.label": "Dashboard",
|
"general.register.sentenceCase": "Registrazione",
|
||||||
"header.help.label": "Help",
|
"general.signIn.sentenceCase": "Accedi",
|
||||||
"header.menu.profile.label": "Profile",
|
"header.menu.dashboard.label": "Pannello di controllo",
|
||||||
|
"header.help.label": "Aiuto",
|
||||||
|
"header.menu.profile.label": "Profilo",
|
||||||
"header.menu.account.label": "Account",
|
"header.menu.account.label": "Account",
|
||||||
"header.menu.orderHistory.label": "Order History",
|
"header.menu.orderHistory.label": "Cronologia Ordini",
|
||||||
"header.navigation.skipNavLink": "Skip to main content.",
|
"header.navigation.skipNavLink": "",
|
||||||
"header.menu.signOut.label": "Sign Out"
|
"header.menu.signOut.label": "Esci",
|
||||||
|
"header.user.menu.studio": "",
|
||||||
|
"header.user.menu.maintenance": "",
|
||||||
|
"header.label.courseOutline": ""
|
||||||
}
|
}
|
||||||
@@ -1,33 +1,36 @@
|
|||||||
{
|
{
|
||||||
"general.register.sentenceCase": "Register",
|
"header.links.courses": "",
|
||||||
"general.signIn.sentenceCase": "Sign in",
|
"header.links.programs": "",
|
||||||
"header.links.courses": "Courses",
|
"header.links.content.search": "",
|
||||||
"header.links.programs": "Programs",
|
"header.links.schools": "",
|
||||||
"header.links.content.search": "Discover New",
|
"header.user.menu.dashboard": "",
|
||||||
"header.links.schools": "Schools & Partners",
|
"header.user.menu.profile": "",
|
||||||
"header.user.menu.dashboard": "Dashboard",
|
"header.user.menu.account.settings": "",
|
||||||
"header.user.menu.profile": "Profile",
|
"header.user.menu.order.history": "",
|
||||||
"header.user.menu.account.settings": "Account",
|
"header.user.menu.logout": "",
|
||||||
"header.user.menu.order.history": "Order History",
|
|
||||||
"header.user.menu.logout": "Logout",
|
|
||||||
"header.user.menu.login": "Login",
|
"header.user.menu.login": "Login",
|
||||||
"header.user.menu.register": "Sign Up",
|
"header.user.menu.register": "",
|
||||||
"header.user.menu.studio.home": "Studio Home",
|
"header.user.menu.studio.home": "",
|
||||||
"header.user.menu.studio.maintenance": "Maintenance",
|
"header.user.menu.studio.maintenance": "",
|
||||||
"header.label.account.nav": "Account",
|
"header.label.account.nav": "",
|
||||||
"header.label.account.menu": "Account Menu",
|
"header.label.account.menu": "",
|
||||||
"header.label.account.menu.for": "Account menu for {username}",
|
"header.label.account.menu.for": "",
|
||||||
"header.label.main.nav": "Main",
|
"header.label.main.nav": "",
|
||||||
"header.label.main.menu": "Main Menu",
|
"header.label.main.menu": "",
|
||||||
"header.label.main.header": "Main",
|
"header.label.main.header": "",
|
||||||
"header.label.secondary.nav": "Secondary",
|
"header.label.secondary.nav": "",
|
||||||
"header.label.skip.nav": "Skip to main content",
|
"header.label.skip.nav": "",
|
||||||
"header.label.app.nav": "App",
|
"header.label.app.nav": "",
|
||||||
"header.menu.dashboard.label": "Dashboard",
|
"general.register.sentenceCase": "",
|
||||||
"header.help.label": "Help",
|
"general.signIn.sentenceCase": "",
|
||||||
"header.menu.profile.label": "Profile",
|
"header.menu.dashboard.label": "",
|
||||||
"header.menu.account.label": "Account",
|
"header.help.label": "",
|
||||||
"header.menu.orderHistory.label": "Order History",
|
"header.menu.profile.label": "",
|
||||||
"header.navigation.skipNavLink": "Skip to main content.",
|
"header.menu.account.label": "",
|
||||||
"header.menu.signOut.label": "Sign Out"
|
"header.menu.orderHistory.label": "",
|
||||||
|
"header.navigation.skipNavLink": "",
|
||||||
|
"header.menu.signOut.label": "",
|
||||||
|
"header.user.menu.studio": "",
|
||||||
|
"header.user.menu.maintenance": "",
|
||||||
|
"header.label.courseOutline": ""
|
||||||
}
|
}
|
||||||
@@ -1,33 +1,36 @@
|
|||||||
{
|
{
|
||||||
"general.register.sentenceCase": "Register",
|
"header.links.courses": "Курсы",
|
||||||
"general.signIn.sentenceCase": "Sign in",
|
"header.links.programs": "Программы",
|
||||||
"header.links.courses": "Courses",
|
"header.links.content.search": "Каталог курсов",
|
||||||
"header.links.programs": "Programs",
|
"header.links.schools": "Учебные заведения и партнёры",
|
||||||
"header.links.content.search": "Discover New",
|
"header.user.menu.dashboard": "Панель управления",
|
||||||
"header.links.schools": "Schools & Partners",
|
"header.user.menu.profile": "Профиль",
|
||||||
"header.user.menu.dashboard": "Dashboard",
|
"header.user.menu.account.settings": "Учётная запись",
|
||||||
"header.user.menu.profile": "Profile",
|
"header.user.menu.order.history": "История заказов",
|
||||||
"header.user.menu.account.settings": "Account",
|
"header.user.menu.logout": "Выйти",
|
||||||
"header.user.menu.order.history": "Order History",
|
"header.user.menu.login": "Войти",
|
||||||
"header.user.menu.logout": "Logout",
|
"header.user.menu.register": "Зарегистрироваться",
|
||||||
"header.user.menu.login": "Login",
|
"header.user.menu.studio.home": "Studio Дом",
|
||||||
"header.user.menu.register": "Sign Up",
|
"header.user.menu.studio.maintenance": "Техническое обслуживание",
|
||||||
"header.user.menu.studio.home": "Studio Home",
|
"header.label.account.nav": "Учётная запись",
|
||||||
"header.user.menu.studio.maintenance": "Maintenance",
|
"header.label.account.menu": "Меню учетной записи",
|
||||||
"header.label.account.nav": "Account",
|
"header.label.account.menu.for": "Меню учетной записи для {username}",
|
||||||
"header.label.account.menu": "Account Menu",
|
"header.label.main.nav": "Главный",
|
||||||
"header.label.account.menu.for": "Account menu for {username}",
|
"header.label.main.menu": "Главное меню",
|
||||||
"header.label.main.nav": "Main",
|
"header.label.main.header": "Главный",
|
||||||
"header.label.main.menu": "Main Menu",
|
"header.label.secondary.nav": "Среднее образование",
|
||||||
"header.label.main.header": "Main",
|
"header.label.skip.nav": "Перейти к основному содержимому",
|
||||||
"header.label.secondary.nav": "Secondary",
|
"header.label.app.nav": "Приложение",
|
||||||
"header.label.skip.nav": "Skip to main content",
|
"general.register.sentenceCase": "Регистрация",
|
||||||
"header.label.app.nav": "App",
|
"general.signIn.sentenceCase": "Вход",
|
||||||
"header.menu.dashboard.label": "Dashboard",
|
"header.menu.dashboard.label": "Панель управления",
|
||||||
"header.help.label": "Help",
|
"header.help.label": "Помощь",
|
||||||
"header.menu.profile.label": "Profile",
|
"header.menu.profile.label": "Профиль",
|
||||||
"header.menu.account.label": "Account",
|
"header.menu.account.label": "Учётная запись",
|
||||||
"header.menu.orderHistory.label": "Order History",
|
"header.menu.orderHistory.label": "История заказов",
|
||||||
"header.navigation.skipNavLink": "Skip to main content.",
|
"header.navigation.skipNavLink": "Перейти к контенту",
|
||||||
"header.menu.signOut.label": "Sign Out"
|
"header.menu.signOut.label": "Выйти",
|
||||||
|
"header.user.menu.studio": "Studio Дом",
|
||||||
|
"header.user.menu.maintenance": "Техническое обслуживание",
|
||||||
|
"header.label.courseOutline": ""
|
||||||
}
|
}
|
||||||
@@ -1,33 +1,36 @@
|
|||||||
{
|
{
|
||||||
"general.register.sentenceCase": "Register",
|
"header.links.courses": "Курси",
|
||||||
"general.signIn.sentenceCase": "Sign in",
|
"header.links.programs": "Програми",
|
||||||
"header.links.courses": "Courses",
|
"header.links.content.search": "Відкривайте Нове",
|
||||||
"header.links.programs": "Programs",
|
"header.links.schools": "Школи та партнери",
|
||||||
"header.links.content.search": "Discover New",
|
"header.user.menu.dashboard": "Мої курси",
|
||||||
"header.links.schools": "Schools & Partners",
|
"header.user.menu.profile": "Профіль",
|
||||||
"header.user.menu.dashboard": "Dashboard",
|
"header.user.menu.account.settings": "Обліковий запис",
|
||||||
"header.user.menu.profile": "Profile",
|
"header.user.menu.order.history": "Історія замовлень",
|
||||||
"header.user.menu.account.settings": "Account",
|
"header.user.menu.logout": "Вийти",
|
||||||
"header.user.menu.order.history": "Order History",
|
"header.user.menu.login": "Увійти",
|
||||||
"header.user.menu.logout": "Logout",
|
"header.user.menu.register": "Зареєструватися",
|
||||||
"header.user.menu.login": "Login",
|
"header.user.menu.studio.home": "Головна сторінка в Студії",
|
||||||
"header.user.menu.register": "Sign Up",
|
"header.user.menu.studio.maintenance": "Технічні робити",
|
||||||
"header.user.menu.studio.home": "Studio Home",
|
"header.label.account.nav": "Обліковий запис",
|
||||||
"header.user.menu.studio.maintenance": "Maintenance",
|
"header.label.account.menu": "Меню облікового запису",
|
||||||
"header.label.account.nav": "Account",
|
"header.label.account.menu.for": "Меню облікового запису для {username}",
|
||||||
"header.label.account.menu": "Account Menu",
|
"header.label.main.nav": "Головна",
|
||||||
"header.label.account.menu.for": "Account menu for {username}",
|
"header.label.main.menu": "Головне меню",
|
||||||
"header.label.main.nav": "Main",
|
"header.label.main.header": "Головна",
|
||||||
"header.label.main.menu": "Main Menu",
|
"header.label.secondary.nav": "Середня",
|
||||||
"header.label.main.header": "Main",
|
"header.label.skip.nav": "Перейти до головного змісту",
|
||||||
"header.label.secondary.nav": "Secondary",
|
"header.label.app.nav": "Додаток",
|
||||||
"header.label.skip.nav": "Skip to main content",
|
"general.register.sentenceCase": "Зареєструватися",
|
||||||
"header.label.app.nav": "App",
|
"general.signIn.sentenceCase": "Увійти",
|
||||||
"header.menu.dashboard.label": "Dashboard",
|
"header.menu.dashboard.label": "Мої курси",
|
||||||
"header.help.label": "Help",
|
"header.help.label": "Допомога",
|
||||||
"header.menu.profile.label": "Profile",
|
"header.menu.profile.label": "Профіль",
|
||||||
"header.menu.account.label": "Account",
|
"header.menu.account.label": "Обліковий запис",
|
||||||
"header.menu.orderHistory.label": "Order History",
|
"header.menu.orderHistory.label": "Історія замовлень",
|
||||||
"header.navigation.skipNavLink": "Skip to main content.",
|
"header.navigation.skipNavLink": "Перейти до головного змісту.",
|
||||||
"header.menu.signOut.label": "Sign Out"
|
"header.menu.signOut.label": "Вийти",
|
||||||
|
"header.user.menu.studio": "Головна сторінка в Студії",
|
||||||
|
"header.user.menu.maintenance": "Технічні робити",
|
||||||
|
"header.label.courseOutline": "Повернутися до плану курсу в Studio"
|
||||||
}
|
}
|
||||||
@@ -1,33 +1,36 @@
|
|||||||
{
|
{
|
||||||
"general.register.sentenceCase": "Register",
|
"header.links.courses": "课程",
|
||||||
"general.signIn.sentenceCase": "Sign in",
|
"header.links.programs": "项目",
|
||||||
"header.links.courses": "Courses",
|
"header.links.content.search": "马上探索课程",
|
||||||
"header.links.programs": "Programs",
|
"header.links.schools": "学校 & 伙伴",
|
||||||
"header.links.content.search": "Discover New",
|
"header.user.menu.dashboard": "课程面板",
|
||||||
"header.links.schools": "Schools & Partners",
|
"header.user.menu.profile": "个人主页",
|
||||||
"header.user.menu.dashboard": "Dashboard",
|
"header.user.menu.account.settings": "账号",
|
||||||
"header.user.menu.profile": "Profile",
|
"header.user.menu.order.history": "订单记录",
|
||||||
"header.user.menu.account.settings": "Account",
|
"header.user.menu.logout": "退出",
|
||||||
"header.user.menu.order.history": "Order History",
|
"header.user.menu.login": "登录",
|
||||||
"header.user.menu.logout": "Logout",
|
"header.user.menu.register": "注册",
|
||||||
"header.user.menu.login": "Login",
|
"header.user.menu.studio.home": "工作室主页",
|
||||||
"header.user.menu.register": "Sign Up",
|
"header.user.menu.studio.maintenance": "维护",
|
||||||
"header.user.menu.studio.home": "Studio Home",
|
"header.label.account.nav": "账号",
|
||||||
"header.user.menu.studio.maintenance": "Maintenance",
|
"header.label.account.menu": "账户菜单",
|
||||||
"header.label.account.nav": "Account",
|
"header.label.account.menu.for": "{username} 的帐户菜单",
|
||||||
"header.label.account.menu": "Account Menu",
|
"header.label.main.nav": "主要",
|
||||||
"header.label.account.menu.for": "Account menu for {username}",
|
"header.label.main.menu": "主菜单",
|
||||||
"header.label.main.nav": "Main",
|
"header.label.main.header": "主要",
|
||||||
"header.label.main.menu": "Main Menu",
|
"header.label.secondary.nav": "高中",
|
||||||
"header.label.main.header": "Main",
|
"header.label.skip.nav": "跳转到主要内容",
|
||||||
"header.label.secondary.nav": "Secondary",
|
"header.label.app.nav": "",
|
||||||
"header.label.skip.nav": "Skip to main content",
|
"general.register.sentenceCase": "注册",
|
||||||
"header.label.app.nav": "App",
|
"general.signIn.sentenceCase": "登录",
|
||||||
"header.menu.dashboard.label": "Dashboard",
|
"header.menu.dashboard.label": "课程面板",
|
||||||
"header.help.label": "Help",
|
"header.help.label": "帮助",
|
||||||
"header.menu.profile.label": "Profile",
|
"header.menu.profile.label": "个人主页",
|
||||||
"header.menu.account.label": "Account",
|
"header.menu.account.label": "账号",
|
||||||
"header.menu.orderHistory.label": "Order History",
|
"header.menu.orderHistory.label": "订单记录",
|
||||||
"header.navigation.skipNavLink": "Skip to main content.",
|
"header.navigation.skipNavLink": "跳回主頁",
|
||||||
"header.menu.signOut.label": "Sign Out"
|
"header.menu.signOut.label": "注销",
|
||||||
|
"header.user.menu.studio": "工作室主页",
|
||||||
|
"header.user.menu.maintenance": "维护",
|
||||||
|
"header.label.courseOutline": "返回 Studio 中的课程大纲"
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import Header from './Header';
|
import Header from './Header';
|
||||||
import LearningHeader from './learning-header/LearningHeader';
|
import LearningHeader from './learning-header/LearningHeader';
|
||||||
import messages from './i18n/index';
|
import messages from './i18n/index';
|
||||||
import StudioHeader from './StudioHeader';
|
import StudioHeader from './studio-header';
|
||||||
|
|
||||||
export { LearningHeader, messages, StudioHeader };
|
export { LearningHeader, messages, StudioHeader };
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ $blue: #007db8;
|
|||||||
$white: #fff;
|
$white: #fff;
|
||||||
|
|
||||||
@import './Menu/menu.scss';
|
@import './Menu/menu.scss';
|
||||||
|
@import './studio-header/StudioHeader.scss';
|
||||||
|
|
||||||
.dropdown-item a {
|
.dropdown-item a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
@@ -27,7 +28,7 @@ $white: #fff;
|
|||||||
|
|
||||||
.learning-header {
|
.learning-header {
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
|
|
||||||
.course-title-lockup {
|
.course-title-lockup {
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
|
|
||||||
@@ -42,9 +43,9 @@ $white: #fff;
|
|||||||
.user-dropdown {
|
.user-dropdown {
|
||||||
.btn {
|
.btn {
|
||||||
height: 3rem;
|
height: 3rem;
|
||||||
@media (max-width: -1 + map-get($grid-breakpoints, "sm")) {
|
// @media (max-width: -1 + map-get($grid-breakpoints, "sm")) {
|
||||||
padding: 0 0.5rem;
|
// padding: 0 0.5rem;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,29 +3,27 @@ import React from 'react';
|
|||||||
import { getConfig } from '@edx/frontend-platform';
|
import { getConfig } from '@edx/frontend-platform';
|
||||||
import { getLoginRedirectUrl } from '@edx/frontend-platform/auth';
|
import { getLoginRedirectUrl } from '@edx/frontend-platform/auth';
|
||||||
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
||||||
import { Button } from '@edx/paragon';
|
import { Button } from '@openedx/paragon';
|
||||||
|
|
||||||
import genericMessages from '../generic/messages';
|
import genericMessages from '../generic/messages';
|
||||||
|
|
||||||
function AnonymousUserMenu({ intl }) {
|
const AnonymousUserMenu = ({ intl }) => (
|
||||||
return (
|
<div>
|
||||||
<div>
|
<Button
|
||||||
<Button
|
className="mr-3"
|
||||||
className="mr-3"
|
variant="outline-primary"
|
||||||
variant="outline-primary"
|
href={`${getConfig().LMS_BASE_URL}/register?next=${encodeURIComponent(global.location.href)}`}
|
||||||
href={`${getConfig().LMS_BASE_URL}/register?next=${encodeURIComponent(global.location.href)}`}
|
>
|
||||||
>
|
{intl.formatMessage(genericMessages.registerSentenceCase)}
|
||||||
{intl.formatMessage(genericMessages.registerSentenceCase)}
|
</Button>
|
||||||
</Button>
|
<Button
|
||||||
<Button
|
variant="primary"
|
||||||
variant="primary"
|
href={`${getLoginRedirectUrl(global.location.href)}`}
|
||||||
href={`${getLoginRedirectUrl(global.location.href)}`}
|
>
|
||||||
>
|
{intl.formatMessage(genericMessages.signInSentenceCase)}
|
||||||
{intl.formatMessage(genericMessages.signInSentenceCase)}
|
</Button>
|
||||||
</Button>
|
</div>
|
||||||
</div>
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
AnonymousUserMenu.propTypes = {
|
AnonymousUserMenu.propTypes = {
|
||||||
intl: intlShape.isRequired,
|
intl: intlShape.isRequired,
|
||||||
|
|||||||
@@ -3,14 +3,13 @@ import PropTypes from 'prop-types';
|
|||||||
|
|
||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||||
import { faUserCircle } from '@fortawesome/free-solid-svg-icons';
|
import { faUserCircle } from '@fortawesome/free-solid-svg-icons';
|
||||||
|
|
||||||
import { getConfig } from '@edx/frontend-platform';
|
import { getConfig } from '@edx/frontend-platform';
|
||||||
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
||||||
import { Dropdown } from '@edx/paragon';
|
import { Dropdown } from '@openedx/paragon';
|
||||||
|
|
||||||
import messages from './messages';
|
import messages from './messages';
|
||||||
|
|
||||||
function AuthenticatedUserDropdown({ intl, username }) {
|
const AuthenticatedUserDropdown = ({ intl, username }) => {
|
||||||
const dashboardMenuItem = (
|
const dashboardMenuItem = (
|
||||||
<Dropdown.Item href={`${getConfig().LMS_BASE_URL}/dashboard`}>
|
<Dropdown.Item href={`${getConfig().LMS_BASE_URL}/dashboard`}>
|
||||||
{intl.formatMessage(messages.dashboard)}
|
{intl.formatMessage(messages.dashboard)}
|
||||||
@@ -19,8 +18,8 @@ function AuthenticatedUserDropdown({ intl, username }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<a className="text-gray-700 mr-3" href={`${getConfig().SUPPORT_URL}`}>{intl.formatMessage(messages.help)}</a>
|
<a className="text-gray-700" href={`${getConfig().SUPPORT_URL}`}>{intl.formatMessage(messages.help)}</a>
|
||||||
<Dropdown className="user-dropdown">
|
<Dropdown className="user-dropdown ml-3">
|
||||||
<Dropdown.Toggle variant="outline-primary">
|
<Dropdown.Toggle variant="outline-primary">
|
||||||
<FontAwesomeIcon icon={faUserCircle} className="d-md-none" size="lg" />
|
<FontAwesomeIcon icon={faUserCircle} className="d-md-none" size="lg" />
|
||||||
<span data-hj-suppress className="d-none d-md-inline">
|
<span data-hj-suppress className="d-none d-md-inline">
|
||||||
@@ -29,10 +28,10 @@ function AuthenticatedUserDropdown({ intl, username }) {
|
|||||||
</Dropdown.Toggle>
|
</Dropdown.Toggle>
|
||||||
<Dropdown.Menu className="dropdown-menu-right">
|
<Dropdown.Menu className="dropdown-menu-right">
|
||||||
{dashboardMenuItem}
|
{dashboardMenuItem}
|
||||||
<Dropdown.Item href={`${getConfig().LMS_BASE_URL}/u/${username}`}>
|
<Dropdown.Item href={`${getConfig().ACCOUNT_PROFILE_URL}/u/${username}`}>
|
||||||
{intl.formatMessage(messages.profile)}
|
{intl.formatMessage(messages.profile)}
|
||||||
</Dropdown.Item>
|
</Dropdown.Item>
|
||||||
<Dropdown.Item href={`${getConfig().LMS_BASE_URL}/account/settings`}>
|
<Dropdown.Item href={getConfig().ACCOUNT_SETTINGS_URL}>
|
||||||
{intl.formatMessage(messages.account)}
|
{intl.formatMessage(messages.account)}
|
||||||
</Dropdown.Item>
|
</Dropdown.Item>
|
||||||
{ getConfig().ORDER_HISTORY_URL && (
|
{ getConfig().ORDER_HISTORY_URL && (
|
||||||
@@ -47,7 +46,7 @@ function AuthenticatedUserDropdown({ intl, username }) {
|
|||||||
</Dropdown>
|
</Dropdown>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
AuthenticatedUserDropdown.propTypes = {
|
AuthenticatedUserDropdown.propTypes = {
|
||||||
intl: intlShape.isRequired,
|
intl: intlShape.isRequired,
|
||||||
|
|||||||
@@ -8,18 +8,16 @@ import AnonymousUserMenu from './AnonymousUserMenu';
|
|||||||
import AuthenticatedUserDropdown from './AuthenticatedUserDropdown';
|
import AuthenticatedUserDropdown from './AuthenticatedUserDropdown';
|
||||||
import messages from './messages';
|
import messages from './messages';
|
||||||
|
|
||||||
function LinkedLogo({
|
const LinkedLogo = ({
|
||||||
href,
|
href,
|
||||||
src,
|
src,
|
||||||
alt,
|
alt,
|
||||||
...attributes
|
...attributes
|
||||||
}) {
|
}) => (
|
||||||
return (
|
<a href={href} {...attributes}>
|
||||||
<a href={href} {...attributes}>
|
<img className="d-block" src={src} alt={alt} />
|
||||||
<img className="d-block" src={src} alt={alt} />
|
</a>
|
||||||
</a>
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
LinkedLogo.propTypes = {
|
LinkedLogo.propTypes = {
|
||||||
href: PropTypes.string.isRequired,
|
href: PropTypes.string.isRequired,
|
||||||
@@ -27,9 +25,9 @@ LinkedLogo.propTypes = {
|
|||||||
alt: PropTypes.string.isRequired,
|
alt: PropTypes.string.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
function LearningHeader({
|
const LearningHeader = ({
|
||||||
courseOrg, courseNumber, courseTitle, intl, showUserDropdown,
|
courseOrg, courseNumber, courseTitle, intl, showUserDropdown,
|
||||||
}) {
|
}) => {
|
||||||
const { authenticatedUser } = useContext(AppContext);
|
const { authenticatedUser } = useContext(AppContext);
|
||||||
|
|
||||||
const headerLogo = (
|
const headerLogo = (
|
||||||
@@ -51,17 +49,17 @@ function LearningHeader({
|
|||||||
<span className="d-block m-0 font-weight-bold course-title">{courseTitle}</span>
|
<span className="d-block m-0 font-weight-bold course-title">{courseTitle}</span>
|
||||||
</div>
|
</div>
|
||||||
{showUserDropdown && authenticatedUser && (
|
{showUserDropdown && authenticatedUser && (
|
||||||
<AuthenticatedUserDropdown
|
<AuthenticatedUserDropdown
|
||||||
username={authenticatedUser.username}
|
username={authenticatedUser.username}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{showUserDropdown && !authenticatedUser && (
|
{showUserDropdown && !authenticatedUser && (
|
||||||
<AnonymousUserMenu />
|
<AnonymousUserMenu />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
LearningHeader.propTypes = {
|
LearningHeader.propTypes = {
|
||||||
courseOrg: PropTypes.string,
|
courseOrg: PropTypes.string,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ describe('Header', () => {
|
|||||||
|
|
||||||
it('displays user button', () => {
|
it('displays user button', () => {
|
||||||
render(<Header />);
|
render(<Header />);
|
||||||
expect(screen.getByRole('button')).toHaveTextContent(authenticatedUser.username);
|
expect(screen.getByText(authenticatedUser.username)).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('displays course data', () => {
|
it('displays course data', () => {
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
/* eslint-disable import/no-extraneous-dependencies */
|
/* eslint-disable import/no-extraneous-dependencies */
|
||||||
|
|
||||||
import Enzyme from 'enzyme';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import Adapter from 'enzyme-adapter-react-16';
|
|
||||||
import '@testing-library/jest-dom';
|
import '@testing-library/jest-dom';
|
||||||
import '@testing-library/jest-dom/extend-expect';
|
import '@testing-library/jest-dom/extend-expect';
|
||||||
import 'babel-polyfill';
|
import 'babel-polyfill';
|
||||||
@@ -17,11 +15,11 @@ import { IntlProvider } from 'react-intl';
|
|||||||
import AppProvider from '@edx/frontend-platform/react/AppProvider';
|
import AppProvider from '@edx/frontend-platform/react/AppProvider';
|
||||||
import appMessages from './i18n';
|
import appMessages from './i18n';
|
||||||
|
|
||||||
Enzyme.configure({ adapter: new Adapter() });
|
|
||||||
|
|
||||||
// These configuration values are usually set in webpack's EnvironmentPlugin however
|
// These configuration values are usually set in webpack's EnvironmentPlugin however
|
||||||
// Jest does not use webpack so we need to set these so for testing
|
// Jest does not use webpack so we need to set these so for testing
|
||||||
process.env.ACCESS_TOKEN_COOKIE_NAME = 'edx-jwt-cookie-header-payload';
|
process.env.ACCESS_TOKEN_COOKIE_NAME = 'edx-jwt-cookie-header-payload';
|
||||||
|
process.env.ACCOUNT_PROFILE_URL = 'http://localhost:1995';
|
||||||
|
process.env.ACCOUNT_SETTINGS_URL = 'http://localhost:1997';
|
||||||
process.env.BASE_URL = 'localhost:1995';
|
process.env.BASE_URL = 'localhost:1995';
|
||||||
process.env.CREDENTIALS_BASE_URL = 'http://localhost:18150';
|
process.env.CREDENTIALS_BASE_URL = 'http://localhost:18150';
|
||||||
process.env.CSRF_TOKEN_API_PATH = '/csrf/api/v1/token';
|
process.env.CSRF_TOKEN_API_PATH = '/csrf/api/v1/token';
|
||||||
@@ -102,16 +100,14 @@ function render(
|
|||||||
...renderOptions
|
...renderOptions
|
||||||
} = {},
|
} = {},
|
||||||
) {
|
) {
|
||||||
function Wrapper({ children }) {
|
const Wrapper = ({ children }) => (
|
||||||
return (
|
|
||||||
// eslint-disable-next-line react/jsx-filename-extension
|
// eslint-disable-next-line react/jsx-filename-extension
|
||||||
<IntlProvider locale="en">
|
<IntlProvider locale="en">
|
||||||
<AppProvider store={store}>
|
<AppProvider store={store}>
|
||||||
{children}
|
{children}
|
||||||
</AppProvider>
|
</AppProvider>
|
||||||
</IntlProvider>
|
</IntlProvider>
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
Wrapper.propTypes = {
|
Wrapper.propTypes = {
|
||||||
children: PropTypes.node.isRequired,
|
children: PropTypes.node.isRequired,
|
||||||
|
|||||||
24
src/studio-header/BrandNav.jsx
Normal file
24
src/studio-header/BrandNav.jsx
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
|
const BrandNav = ({
|
||||||
|
studioBaseUrl,
|
||||||
|
logo,
|
||||||
|
logoAltText,
|
||||||
|
}) => (
|
||||||
|
<a href={studioBaseUrl}>
|
||||||
|
<img
|
||||||
|
src={logo}
|
||||||
|
alt={logoAltText}
|
||||||
|
className="d-block logo"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
);
|
||||||
|
|
||||||
|
BrandNav.propTypes = {
|
||||||
|
studioBaseUrl: PropTypes.string.isRequired,
|
||||||
|
logo: PropTypes.string.isRequired,
|
||||||
|
logoAltText: PropTypes.string.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default BrandNav;
|
||||||
54
src/studio-header/CourseLockUp.jsx
Normal file
54
src/studio-header/CourseLockUp.jsx
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
||||||
|
import {
|
||||||
|
OverlayTrigger,
|
||||||
|
Tooltip,
|
||||||
|
} from '@openedx/paragon';
|
||||||
|
import messages from './messages';
|
||||||
|
|
||||||
|
const CourseLockUp = ({
|
||||||
|
outlineLink,
|
||||||
|
org,
|
||||||
|
number,
|
||||||
|
title,
|
||||||
|
// injected
|
||||||
|
intl,
|
||||||
|
}) => (
|
||||||
|
<OverlayTrigger
|
||||||
|
placement="bottom"
|
||||||
|
overlay={(
|
||||||
|
<Tooltip id="course-lock-up">
|
||||||
|
{title}
|
||||||
|
</Tooltip>
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
className="course-title-lockup mr-2"
|
||||||
|
href={outlineLink}
|
||||||
|
aria-label={intl.formatMessage(messages['header.label.courseOutline'])}
|
||||||
|
data-testid="course-lock-up-block"
|
||||||
|
>
|
||||||
|
<span className="d-block small m-0 text-gray-800" data-testid="course-org-number">{org} {number}</span>
|
||||||
|
<span className="d-block m-0 font-weight-bold text-gray-800" data-testid="course-title">{title}</span>
|
||||||
|
</a>
|
||||||
|
</OverlayTrigger>
|
||||||
|
);
|
||||||
|
|
||||||
|
CourseLockUp.propTypes = {
|
||||||
|
number: PropTypes.string,
|
||||||
|
org: PropTypes.string,
|
||||||
|
title: PropTypes.string,
|
||||||
|
outlineLink: PropTypes.string,
|
||||||
|
// injected
|
||||||
|
intl: intlShape.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
CourseLockUp.defaultProps = {
|
||||||
|
number: null,
|
||||||
|
org: null,
|
||||||
|
title: null,
|
||||||
|
outlineLink: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default injectIntl(CourseLockUp);
|
||||||
160
src/studio-header/HeaderBody.jsx
Normal file
160
src/studio-header/HeaderBody.jsx
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import {
|
||||||
|
ActionRow,
|
||||||
|
Button,
|
||||||
|
Container,
|
||||||
|
Nav,
|
||||||
|
Row,
|
||||||
|
} from '@openedx/paragon';
|
||||||
|
import { Close, MenuIcon } from '@openedx/paragon/icons';
|
||||||
|
|
||||||
|
import CourseLockUp from './CourseLockUp';
|
||||||
|
import UserMenu from './UserMenu';
|
||||||
|
import BrandNav from './BrandNav';
|
||||||
|
import NavDropdownMenu from './NavDropdownMenu';
|
||||||
|
|
||||||
|
const HeaderBody = ({
|
||||||
|
logo,
|
||||||
|
logoAltText,
|
||||||
|
number,
|
||||||
|
org,
|
||||||
|
title,
|
||||||
|
username,
|
||||||
|
isAdmin,
|
||||||
|
studioBaseUrl,
|
||||||
|
logoutUrl,
|
||||||
|
authenticatedUserAvatar,
|
||||||
|
isMobile,
|
||||||
|
setModalPopupTarget,
|
||||||
|
toggleModalPopup,
|
||||||
|
isModalPopupOpen,
|
||||||
|
isHiddenMainMenu,
|
||||||
|
mainMenuDropdowns,
|
||||||
|
outlineLink,
|
||||||
|
}) => {
|
||||||
|
const renderBrandNav = (
|
||||||
|
<BrandNav
|
||||||
|
{...{
|
||||||
|
studioBaseUrl,
|
||||||
|
logo,
|
||||||
|
logoAltText,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Container size="xl" className="px-2.5">
|
||||||
|
<ActionRow as="header">
|
||||||
|
{isHiddenMainMenu ? (
|
||||||
|
<Row className="flex-nowrap ml-4">
|
||||||
|
{renderBrandNav}
|
||||||
|
</Row>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
{isMobile ? (
|
||||||
|
<Button
|
||||||
|
ref={setModalPopupTarget}
|
||||||
|
className="d-inline-flex align-items-center"
|
||||||
|
variant="tertiary"
|
||||||
|
onClick={toggleModalPopup}
|
||||||
|
iconBefore={isModalPopupOpen ? Close : MenuIcon}
|
||||||
|
data-testid="mobile-menu-button"
|
||||||
|
>
|
||||||
|
Menu
|
||||||
|
</Button>
|
||||||
|
) : (
|
||||||
|
<div className="w-25">
|
||||||
|
<Row className="m-0 flex-nowrap">
|
||||||
|
{renderBrandNav}
|
||||||
|
<CourseLockUp
|
||||||
|
{...{
|
||||||
|
outlineLink,
|
||||||
|
number,
|
||||||
|
org,
|
||||||
|
title,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Row>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{isMobile ? (
|
||||||
|
<>
|
||||||
|
<ActionRow.Spacer />
|
||||||
|
{renderBrandNav}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<Nav data-testid="desktop-menu" className="ml-2">
|
||||||
|
{mainMenuDropdowns.map(dropdown => {
|
||||||
|
const { id, buttonTitle, items } = dropdown;
|
||||||
|
return (
|
||||||
|
<NavDropdownMenu key={id} {...{ id, buttonTitle, items }} />
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</Nav>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
<ActionRow.Spacer />
|
||||||
|
<Nav>
|
||||||
|
<UserMenu
|
||||||
|
{...{
|
||||||
|
username,
|
||||||
|
studioBaseUrl,
|
||||||
|
logoutUrl,
|
||||||
|
authenticatedUserAvatar,
|
||||||
|
isAdmin,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Nav>
|
||||||
|
</ActionRow>
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
HeaderBody.propTypes = {
|
||||||
|
studioBaseUrl: PropTypes.string.isRequired,
|
||||||
|
logoutUrl: PropTypes.string.isRequired,
|
||||||
|
setModalPopupTarget: PropTypes.func,
|
||||||
|
toggleModalPopup: PropTypes.func,
|
||||||
|
isModalPopupOpen: PropTypes.bool,
|
||||||
|
number: PropTypes.string,
|
||||||
|
org: PropTypes.string,
|
||||||
|
title: PropTypes.string,
|
||||||
|
logo: PropTypes.string,
|
||||||
|
logoAltText: PropTypes.string,
|
||||||
|
authenticatedUserAvatar: PropTypes.string,
|
||||||
|
username: PropTypes.string,
|
||||||
|
isAdmin: PropTypes.bool,
|
||||||
|
isMobile: PropTypes.bool,
|
||||||
|
isHiddenMainMenu: PropTypes.bool,
|
||||||
|
mainMenuDropdowns: PropTypes.arrayOf(PropTypes.shape({
|
||||||
|
id: PropTypes.string,
|
||||||
|
buttonTitle: PropTypes.string,
|
||||||
|
items: PropTypes.arrayOf(PropTypes.shape({
|
||||||
|
href: PropTypes.string,
|
||||||
|
title: PropTypes.string,
|
||||||
|
})),
|
||||||
|
})),
|
||||||
|
outlineLink: PropTypes.string,
|
||||||
|
};
|
||||||
|
|
||||||
|
HeaderBody.defaultProps = {
|
||||||
|
setModalPopupTarget: null,
|
||||||
|
toggleModalPopup: null,
|
||||||
|
isModalPopupOpen: false,
|
||||||
|
logo: null,
|
||||||
|
logoAltText: null,
|
||||||
|
number: '',
|
||||||
|
org: '',
|
||||||
|
title: '',
|
||||||
|
authenticatedUserAvatar: null,
|
||||||
|
username: null,
|
||||||
|
isAdmin: false,
|
||||||
|
isMobile: false,
|
||||||
|
isHiddenMainMenu: false,
|
||||||
|
mainMenuDropdowns: [],
|
||||||
|
outlineLink: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default HeaderBody;
|
||||||
73
src/studio-header/MobileHeader.jsx
Normal file
73
src/studio-header/MobileHeader.jsx
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
import React, { useState } from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { useToggle, ModalPopup } from '@openedx/paragon';
|
||||||
|
import HeaderBody from './HeaderBody';
|
||||||
|
import MobileMenu from './MobileMenu';
|
||||||
|
|
||||||
|
const MobileHeader = ({
|
||||||
|
mainMenuDropdowns,
|
||||||
|
...props
|
||||||
|
}) => {
|
||||||
|
const [isOpen, , close, toggle] = useToggle(false);
|
||||||
|
const [target, setTarget] = useState(null);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<HeaderBody
|
||||||
|
{...props}
|
||||||
|
isMobile
|
||||||
|
setModalPopupTarget={setTarget}
|
||||||
|
toggleModalPopup={toggle}
|
||||||
|
isModalPopupOpen={isOpen}
|
||||||
|
/>
|
||||||
|
<ModalPopup
|
||||||
|
hasArrow
|
||||||
|
placement="bottom"
|
||||||
|
positionRef={target}
|
||||||
|
isOpen={isOpen}
|
||||||
|
onClose={close}
|
||||||
|
onEscapeKey={close}
|
||||||
|
className="mobile-menu-container"
|
||||||
|
>
|
||||||
|
<MobileMenu {...{ mainMenuDropdowns }} />
|
||||||
|
</ModalPopup>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
MobileHeader.propTypes = {
|
||||||
|
studioBaseUrl: PropTypes.string.isRequired,
|
||||||
|
logoutUrl: PropTypes.string.isRequired,
|
||||||
|
number: PropTypes.string,
|
||||||
|
org: PropTypes.string,
|
||||||
|
title: PropTypes.string,
|
||||||
|
logo: PropTypes.string,
|
||||||
|
logoAltText: PropTypes.string,
|
||||||
|
authenticatedUserAvatar: PropTypes.string,
|
||||||
|
username: PropTypes.string,
|
||||||
|
isAdmin: PropTypes.bool,
|
||||||
|
mainMenuDropdowns: PropTypes.arrayOf(PropTypes.shape({
|
||||||
|
id: PropTypes.string,
|
||||||
|
buttonTitle: PropTypes.string,
|
||||||
|
items: PropTypes.arrayOf(PropTypes.shape({
|
||||||
|
href: PropTypes.string,
|
||||||
|
title: PropTypes.string,
|
||||||
|
})),
|
||||||
|
})),
|
||||||
|
outlineLink: PropTypes.string,
|
||||||
|
};
|
||||||
|
|
||||||
|
MobileHeader.defaultProps = {
|
||||||
|
logo: null,
|
||||||
|
logoAltText: null,
|
||||||
|
number: null,
|
||||||
|
org: null,
|
||||||
|
title: null,
|
||||||
|
authenticatedUserAvatar: null,
|
||||||
|
username: null,
|
||||||
|
isAdmin: false,
|
||||||
|
mainMenuDropdowns: [],
|
||||||
|
outlineLink: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default MobileHeader;
|
||||||
51
src/studio-header/MobileMenu.jsx
Normal file
51
src/studio-header/MobileMenu.jsx
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { Collapsible } from '@openedx/paragon';
|
||||||
|
|
||||||
|
const MobileMenu = ({
|
||||||
|
mainMenuDropdowns,
|
||||||
|
}) => (
|
||||||
|
<div
|
||||||
|
className="ml-4 p-2 bg-light-100 border border-gray-200 small rounded"
|
||||||
|
data-testid="mobile-menu"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
{mainMenuDropdowns.map(dropdown => {
|
||||||
|
const { id, buttonTitle, items } = dropdown;
|
||||||
|
return (
|
||||||
|
<Collapsible
|
||||||
|
className="border-light-100"
|
||||||
|
title={buttonTitle}
|
||||||
|
key={id}
|
||||||
|
>
|
||||||
|
<ul className="p-0" style={{ listStyleType: 'none' }}>
|
||||||
|
{items.map(item => (
|
||||||
|
<li className="mobile-menu-item">
|
||||||
|
<a href={item.href}>
|
||||||
|
{item.title}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</Collapsible>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
MobileMenu.propTypes = {
|
||||||
|
mainMenuDropdowns: PropTypes.arrayOf(PropTypes.shape({
|
||||||
|
id: PropTypes.string,
|
||||||
|
buttonTitle: PropTypes.string,
|
||||||
|
items: PropTypes.arrayOf(PropTypes.shape({
|
||||||
|
href: PropTypes.string,
|
||||||
|
title: PropTypes.string,
|
||||||
|
})),
|
||||||
|
})),
|
||||||
|
};
|
||||||
|
MobileMenu.defaultProps = {
|
||||||
|
mainMenuDropdowns: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
export default MobileMenu;
|
||||||
40
src/studio-header/NavDropdownMenu.jsx
Normal file
40
src/studio-header/NavDropdownMenu.jsx
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import {
|
||||||
|
Dropdown,
|
||||||
|
DropdownButton,
|
||||||
|
} from '@openedx/paragon';
|
||||||
|
|
||||||
|
const NavDropdownMenu = ({
|
||||||
|
id,
|
||||||
|
buttonTitle,
|
||||||
|
items,
|
||||||
|
}) => (
|
||||||
|
<DropdownButton
|
||||||
|
id={id}
|
||||||
|
title={buttonTitle}
|
||||||
|
variant="outline-primary"
|
||||||
|
className="mr-2"
|
||||||
|
>
|
||||||
|
{items.map(item => (
|
||||||
|
<Dropdown.Item
|
||||||
|
key={`${item.title}-dropdown-item`}
|
||||||
|
href={item.href}
|
||||||
|
className="small"
|
||||||
|
>
|
||||||
|
{item.title}
|
||||||
|
</Dropdown.Item>
|
||||||
|
))}
|
||||||
|
</DropdownButton>
|
||||||
|
);
|
||||||
|
|
||||||
|
NavDropdownMenu.propTypes = {
|
||||||
|
id: PropTypes.string.isRequired,
|
||||||
|
buttonTitle: PropTypes.string.isRequired,
|
||||||
|
items: PropTypes.arrayOf(PropTypes.shape({
|
||||||
|
href: PropTypes.string,
|
||||||
|
title: PropTypes.string,
|
||||||
|
})).isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default NavDropdownMenu;
|
||||||
75
src/studio-header/StudioHeader.jsx
Normal file
75
src/studio-header/StudioHeader.jsx
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
import React, { useContext } from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import Responsive from 'react-responsive';
|
||||||
|
import { AppContext } from '@edx/frontend-platform/react';
|
||||||
|
import { ensureConfig } from '@edx/frontend-platform';
|
||||||
|
|
||||||
|
import MobileHeader from './MobileHeader';
|
||||||
|
import HeaderBody from './HeaderBody';
|
||||||
|
|
||||||
|
ensureConfig([
|
||||||
|
'STUDIO_BASE_URL',
|
||||||
|
'SITE_NAME',
|
||||||
|
'LOGOUT_URL',
|
||||||
|
'LOGIN_URL',
|
||||||
|
'LOGO_URL',
|
||||||
|
], 'Studio Header component');
|
||||||
|
|
||||||
|
const StudioHeader = ({
|
||||||
|
number, org, title, isHiddenMainMenu, mainMenuDropdowns, outlineLink,
|
||||||
|
}) => {
|
||||||
|
const { authenticatedUser, config } = useContext(AppContext);
|
||||||
|
const props = {
|
||||||
|
logo: config.LOGO_URL,
|
||||||
|
logoAltText: `Studio ${config.SITE_NAME}`,
|
||||||
|
number,
|
||||||
|
org,
|
||||||
|
title,
|
||||||
|
username: authenticatedUser?.username,
|
||||||
|
isAdmin: authenticatedUser?.administrator,
|
||||||
|
authenticatedUserAvatar: authenticatedUser?.avatar,
|
||||||
|
studioBaseUrl: config.STUDIO_BASE_URL,
|
||||||
|
logoutUrl: config.LOGOUT_URL,
|
||||||
|
isHiddenMainMenu,
|
||||||
|
mainMenuDropdowns,
|
||||||
|
outlineLink,
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="studio-header">
|
||||||
|
<a className="nav-skip sr-only sr-only-focusable" href="#main">Skip to content</a>
|
||||||
|
<Responsive maxWidth={841}>
|
||||||
|
<MobileHeader {...props} />
|
||||||
|
</Responsive>
|
||||||
|
<Responsive minWidth={842}>
|
||||||
|
<HeaderBody {...props} />
|
||||||
|
</Responsive>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
StudioHeader.propTypes = {
|
||||||
|
number: PropTypes.string,
|
||||||
|
org: PropTypes.string,
|
||||||
|
title: PropTypes.string.isRequired,
|
||||||
|
isHiddenMainMenu: PropTypes.bool,
|
||||||
|
mainMenuDropdowns: PropTypes.arrayOf(PropTypes.shape({
|
||||||
|
id: PropTypes.string,
|
||||||
|
buttonTitle: PropTypes.string,
|
||||||
|
items: PropTypes.arrayOf(PropTypes.shape({
|
||||||
|
href: PropTypes.string,
|
||||||
|
title: PropTypes.string,
|
||||||
|
})),
|
||||||
|
})),
|
||||||
|
outlineLink: PropTypes.string,
|
||||||
|
};
|
||||||
|
|
||||||
|
StudioHeader.defaultProps = {
|
||||||
|
number: '',
|
||||||
|
org: '',
|
||||||
|
isHiddenMainMenu: false,
|
||||||
|
mainMenuDropdowns: [],
|
||||||
|
outlineLink: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default StudioHeader;
|
||||||
49
src/studio-header/StudioHeader.scss
Normal file
49
src/studio-header/StudioHeader.scss
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
$spacer: 1rem;
|
||||||
|
$white: #FFFFFF;
|
||||||
|
|
||||||
|
.studio-header {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1000;
|
||||||
|
|
||||||
|
height: 3.75rem;
|
||||||
|
box-shadow: 0 1px 0 0 rgb(0 0 0 / .1);
|
||||||
|
background: $white;
|
||||||
|
|
||||||
|
.btn-outline-primary {
|
||||||
|
border-color: $white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo {
|
||||||
|
display: block;
|
||||||
|
box-sizing: content-box;
|
||||||
|
position: relative;
|
||||||
|
top: -.05em;
|
||||||
|
height: 1.75rem;
|
||||||
|
padding: $spacer 0;
|
||||||
|
margin-right: $spacer;
|
||||||
|
|
||||||
|
img {
|
||||||
|
display: block;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.course-title-lockup {
|
||||||
|
@media only screen and (min-width: 769px) {
|
||||||
|
padding: .5rem;
|
||||||
|
padding-right: $spacer;
|
||||||
|
border-right: 1px solid #E5E5E5;
|
||||||
|
width: 70%;
|
||||||
|
}
|
||||||
|
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
span {
|
||||||
|
color: #333333;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
line-height: 1.375rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
197
src/studio-header/StudioHeader.test.jsx
Normal file
197
src/studio-header/StudioHeader.test.jsx
Normal file
@@ -0,0 +1,197 @@
|
|||||||
|
/* eslint-disable react/prop-types */
|
||||||
|
import React, { useMemo } from 'react';
|
||||||
|
import {
|
||||||
|
render,
|
||||||
|
fireEvent,
|
||||||
|
waitFor,
|
||||||
|
} from '@testing-library/react';
|
||||||
|
|
||||||
|
import { AppContext } from '@edx/frontend-platform/react';
|
||||||
|
import { IntlProvider } from '@edx/frontend-platform/i18n';
|
||||||
|
import { Context as ResponsiveContext } from 'react-responsive';
|
||||||
|
|
||||||
|
import StudioHeader from './StudioHeader';
|
||||||
|
import messages from './messages';
|
||||||
|
|
||||||
|
const authenticatedUser = {
|
||||||
|
userId: 3,
|
||||||
|
username: 'abc123',
|
||||||
|
administrator: true,
|
||||||
|
roles: [],
|
||||||
|
avatar: '/imges/test.png',
|
||||||
|
};
|
||||||
|
let currentUser;
|
||||||
|
let screenWidth = 1280;
|
||||||
|
|
||||||
|
const RootWrapper = ({
|
||||||
|
...props
|
||||||
|
}) => {
|
||||||
|
const appContextValue = useMemo(() => ({
|
||||||
|
authenticatedUser: currentUser,
|
||||||
|
config: {
|
||||||
|
LOGOUT_URL: process.env.LOGOUT_URL,
|
||||||
|
LOGO_URL: process.env.LOGO_URL,
|
||||||
|
SITE_NAME: process.env.SITE_NAME,
|
||||||
|
STUDIO_BASE_URL: process.env.STUDIO_BASE_URL,
|
||||||
|
LOGIN_URL: process.env.LOGIN_URL,
|
||||||
|
},
|
||||||
|
}), []);
|
||||||
|
const responsiveContextValue = useMemo(() => ({ width: screenWidth }), []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
// eslint-disable-next-line react/jsx-no-constructed-context-values, react/prop-types
|
||||||
|
<IntlProvider locale="en">
|
||||||
|
<AppContext.Provider value={appContextValue}>
|
||||||
|
<ResponsiveContext.Provider value={responsiveContextValue}>
|
||||||
|
<StudioHeader
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
</ResponsiveContext.Provider>
|
||||||
|
</AppContext.Provider>
|
||||||
|
</IntlProvider>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const props = {
|
||||||
|
number: '123',
|
||||||
|
org: 'Ed',
|
||||||
|
title: 'test',
|
||||||
|
mainMenuDropdowns: [
|
||||||
|
{
|
||||||
|
id: 'testId',
|
||||||
|
buttonTitle: 'test',
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
title: 'link',
|
||||||
|
href: '#',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
outlineLink: 'tEsTLInK',
|
||||||
|
};
|
||||||
|
|
||||||
|
describe('Header', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
jest.clearAllMocks();
|
||||||
|
currentUser = authenticatedUser;
|
||||||
|
});
|
||||||
|
describe('desktop', () => {
|
||||||
|
it('course lock up should be visible', () => {
|
||||||
|
const { getByTestId } = render(<RootWrapper {...props} />);
|
||||||
|
const courseLockUpBlock = getByTestId('course-lock-up-block');
|
||||||
|
|
||||||
|
expect(courseLockUpBlock).toBeVisible();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('mobile menu should not be visible', () => {
|
||||||
|
const { queryByTestId } = render(<RootWrapper {...props} />);
|
||||||
|
const mobileMenuButton = queryByTestId('mobile-menu-button');
|
||||||
|
|
||||||
|
expect(mobileMenuButton).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('desktop menu should be visible', () => {
|
||||||
|
const { getByTestId } = render(<RootWrapper {...props} />);
|
||||||
|
const desktopMenu = getByTestId('desktop-menu');
|
||||||
|
|
||||||
|
expect(desktopMenu).toBeVisible();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should render one dropdown', async () => {
|
||||||
|
const { getAllByRole, getByText } = render(<RootWrapper {...props} />);
|
||||||
|
const dropdownMenu = getAllByRole('button')[0];
|
||||||
|
|
||||||
|
expect(dropdownMenu).toBeVisible();
|
||||||
|
|
||||||
|
await waitFor(() => fireEvent.click(dropdownMenu));
|
||||||
|
const dropdownOption = getByText('link');
|
||||||
|
|
||||||
|
expect(dropdownOption).toBeVisible();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('maintenance should not be in user menu', async () => {
|
||||||
|
currentUser = { ...authenticatedUser, administrator: false };
|
||||||
|
const { getAllByRole, queryByText } = render(<RootWrapper {...props} />);
|
||||||
|
const userMenu = getAllByRole('button')[1];
|
||||||
|
await waitFor(() => fireEvent.click(userMenu));
|
||||||
|
const maintenanceButton = queryByText(messages['header.user.menu.maintenance'].defaultMessage);
|
||||||
|
|
||||||
|
expect(maintenanceButton).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('user menu should use avatar icon', async () => {
|
||||||
|
currentUser = { ...authenticatedUser, avatar: null };
|
||||||
|
const { getByTestId } = render(<RootWrapper {...props} />);
|
||||||
|
const avatarIcon = getByTestId('avatar-icon');
|
||||||
|
|
||||||
|
expect(avatarIcon).toBeVisible();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should hide nav items if prop isHiddenMainMenu true', async () => {
|
||||||
|
const initialProps = { ...props, isHiddenMainMenu: true };
|
||||||
|
const { queryByTestId } = render(<RootWrapper {...initialProps} />);
|
||||||
|
const desktopMenu = queryByTestId('desktop-menu');
|
||||||
|
const mobileMenuButton = queryByTestId('mobile-menu-button');
|
||||||
|
|
||||||
|
expect(mobileMenuButton).toBeNull();
|
||||||
|
|
||||||
|
expect(desktopMenu).toBeNull();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('mobile', () => {
|
||||||
|
beforeEach(() => { screenWidth = 500; });
|
||||||
|
it('course lock up should not be visible', async () => {
|
||||||
|
const { queryByTestId } = render(<RootWrapper {...props} />);
|
||||||
|
const courseLockUpBlock = queryByTestId('course-lock-up-block');
|
||||||
|
|
||||||
|
expect(courseLockUpBlock).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('mobile menu should be visible', async () => {
|
||||||
|
const { getByTestId } = render(<RootWrapper {...props} />);
|
||||||
|
const mobileMenuButton = getByTestId('mobile-menu-button');
|
||||||
|
|
||||||
|
expect(mobileMenuButton).toBeVisible();
|
||||||
|
await waitFor(() => fireEvent.click(mobileMenuButton));
|
||||||
|
const mobileMenu = getByTestId('mobile-menu');
|
||||||
|
|
||||||
|
expect(mobileMenu).toBeVisible();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('desktop menu should not be visible', () => {
|
||||||
|
const { queryByTestId } = render(<RootWrapper {...props} />);
|
||||||
|
const desktopMenu = queryByTestId('desktop-menu');
|
||||||
|
|
||||||
|
expect(desktopMenu).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('maintenance should be in user menu', async () => {
|
||||||
|
const { getAllByRole, getByText } = render(<RootWrapper {...props} />);
|
||||||
|
const userMenu = getAllByRole('button')[1];
|
||||||
|
await waitFor(() => fireEvent.click(userMenu));
|
||||||
|
const maintenanceButton = getByText(messages['header.user.menu.maintenance'].defaultMessage);
|
||||||
|
|
||||||
|
expect(maintenanceButton).toBeVisible();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('user menu should use avatar image', async () => {
|
||||||
|
const { getByTestId } = render(<RootWrapper {...props} />);
|
||||||
|
const avatarImage = getByTestId('avatar-image');
|
||||||
|
|
||||||
|
expect(avatarImage).toBeVisible();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should hide nav items if prop isHiddenMainMenu true', async () => {
|
||||||
|
const initialProps = { ...props, isHiddenMainMenu: true };
|
||||||
|
const { queryByTestId } = render(<RootWrapper {...initialProps} />);
|
||||||
|
const desktopMenu = queryByTestId('desktop-menu');
|
||||||
|
const mobileMenuButton = queryByTestId('mobile-menu-button');
|
||||||
|
|
||||||
|
expect(mobileMenuButton).toBeNull();
|
||||||
|
|
||||||
|
expect(desktopMenu).toBeNull();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
69
src/studio-header/UserMenu.jsx
Normal file
69
src/studio-header/UserMenu.jsx
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
||||||
|
import {
|
||||||
|
Avatar,
|
||||||
|
} from '@openedx/paragon';
|
||||||
|
import NavDropdownMenu from './NavDropdownMenu';
|
||||||
|
import getUserMenuItems from './utils';
|
||||||
|
|
||||||
|
const UserMenu = ({
|
||||||
|
username,
|
||||||
|
studioBaseUrl,
|
||||||
|
logoutUrl,
|
||||||
|
authenticatedUserAvatar,
|
||||||
|
isMobile,
|
||||||
|
isAdmin,
|
||||||
|
// injected
|
||||||
|
intl,
|
||||||
|
}) => {
|
||||||
|
const avatar = authenticatedUserAvatar ? (
|
||||||
|
<img
|
||||||
|
className="d-block w-100 h-100"
|
||||||
|
src={authenticatedUserAvatar}
|
||||||
|
alt={username}
|
||||||
|
data-testid="avatar-image"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<Avatar
|
||||||
|
size="sm"
|
||||||
|
className="mr-2"
|
||||||
|
alt={username}
|
||||||
|
data-testid="avatar-icon"
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
const title = isMobile ? avatar : <>{avatar}{username}</>;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<NavDropdownMenu
|
||||||
|
buttonTitle={title}
|
||||||
|
id="user-dropdown-menu"
|
||||||
|
items={getUserMenuItems({
|
||||||
|
studioBaseUrl,
|
||||||
|
logoutUrl,
|
||||||
|
intl,
|
||||||
|
isAdmin,
|
||||||
|
})}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
UserMenu.propTypes = {
|
||||||
|
username: PropTypes.string,
|
||||||
|
studioBaseUrl: PropTypes.string.isRequired,
|
||||||
|
logoutUrl: PropTypes.string.isRequired,
|
||||||
|
authenticatedUserAvatar: PropTypes.string,
|
||||||
|
isMobile: PropTypes.bool,
|
||||||
|
isAdmin: PropTypes.bool,
|
||||||
|
// injected
|
||||||
|
intl: intlShape.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
UserMenu.defaultProps = {
|
||||||
|
isMobile: false,
|
||||||
|
isAdmin: false,
|
||||||
|
authenticatedUserAvatar: null,
|
||||||
|
username: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default injectIntl(UserMenu);
|
||||||
3
src/studio-header/index.js
Normal file
3
src/studio-header/index.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
import StudioHeader from './StudioHeader';
|
||||||
|
|
||||||
|
export default StudioHeader;
|
||||||
56
src/studio-header/messages.js
Normal file
56
src/studio-header/messages.js
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
import { defineMessages } from '@edx/frontend-platform/i18n';
|
||||||
|
|
||||||
|
const messages = defineMessages({
|
||||||
|
'header.user.menu.studio': {
|
||||||
|
id: 'header.user.menu.studio',
|
||||||
|
defaultMessage: 'Studio Home',
|
||||||
|
description: 'Link to Studio Home',
|
||||||
|
},
|
||||||
|
'header.user.menu.maintenance': {
|
||||||
|
id: 'header.user.menu.maintenance',
|
||||||
|
defaultMessage: 'Maintenance',
|
||||||
|
description: 'Link to the Studio maintenance page',
|
||||||
|
},
|
||||||
|
'header.user.menu.logout': {
|
||||||
|
id: 'header.user.menu.logout',
|
||||||
|
defaultMessage: 'Logout',
|
||||||
|
description: 'Logout link',
|
||||||
|
},
|
||||||
|
'header.label.account.menu': {
|
||||||
|
id: 'header.label.account.menu',
|
||||||
|
defaultMessage: 'Account Menu',
|
||||||
|
description: 'The aria label for the account menu trigger',
|
||||||
|
},
|
||||||
|
'header.label.account.menu.for': {
|
||||||
|
id: 'header.label.account.menu.for',
|
||||||
|
defaultMessage: 'Account menu for {username}',
|
||||||
|
description: 'The aria label for the account menu trigger when the username is displayed in it',
|
||||||
|
},
|
||||||
|
'header.label.main.nav': {
|
||||||
|
id: 'header.label.main.nav',
|
||||||
|
defaultMessage: 'Main',
|
||||||
|
description: 'The aria label for the main menu nav',
|
||||||
|
},
|
||||||
|
'header.label.main.menu': {
|
||||||
|
id: 'header.label.main.menu',
|
||||||
|
defaultMessage: 'Main Menu',
|
||||||
|
description: 'The aria label for the main menu trigger',
|
||||||
|
},
|
||||||
|
'header.label.main.header': {
|
||||||
|
id: 'header.label.main.header',
|
||||||
|
defaultMessage: 'Main',
|
||||||
|
description: 'The aria label for the main header',
|
||||||
|
},
|
||||||
|
'header.label.secondary.nav': {
|
||||||
|
id: 'header.label.secondary.nav',
|
||||||
|
defaultMessage: 'Secondary',
|
||||||
|
description: 'The aria label for the seconary nav',
|
||||||
|
},
|
||||||
|
'header.label.courseOutline': {
|
||||||
|
id: 'header.label.courseOutline',
|
||||||
|
defaultMessage: 'Back to course outline in Studio',
|
||||||
|
description: 'The aria label for the link back to the Studio Course Outline',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default messages;
|
||||||
36
src/studio-header/utils.js
Normal file
36
src/studio-header/utils.js
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
import messages from './messages';
|
||||||
|
|
||||||
|
const getUserMenuItems = ({
|
||||||
|
studioBaseUrl,
|
||||||
|
logoutUrl,
|
||||||
|
intl,
|
||||||
|
isAdmin,
|
||||||
|
}) => {
|
||||||
|
let items = [
|
||||||
|
{
|
||||||
|
href: `${studioBaseUrl}`,
|
||||||
|
title: intl.formatMessage(messages['header.user.menu.studio']),
|
||||||
|
}, {
|
||||||
|
href: `${logoutUrl}`,
|
||||||
|
title: intl.formatMessage(messages['header.user.menu.logout']),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
if (isAdmin) {
|
||||||
|
items = [
|
||||||
|
{
|
||||||
|
href: `${studioBaseUrl}`,
|
||||||
|
title: intl.formatMessage(messages['header.user.menu.studio']),
|
||||||
|
}, {
|
||||||
|
href: `${studioBaseUrl}/maintenance`,
|
||||||
|
title: intl.formatMessage(messages['header.user.menu.maintenance']),
|
||||||
|
}, {
|
||||||
|
href: `${logoutUrl}`,
|
||||||
|
title: intl.formatMessage(messages['header.user.menu.logout']),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return items;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default getUserMenuItems;
|
||||||
6
src/test-utils.js
Normal file
6
src/test-utils.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
const executeThunk = async (thunk, dispatch, getState) => {
|
||||||
|
await thunk(dispatch, getState);
|
||||||
|
await new Promise(setImmediate);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default executeThunk;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { createConfig } = require('@edx/frontend-build');
|
const { createConfig } = require('@openedx/frontend-build');
|
||||||
|
|
||||||
module.exports = createConfig('webpack-dev', {
|
module.exports = createConfig('webpack-dev', {
|
||||||
entry: path.resolve(__dirname, 'example'),
|
entry: path.resolve(__dirname, 'example'),
|
||||||
|
|||||||
Reference in New Issue
Block a user