Skip to content

Commit 6d94b75

Browse files
arbrandesclaude
andcommitted
fix!: adapt to upstream provides data shape change
Adapts to the upstream rename of the provides constant and the flat string data shape. Removes the messages export from index.ts since translations are handled at the site level. BREAKING CHANGE: public identifiers now use `instructorDashboard` instead of `instructor`. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ddaa1ac commit 6d94b75

11 files changed

Lines changed: 32 additions & 26 deletions

File tree

site.config.dev.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { EnvironmentTypes, SiteConfig, footerApp, headerApp, shellApp } from '@openedx/frontend-base';
22

3-
import { instructApp } from './src';
3+
import { instructorDashboardApp } from './src';
44

55
import './src/app.scss';
66

@@ -17,7 +17,7 @@ const siteConfig: SiteConfig = {
1717
shellApp,
1818
headerApp,
1919
footerApp,
20-
instructApp
20+
instructorDashboardApp
2121
],
2222
externalRoutes: [
2323
{

site.config.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const siteConfig: SiteConfig = {
1111
// if EnvironmentTypes.TEST is set, some tests fails due to it, TODO: update here once this issue is fixed in frontend-base
1212
environment: EnvironmentTypes?.TEST ?? 'test',
1313
apps: [{
14-
appId: 'org.openedx.frontend.app.instructor',
14+
appId: 'org.openedx.frontend.app.instructorDashboard',
1515
config: {}
1616
}],
1717
};

src/app.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,18 @@ import { appId } from '@src/constants';
33
import routes from '@src/routes';
44
import slots from '@src/slots';
55
import providers from '@src/providers';
6+
import provides from '@src/provides';
67

78
const app: App = {
89
appId,
910
routes,
1011
providers,
12+
provides,
1113
slots,
1214
config: {
1315
NODE_ENV: 'development',
1416
LMS_BASE_URL: 'http://local.openedx.io:8000'
1517
},
16-
provides: {
17-
'org.openedx.frontend.provides.courseNavigationRoles.v1': {
18-
courseNavigationRoles: ['org.openedx.frontend.role.instructor'],
19-
},
20-
},
2118
};
2219

2320
export default app;

src/constants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
export const appId = 'org.openedx.frontend.app.instructor';
1+
export const appId = 'org.openedx.frontend.app.instructorDashboard';
2+
export const instructorDashboardRole = 'org.openedx.frontend.role.instructorDashboard';

src/data/api.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe('base api', () => {
3535
it('fetches course info successfully', async () => {
3636
const courseId = 'test-course-123';
3737
const result = await getCourseInfo(courseId);
38-
expect(mockGetAppConfig).toHaveBeenCalledWith('org.openedx.frontend.app.instructor');
38+
expect(mockGetAppConfig).toHaveBeenCalledWith('org.openedx.frontend.app.instructorDashboard');
3939
expect(mockGetAuthenticatedHttpClient).toHaveBeenCalled();
4040
expect(mockHttpClient.get).toHaveBeenCalledWith('https://test-lms.com/api/instructor/v2/courses/test-course-123');
4141
expect(mockCamelCaseObject).toHaveBeenCalledWith(mockCourseData);

src/dataDownloads/data/apiHook.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ describe('dataDownloads apiHook', () => {
3030

3131
describe('queryKeys', () => {
3232
it('should generate correct query keys', () => {
33-
expect(queryKeys.generatedReports('course-123')).toEqual(['org.openedx.frontend.app.instructor', 'dataDownloads', 'generatedReports', 'course-123']);
34-
expect(queryKeys.generateReportLink('course-456')).toEqual(['org.openedx.frontend.app.instructor', 'dataDownloads', 'reportLink', 'course-456']);
33+
expect(queryKeys.generatedReports('course-123')).toEqual(['org.openedx.frontend.app.instructorDashboard', 'dataDownloads', 'generatedReports', 'course-123']);
34+
expect(queryKeys.generateReportLink('course-456')).toEqual(['org.openedx.frontend.app.instructorDashboard', 'dataDownloads', 'reportLink', 'course-456']);
3535
});
3636
});
3737

src/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
export { default as instructApp } from './app';
2-
export { default as instructRoutes } from './routes';
3-
export { default as instructMessages } from './i18n';
1+
export { default as instructorDashboardApp } from './app';
2+
export { default as instructorDashboardRoutes } from './routes';

src/instructorNav/InstructorNav.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface TabProps {
1515
const InstructorNav = () => {
1616
const { courseId = '', tabId = '' } = useParams<{ courseId: string, tabId?: string }>();
1717
const { data: courseInfo, isLoading } = useCourseInfo(courseId);
18-
const widgetPropsArray = useWidgetProps('org.openedx.frontend.slot.instructor.tabs.v1') as TabProps[];
18+
const widgetPropsArray = useWidgetProps('org.openedx.frontend.slot.instructorDashboard.tabs.v1') as TabProps[];
1919
const { clearAlerts } = useAlert();
2020

2121
const sortedTabs = useMemo(() => {

src/provides.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { providesCourseNavigationRolesId } from '@openedx/frontend-base';
2+
import { instructorDashboardRole } from './constants';
3+
4+
const provides = {
5+
[providesCourseNavigationRolesId]: instructorDashboardRole
6+
};
7+
8+
export default provides;

src/routes.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import OpenResponsesPage from '@src/openResponses/OpenResponsesPage';
1111
import SpecialExamsPage from '@src/specialExams/SpecialExamsPage';
1212
import PageNotFound from '@src/components/PageNotFound';
1313
import { useWidgetProps } from './slots/SlotUtils';
14+
import { instructorDashboardRole } from './constants';
1415

1516
interface InstructorRouteProps {
1617
tabId: string,
@@ -32,7 +33,7 @@ const defaultTabs: InstructorRouteProps[] = [
3233

3334
const TabContent = () => {
3435
const { tabId } = useParams<{ tabId: string }>();
35-
const routeWidgets = useWidgetProps('org.openedx.frontend.slot.instructor.routes.v1') as InstructorRouteProps[];
36+
const routeWidgets = useWidgetProps('org.openedx.frontend.slot.instructorDashboard.routes.v1') as InstructorRouteProps[];
3637

3738
const tabRoutes = [
3839
...defaultTabs.filter(
@@ -48,10 +49,10 @@ const TabContent = () => {
4849

4950
const routes = [
5051
{
51-
id: 'org.openedx.frontend.route.instructor.main',
52+
id: 'org.openedx.frontend.route.instructorDashboard.main',
5253
path: 'instructor-dashboard/:courseId',
5354
handle: {
54-
role: 'org.openedx.frontend.role.instructor'
55+
role: instructorDashboardRole
5556
},
5657
async lazy() {
5758
const module = await import('./Main');

0 commit comments

Comments
 (0)