Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coach main navigation refactor #12775

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
30 changes: 13 additions & 17 deletions kolibri/plugins/coach/assets/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ import useSnackbar from 'kolibri.coreVue.composables.useSnackbar';
import { PageNames } from './constants';
import routes from './routes';
import pluginModule from './modules/pluginModule';
import { LessonsPageNames } from './constants/lessonsConstants';
import LessonEditDetailsPage from './views/plan/LessonEditDetailsPage';
import GroupsPage from './views/plan/GroupsPage';
import GroupMembersPage from './views/plan/GroupMembersPage';
import GroupEnrollPage from './views/plan/GroupEnrollPage';
import pages from './views/reports/allReportsPages';
import HomeActivityPage from './views/home/HomeActivityPage';

Expand Down Expand Up @@ -102,20 +98,20 @@ class CoachToolsModule extends KolibriApp {
to.name &&
[
PageNames.EXAMS,
LessonsPageNames.LESSONS_ROOT,
LessonsPageNames.LESSON_CREATION_ROOT,
LessonsPageNames.SUMMARY,
PageNames.LESSONS_ROOT,
PageNames.LESSON_CREATION_ROOT,
PageNames.SUMMARY,
LessonEditDetailsPage.name,
LessonsPageNames.SELECTION_ROOT,
LessonsPageNames.SELECTION,
LessonsPageNames.SELECTION_SEARCH,
LessonsPageNames.LESSON_SELECTION_BOOKMARKS,
LessonsPageNames.LESSON_SELECTION_BOOKMARKS_MAIN,
LessonsPageNames.SELECTION_CONTENT_PREVIEW,
LessonsPageNames.RESOURCE_CONTENT_PREVIEW,
GroupsPage.name,
GroupMembersPage.name,
GroupEnrollPage.name,
PageNames.SELECTION_ROOT,
PageNames.SELECTION,
PageNames.SELECTION_SEARCH,
PageNames.LESSON_SELECTION_BOOKMARKS,
PageNames.LESSON_SELECTION_BOOKMARKS_MAIN,
PageNames.SELECTION_CONTENT_PREVIEW,
PageNames.RESOURCE_CONTENT_PREVIEW,
PageNames.GROUP_SUMMARY,
PageNames.GROUP_ENROLL,
PageNames.GROUPS_ROOT,
PageNames.HOME_PAGE,
HomeActivityPage.name,
].includes(to.name)
Expand Down
21 changes: 20 additions & 1 deletion kolibri/plugins/coach/assets/src/constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { LessonsPageNames } from './lessonsConstants';
export const PageNames = {
HOME_PAGE: 'HomePage', // make sure this matches the Coach 'Home' page name
REPORTS_PAGE: 'REPORTS_PAGE',
PLAN_PAGE: 'PLAN_PAGE',
COACH_CLASS_LIST_PAGE: 'COACH_CLASS_LIST_PAGE',
NEW_COACH_PAGES: 'NEW_COACH_PAGES',
EXAMS: 'EXAMS',
Expand Down Expand Up @@ -42,9 +41,29 @@ export const PageNames = {
LESSON_PREVIEW_SELECTED_RESOURCES: 'LESSON_PREVIEW_SELECTED_RESOURCES',
LESSON_PREVIEW_RESOURCE: 'LESSON_PREVIEW_RESOURCE',

/* Lessons */
LESSON_CREATION_ROOT: 'LESSON_CREATION_ROOT',
AlexVelezLl marked this conversation as resolved.
Show resolved Hide resolved
LESSON_CREATION_ROOT_BETTER: 'LESSON_CREATION_ROOT_BETTER',
SUMMARY: 'LESSON_SUMMARY',
RESOURCE_USER_REPORT: 'RESOURCE_USER_REPORT',
RESOURCE_USER_REPORT_ROOT: 'RESOURCE_USER_REPORT_ROOT',
RESOURCE_CONTENT_PREVIEW: 'RESOURCE_CONTENT_PREVIEW', // exclusively a route name
SELECTION_ROOT: 'SELECTION_ROOT',
SELECTION: 'SELECTION',
SELECTION_SEARCH: 'SELECTION_SEARCH',
SELECTION_CONTENT_PREVIEW: 'SELECTION_CONTENT_PREVIEW', // exclusively a route name
CONTENT_PREVIEW: 'CONTENT_PREVIEW',
LESSON_SELECTION_BOOKMARKS: 'LESSON_SELECTION_BOOKMARKS',
LESSON_SELECTION_BOOKMARKS_MAIN: 'LESSON_SELECTION_BOOKMARKS_MAIN',

LESSONS_ROOT: 'LESSONS_ROOT',
LESSONS_ROOT_BETTER: 'LESSONS_ROOT_BETTER',

LEARNERS_ROOT: 'LEARNERS_ROOT',

GROUPS_ROOT: 'GROUPS_ROOT',
GROUP_SUMMARY: 'GROUP_SUMMARY',
GROUP_ENROLL: 'GROUP_ENROLL',
};

export const GroupModals = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
export const LessonsPageNames = {
PLAN_LESSONS_ROOT: 'PLAN_LESSONS_ROOT',
PLAN_LESSONS_ROOT_BETTER: 'PLAN_LESSONS_ROOT_BETTER',
LESSON_CREATION_ROOT: 'LESSON_CREATION_ROOT',
LESSON_CREATION_ROOT_BETTER: 'LESSON_CREATION_ROOT_BETTER',
SUMMARY: 'LESSON_SUMMARY',
AlexVelezLl marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
10 changes: 8 additions & 2 deletions kolibri/plugins/coach/assets/src/modules/lessonsRoot/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { LessonResource } from 'kolibri.resources';
import router from 'kolibri.coreVue.router';
import { createTranslator } from 'kolibri.utils.i18n';
import useSnackbar from 'kolibri.coreVue.composables.useSnackbar';
import { lessonSummaryLink } from '../../routes/planLessonsRouterUtils';
AlexVelezLl marked this conversation as resolved.
Show resolved Hide resolved
import { PageNames } from '../../constants';

const translator = createTranslator('LessonRootActionTexts', {
newLessonCreated: {
Expand Down Expand Up @@ -68,7 +68,13 @@ export function createLesson(store, { classId, payload }) {
createSnackbar(translator.$tr('newLessonCreated'));
// Update the class summary now that we have a new lesson in town!
store.dispatch('classSummary/refreshClassSummary', null, { root: true }).then(() => {
router.push(lessonSummaryLink({ classId, lessonId: newLesson.id }));
router.push({
name: PageNames.SUMMARY,
params: {
classId,
lessonId: newLesson.id,
},
});
resolve();
});
})
Expand Down
35 changes: 30 additions & 5 deletions kolibri/plugins/coach/assets/src/routes/groupsRoutes.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,49 @@
import store from 'kolibri.coreVue.vuex.store';
import { PageNames } from '../constants';
import ReportsGroupListPage from '../views/reports/ReportsGroupListPage.vue';
import { useGroups } from '../composables/useGroups';
import GroupsPage from '../views/plan/GroupsPage';
import GroupEnrollPage from '../views/plan/GroupEnrollPage';
import GroupMembersPage from '../views/plan/GroupMembersPage';

const CLASS = '/:classId';
const ALL_GROUPS = '/groups';
const GROUP = '/groups/:groupId';

function path(...args) {
return args.join('');
}

const { showGroupsPage } = useGroups();

export default [
{
name: PageNames.GROUPS_ROOT,
path: path(CLASS, ALL_GROUPS),
component: ReportsGroupListPage,
handler: () => {
store.dispatch('notLoading');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did we remove this notLoading dispatch? I don't mean that you shouldn't have, just want to make sure I understand if this is connected to other changes and that I understand them

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh its because we already handle this in the showGroupsPage

that was needed to show this report groups page.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

component: GroupsPage,
handler(to) {
showGroupsPage(store, to.params.classId);
},
meta: {
titleParts: ['learnersLabel', 'CLASS_NAME'],
titleParts: ['groupsLabel', 'CLASS_NAME'],
},
},
{
name: PageNames.GROUP_SUMMARY,
path: path(CLASS, GROUP),
component: GroupMembersPage,
handler(to) {
showGroupsPage(store, to.params.classId);
},
meta: {
titleParts: ['membersLabel', 'GROUP_NAME', 'CLASS_NAME'],
},
},
{
name: PageNames.GROUP_ENROLL,
path: path(CLASS, GROUP, '/enroll'),
component: GroupEnrollPage,
handler(to) {
showGroupsPage(store, to.params.classId);
},
},
];
2 changes: 1 addition & 1 deletion kolibri/plugins/coach/assets/src/routes/lessonsRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default [
component: LessonCreationPage,
},
{
name: PageNames.LESSON_CREATION_ROOT_BETTER,
name: LessonsPageNames.LESSON_CREATION_ROOT_BETTER,
path: path(CLASS, LESSONS_TEMP, '/edit'),
component: LessonCreationPage,
children: [
Expand Down
62 changes: 0 additions & 62 deletions kolibri/plugins/coach/assets/src/routes/planExamRoutes.js

This file was deleted.

24 changes: 0 additions & 24 deletions kolibri/plugins/coach/assets/src/routes/planLessonsRouterUtils.js

This file was deleted.

Loading