Skip to content

Commit 3c2ccdc

Browse files
arbrandesclaude
andcommitted
fix: scope header slot widgets to dashboard role
Fixes #829 Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 1fa94a4 commit 3c2ccdc

3 files changed

Lines changed: 20 additions & 3 deletions

File tree

src/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export const appId = 'org.openedx.frontend.app.learnerDashboard';
2+
export const dashboardRole = 'org.openedx.frontend.role.dashboard';

src/routes.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { authenticatedLoader } from '@openedx/frontend-base';
2+
import { dashboardRole } from './constants';
23

34
const routes = [
45
{
56
id: 'org.openedx.frontend.route.learnerDashboard.main',
67
path: '/learner-dashboard',
78
loader: authenticatedLoader,
89
handle: {
9-
role: 'org.openedx.frontend.role.dashboard'
10+
role: dashboardRole
1011
},
1112
async lazy () {
1213
const module = await import('./Main');

src/widgets/LearnerDashboardHeader/app.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { App, LinkMenuItem, WidgetOperationTypes, getAppConfig } from '@openedx/frontend-base';
22

3-
import { appId } from '../../constants';
3+
import { appId, dashboardRole } from '../../constants';
44

55
import ConfirmEmailBanner from './ConfirmEmailBanner';
66
import MasqueradeBar from './MasqueradeBar';
@@ -18,6 +18,9 @@ const app: App = {
1818
id: 'org.openedx.frontend.widget.learnerDashboard.headerConfirmEmail.v1',
1919
op: WidgetOperationTypes.PREPEND,
2020
component: ConfirmEmailBanner,
21+
condition: {
22+
active: [dashboardRole]
23+
}
2124
},
2225
{
2326
slotId: 'org.openedx.frontend.slot.header.primaryLinks.v1',
@@ -29,7 +32,10 @@ const app: App = {
2932
url="/"
3033
variant="navLink"
3134
/>
32-
)
35+
),
36+
condition: {
37+
active: [dashboardRole]
38+
}
3339
},
3440
{
3541
slotId: 'org.openedx.frontend.slot.header.primaryLinks.v1',
@@ -41,6 +47,7 @@ const app: App = {
4147
/>
4248
),
4349
condition: {
50+
active: [dashboardRole],
4451
callback: () => getAppConfig(appId).ENABLE_PROGRAMS === true,
4552
}
4653
},
@@ -53,6 +60,9 @@ const app: App = {
5360
variant="navLink"
5461
/>
5562
),
63+
condition: {
64+
active: [dashboardRole]
65+
}
5666
},
5767
{
5868
slotId: 'org.openedx.frontend.slot.header.secondaryLinks.v1',
@@ -64,6 +74,7 @@ const app: App = {
6474
/>
6575
),
6676
condition: {
77+
active: [dashboardRole],
6778
callback: () => getAppConfig(appId).SUPPORT_URL ? true : false,
6879
}
6980
},
@@ -78,6 +89,7 @@ const app: App = {
7889
/>
7990
),
8091
condition: {
92+
active: [dashboardRole],
8193
callback: () => getAppConfig(appId).ORDER_HISTORY_URL ? true : false,
8294
}
8395
},
@@ -86,6 +98,9 @@ const app: App = {
8698
id: 'org.openedx.frontend.widget.learnerDashboard.headerMasqueradeBar.v1',
8799
op: WidgetOperationTypes.APPEND,
88100
component: MasqueradeBar,
101+
condition: {
102+
active: [dashboardRole]
103+
}
89104
},
90105
]
91106
};

0 commit comments

Comments
 (0)