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,560 changes: 1,368 additions & 192 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions site.config.dev.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EnvironmentTypes, SiteConfig, footerApp, headerApp, shellApp } from '@openedx/frontend-base';

import { instructApp } from './src';
import { instructorDashboardApp } from './src';

import './src/app.scss';

Expand All @@ -17,7 +17,7 @@ const siteConfig: SiteConfig = {
shellApp,
headerApp,
footerApp,
instructApp
instructorDashboardApp
],
externalRoutes: [
{
Expand Down
2 changes: 1 addition & 1 deletion site.config.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const siteConfig: SiteConfig = {
// if EnvironmentTypes.TEST is set, some tests fails due to it, TODO: update here once this issue is fixed in frontend-base
environment: EnvironmentTypes?.TEST ?? 'test',
apps: [{
appId: 'org.openedx.frontend.app.instructor',
appId: 'org.openedx.frontend.app.instructorDashboard',
config: {}
}],
};
Expand Down
7 changes: 2 additions & 5 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,18 @@ import { appId } from '@src/constants';
import routes from '@src/routes';
import slots from '@src/slots';
import providers from '@src/providers';
import provides from '@src/provides';

const app: App = {
appId,
routes,
providers,
provides,
slots,
config: {
NODE_ENV: 'development',
LMS_BASE_URL: 'http://local.openedx.io:8000'
},
provides: {
'org.openedx.frontend.provides.courseNavigationRoles.v1': {
courseNavigationRoles: ['org.openedx.frontend.role.instructor'],
},
},
};

export default app;
3 changes: 2 additions & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export const appId = 'org.openedx.frontend.app.instructor';
export const appId = 'org.openedx.frontend.app.instructorDashboard';
export const instructorDashboardRole = 'org.openedx.frontend.role.instructorDashboard';
2 changes: 1 addition & 1 deletion src/data/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('base api', () => {
it('fetches course info successfully', async () => {
const courseId = 'test-course-123';
const result = await getCourseInfo(courseId);
expect(mockGetAppConfig).toHaveBeenCalledWith('org.openedx.frontend.app.instructor');
expect(mockGetAppConfig).toHaveBeenCalledWith('org.openedx.frontend.app.instructorDashboard');
expect(mockGetAuthenticatedHttpClient).toHaveBeenCalled();
expect(mockHttpClient.get).toHaveBeenCalledWith('https://test-lms.com/api/instructor/v2/courses/test-course-123');
expect(mockCamelCaseObject).toHaveBeenCalledWith(mockCourseData);
Expand Down
4 changes: 2 additions & 2 deletions src/dataDownloads/data/apiHook.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ describe('dataDownloads apiHook', () => {

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

Expand Down
5 changes: 2 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export { default as instructApp } from './app';
export { default as instructRoutes } from './routes';
export { default as instructMessages } from './i18n';
export { default as instructorDashboardApp } from './app';
export { default as instructorDashboardRoutes } from './routes';
2 changes: 1 addition & 1 deletion src/instructorNav/InstructorNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface TabProps {
const InstructorNav = () => {
const { courseId = '', tabId = '' } = useParams<{ courseId: string, tabId?: string }>();
const { data: courseInfo, isLoading } = useCourseInfo(courseId);
const widgetPropsArray = useWidgetProps('org.openedx.frontend.slot.instructor.tabs.v1') as TabProps[];
const widgetPropsArray = useWidgetProps('org.openedx.frontend.slot.instructorDashboard.tabs.v1') as TabProps[];
const { clearAlerts } = useAlert();

const sortedTabs = useMemo(() => {
Expand Down
8 changes: 8 additions & 0 deletions src/provides.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { providesCourseNavigationRolesId } from '@openedx/frontend-base';
import { instructorDashboardRole } from './constants';

const provides = {
[providesCourseNavigationRolesId]: instructorDashboardRole
};

export default provides;
7 changes: 4 additions & 3 deletions src/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import OpenResponsesPage from '@src/openResponses/OpenResponsesPage';
import SpecialExamsPage from '@src/specialExams/SpecialExamsPage';
import PageNotFound from '@src/components/PageNotFound';
import { useWidgetProps } from './slots/SlotUtils';
import { instructorDashboardRole } from './constants';

interface InstructorRouteProps {
tabId: string,
Expand All @@ -32,7 +33,7 @@ const defaultTabs: InstructorRouteProps[] = [

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

const tabRoutes = [
...defaultTabs.filter(
Expand All @@ -48,10 +49,10 @@ const TabContent = () => {

const routes = [
{
id: 'org.openedx.frontend.route.instructor.main',
id: 'org.openedx.frontend.route.instructorDashboard.main',
path: 'instructor-dashboard/:courseId',
handle: {
role: 'org.openedx.frontend.role.instructor'
role: instructorDashboardRole
},
async lazy() {
const module = await import('./Main');
Expand Down
14 changes: 7 additions & 7 deletions src/slots/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { WidgetOperationTypes } from '@openedx/frontend-base';
import { PlaceholderSlot } from './src/slots/PlaceholderSlot/PlaceholderSlot';
import { EnvironmentTypes, SiteConfig, footerApp, headerApp, shellApp } from '@openedx/frontend-base';

import { instructApp } from './src';
import { instructorDashboardApp } from './src';

import './src/app.scss';

Expand All @@ -47,17 +47,17 @@ const siteConfig: SiteConfig = {
headerApp,
footerApp,
{
...instructApp,
...instructorDashboardApp,
slots: [
{
slotId: 'org.openedx.frontend.slot.instructor.tabs.v1',
id: 'org.openedx.frontend.widget.instructor.tab.my_tab',
slotId: 'org.openedx.frontend.slot.instructorDashboard.tabs.v1',
id: 'org.openedx.frontend.widget.instructorDashboard.tab.my_tab',
op: WidgetOperationTypes.APPEND,
element: <PlaceholderSlot tabId="my_tab" title="New Tab" url="my_tab" sortOrder={25} />,
},
{
slotId: 'org.openedx.frontend.slot.instructor.routes.v1',
id: 'org.openedx.frontend.widget.instructor.route.my_tab',
slotId: 'org.openedx.frontend.slot.instructorDashboard.routes.v1',
id: 'org.openedx.frontend.widget.instructorDashboard.route.my_tab',
op: WidgetOperationTypes.APPEND,
element: <PlaceholderSlot tabId="my_tab" content={<div>Dynamic Content</div>} />,
}
Expand Down Expand Up @@ -108,7 +108,7 @@ export const PlaceholderSlot = (_props: Record<string, any>) => null;
```tsx
const TabContent = () => {
const { tabId } = useParams<{ tabId: string }>();
const routeWidgets = useWidgetProps('org.openedx.frontend.slot.instructor.routes.v1') as InstructorRouteProps[];
const routeWidgets = useWidgetProps('org.openedx.frontend.slot.instructorDashboard.routes.v1') as InstructorRouteProps[];

const tabRoutes = [
...defaultTabs.filter(
Expand Down
Loading