Skip to content

Commit ba401cb

Browse files
committed
feat: custom header links
1 parent 704a5c1 commit ba401cb

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

.env.development

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
ACCESS_TOKEN_COOKIE_NAME=edx-jwt-cookie-header-payload
22
ACCOUNT_PROFILE_URL=http://localhost:1995
3-
ACCOUNT_SETTINGS_LABEL=
43
ACCOUNT_SETTINGS_URL=http://localhost:1997
54
BASE_URL=localhost:8080
65
CREDENTIALS_BASE_URL=http://localhost:18150
@@ -18,6 +17,7 @@ ORDER_HISTORY_URL=localhost:1996/orders
1817
REFRESH_ACCESS_TOKEN_ENDPOINT=http://localhost:18000/login_refresh
1918
SEGMENT_KEY=null
2019
SHOW_FULLNAME=false
20+
SHOW_SETTINGS_LABEL=false
2121
SITE_NAME=Open edX
2222
USER_INFO_COOKIE_NAME=edx-user-info
2323
LOGO_URL=https://edx-cdn.org/v3/default/logo.svg

src/Header.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ ensureConfig([
2626

2727
subscribe(APP_CONFIG_INITIALIZED, () => {
2828
mergeConfig({
29-
ACCOUNT_SETTINGS_LABEL: process.env.ACCOUNT_SETTINGS_LABEL,
3029
AUTHN_MINIMAL_HEADER: !!process.env.AUTHN_MINIMAL_HEADER,
3130
DASHBOARD_URL: process.env.DASHBOARD_URL,
3231
EXTERNAL_ACCOUNT_PROFILE_URL: process.env.EXTERNAL_ACCOUNT_PROFILE_URL,
3332
SHOW_FULLNAME: process.env.SHOW_FULLNAME,
33+
SHOW_SETTINGS_LABEL: process.env.SHOW_SETTINGS_LABEL,
3434
}, 'Header additional config');
3535
});
3636

@@ -66,7 +66,7 @@ const Header = ({ intl }) => {
6666
{
6767
type: 'item',
6868
href: config.ACCOUNT_SETTINGS_URL,
69-
content: config.ACCOUNT_SETTINGS_LABEL ? config.ACCOUNT_SETTINGS_LABEL : intl.formatMessage(messages['header.user.menu.account.settings']),
69+
content: config.SHOW_SETTINGS_LABEL ? intl.formatMessage(messages['header.user.menu.settings']) : intl.formatMessage(messages['header.user.menu.account']),
7070
},
7171
{
7272
type: 'item',

src/Header.messages.jsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,16 @@ const messages = defineMessages({
3131
defaultMessage: 'Profile',
3232
description: 'Link to the user profile',
3333
},
34-
'header.user.menu.account.settings': {
35-
id: 'header.user.menu.account.settings',
34+
'header.user.menu.account': {
35+
id: 'header.user.menu.account',
3636
defaultMessage: 'Account',
3737
description: 'Link to account settings',
3838
},
39+
'header.user.menu.settings': {
40+
id: 'header.user.menu.settings',
41+
defaultMessage: 'Settings',
42+
description: 'Link to account settings',
43+
},
3944
'header.user.menu.order.history': {
4045
id: 'header.user.menu.order.history',
4146
defaultMessage: 'Order History',

src/learning-header/AuthenticatedUserDropdown.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ const AuthenticatedUserDropdown = ({ intl, name }) => {
2828
</Dropdown.Toggle>
2929
<Dropdown.Menu className="dropdown-menu-right">
3030
{dashboardMenuItem}
31-
<Dropdown.Item href={`${getConfig().ACCOUNT_PROFILE_URL}/u/${username}`}>
31+
<Dropdown.Item href={getConfig().EXTERNAL_ACCOUNT_PROFILE_URL ? getConfig().EXTERNAL_ACCOUNT_PROFILE_URL : `${getConfig().ACCOUNT_PROFILE_URL}/u/${username}`}>
3232
{intl.formatMessage(messages.profile)}
3333
</Dropdown.Item>
3434
<Dropdown.Item href={getConfig().ACCOUNT_SETTINGS_URL}>
35-
{intl.formatMessage(messages.settings)}
35+
{getConfig().SHOW_SETTINGS_LABEL ? intl.formatMessage(messages.settings) : intl.formatMessage(messages.account)}
3636
</Dropdown.Item>
3737
{ getConfig().ORDER_HISTORY_URL && (
3838
<Dropdown.Item href={getConfig().ORDER_HISTORY_URL}>

0 commit comments

Comments
 (0)