Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export const appId = 'org.openedx.frontend.app.learnerDashboard';
export const dashboardRole = 'org.openedx.frontend.role.dashboard';
3 changes: 2 additions & 1 deletion src/routes.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { authenticatedLoader } from '@openedx/frontend-base';
import { dashboardRole } from './constants';

const routes = [
{
id: 'org.openedx.frontend.route.learnerDashboard.main',
path: '/learner-dashboard',
loader: authenticatedLoader,
handle: {
role: 'org.openedx.frontend.role.dashboard'
role: dashboardRole
},
async lazy () {
const module = await import('./Main');
Expand Down
19 changes: 17 additions & 2 deletions src/widgets/LearnerDashboardHeader/app.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { App, LinkMenuItem, WidgetOperationTypes, getAppConfig } from '@openedx/frontend-base';

import { appId } from '../../constants';
import { appId, dashboardRole } from '../../constants';

import ConfirmEmailBanner from './ConfirmEmailBanner';
import MasqueradeBar from './MasqueradeBar';
Expand All @@ -18,6 +18,9 @@ const app: App = {
id: 'org.openedx.frontend.widget.learnerDashboard.headerConfirmEmail.v1',
op: WidgetOperationTypes.PREPEND,
component: ConfirmEmailBanner,
condition: {
active: [dashboardRole]
}
},
{
slotId: 'org.openedx.frontend.slot.header.primaryLinks.v1',
Expand All @@ -29,7 +32,10 @@ const app: App = {
url="/"
variant="navLink"
/>
)
),
condition: {
active: [dashboardRole]
}
},
{
slotId: 'org.openedx.frontend.slot.header.primaryLinks.v1',
Expand All @@ -41,6 +47,7 @@ const app: App = {
/>
),
condition: {
active: [dashboardRole],
callback: () => getAppConfig(appId).ENABLE_PROGRAMS === true,
}
},
Expand All @@ -53,6 +60,9 @@ const app: App = {
variant="navLink"
/>
),
condition: {
active: [dashboardRole]
}
},
{
slotId: 'org.openedx.frontend.slot.header.secondaryLinks.v1',
Expand All @@ -64,6 +74,7 @@ const app: App = {
/>
),
condition: {
active: [dashboardRole],
callback: () => getAppConfig(appId).SUPPORT_URL ? true : false,
}
},
Expand All @@ -78,6 +89,7 @@ const app: App = {
/>
),
condition: {
active: [dashboardRole],
callback: () => getAppConfig(appId).ORDER_HISTORY_URL ? true : false,
}
},
Expand All @@ -86,6 +98,9 @@ const app: App = {
id: 'org.openedx.frontend.widget.learnerDashboard.headerMasqueradeBar.v1',
op: WidgetOperationTypes.APPEND,
component: MasqueradeBar,
condition: {
active: [dashboardRole]
}
},
]
};
Expand Down
Loading