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 16 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
40 changes: 17 additions & 23 deletions kolibri/plugins/coach/assets/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ 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';

function _channelListState(data) {
Expand Down Expand Up @@ -69,8 +63,8 @@ class CoachToolsModule extends KolibriApp {
PageNames.QUIZ_SELECT_PRACTICE_QUIZ,
PageNames.QUIZ_SELECT_RESOURCES,
PageNames.QUIZ_SECTION_ORDER,
PageNames.BOOK_MARKED_RESOURCES,
pages.ReportsQuizLearnerPage.name,
PageNames.QUIZ_BOOK_MARKED_RESOURCES,
PageNames.QUIZ_LEARNER_REPORT,
];
// If we're navigating to the same page for a quiz summary page, don't set loading
if (
Expand Down Expand Up @@ -101,21 +95,21 @@ class CoachToolsModule extends KolibriApp {
if (
to.name &&
[
PageNames.EXAMS,
LessonsPageNames.PLAN_LESSONS_ROOT,
LessonsPageNames.LESSON_CREATION_ROOT,
LessonsPageNames.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.EXAMS_ROOT,
PageNames.LESSONS_ROOT,
PageNames.LESSON_CREATION_ROOT,
PageNames.LESSON_SUMMARY,
PageNames.LESSON_EDIT_DETAILS,
PageNames.LESSON_RESOURCE_SELECTION_ROOT,
PageNames.LESSON_RESOURCE_SELECTION,
PageNames.LESSON_RESOURCE_SELECTION_SEARCH,
PageNames.LESSON_SELECTION_BOOKMARKS,
PageNames.LESSON_SELECTION_BOOKMARKS_MAIN,
PageNames.LESSON_RESOURCE_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
4 changes: 2 additions & 2 deletions kolibri/plugins/coach/assets/src/composables/useLessons.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ref } from 'kolibri.lib.vueCompositionApi';
import { LearnerGroupResource } from 'kolibri.resources';
import useUser from 'kolibri.coreVue.composables.useUser';
import { LessonsPageNames } from '../constants/lessonsConstants';
import { PageNames } from '../constants';

// Place outside the function to keep the state
const lessonsAreLoading = ref(false);
Expand Down Expand Up @@ -37,7 +37,7 @@ export function useLessons() {
return Promise.all(loadRequirements).then(
([learnerGroups]) => {
store.commit('lessonsRoot/SET_LEARNER_GROUPS', learnerGroups);
store.commit('SET_PAGE_NAME', LessonsPageNames.PLAN_LESSONS_ROOT);
store.commit('SET_PAGE_NAME', PageNames.LESSONS_ROOT);
setLessonsLoading(false);
},
error => {
Expand Down
81 changes: 50 additions & 31 deletions kolibri/plugins/coach/assets/src/constants/index.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,66 @@
import { LessonsPageNames } from './lessonsConstants';

export const PageNames = {
/** Class Summary */
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',
EXAM_CREATION_ROOT: 'EXAM_CREATION_ROOT',

/** Newly added routes */
/** Exams and quizzes */
EXAMS_ROOT: 'EXAMS_ROOT',
EXAM_SUMMARY: 'EXAM_SUMMARY',
QUIZ_PREVIEW: 'QUIZ_PREVIEW',
QUIZ_LEARNER_PAGE_ROOT: 'QUIZ_LEARNER_PAGE_ROOT',
QUIZ_LEARNER_REPORT: 'QUIZ_LEARNER_REPORT',
QUIZ_SECTION_EDITOR: 'QUIZ_SECTION_EDITOR',
QUIZ_REPLACE_QUESTIONS: 'QUIZ_REPLACE_QUESTIONS',
QUIZ_SELECT_RESOURCES: 'QUIZ_SELECT_RESOURCES',
QUIZ_SELECT_PRACTICE_QUIZ: 'QUIZ_SELECT_PRACTICE_QUIZ',
QUIZ_SECTION_ORDER: 'QUIZ_SECTION_ORDER',
BOOK_MARKED_RESOURCES: 'BOOK_MARKED_RESOURCES',
QUIZ_QUESTION_PAGE_ROOT: 'QUIZ_QUESTION_PAGE_ROOT',
QUIZ_QUESTION_REPORT: 'QUIZ_QUESTION_REPORT',
QUIZ_BOOK_MARKED_RESOURCES: 'QUIZ_BOOK_MARKED_RESOURCES',

EXAM_REPORT: 'EXAM_REPORT',
EXAM_REPORT_DETAIL: 'EXAM_REPORT_DETAIL',
EXAM_REPORT_DETAIL_ROOT: 'EXAM_REPORT_DETAIL_ROOT',
REPORTS_LESSON_EXERCISE_LEARNER_PAGE_ROOT: 'REPORTS_LESSON_EXERCISE_LEARNER_PAGE_ROOT',
REPORTS_GROUP_REPORT_LESSON_EXERCISE_LEARNER_PAGE_ROOT:
'REPORTS_GROUP_REPORT_LESSON_EXERCISE_LEARNER_PAGE_ROOT',
REPORTS_LEARNER_ACTIVITY_EXERCISE_PAGE_ROOT: 'REPORTS_LEARNER_ACTIVITY_EXERCISE_PAGE_ROOT',
REPORTS_LEARNER_REPORT_LESSON_EXERCISE_PAGE_ROOT:
'REPORTS_LEARNER_REPORT_LESSON_EXERCISE_PAGE_ROOT',
REPORTS_LESSON_LEARNER_EXERCISE_PAGE_ROOT: 'REPORTS_LESSON_LEARNER_EXERCISE_PAGE_ROOT',
REPORTS_GROUP_LEARNER_REPORT_QUIZ_PAGE_ROOT: 'REPORTS_GROUP_LEARNER_REPORT_QUIZ_PAGE_ROOT',
REPORTS_GROUP_REPORT_QUIZ_LEARNER_PAGE_ROOT: 'REPORTS_GROUP_REPORT_QUIZ_LEARNER_PAGE_ROOT',
REPORTS_LEARNER_REPORT_QUIZ_PAGE_ROOT: 'REPORTS_LEARNER_REPORT_QUIZ_PAGE_ROOT',
REPORTS_QUIZ_LEARNER_PAGE_ROOT: 'REPORTS_QUIZ_LEARNER_PAGE_ROOT',
REPORTS_LESSON_EXERCISE_QUESTION_PAGE_ROOT: 'REPORTS_LESSON_EXERCISE_QUESTION_PAGE_ROOT',
REPORTS_GROUP_REPORT_LESSON_EXERCISE_QUESTION_PAGE_ROOT:
'REPORTS_GROUP_REPORT_LESSON_EXERCISE_QUESTION_PAGE_ROOT',
REPORTS_GROUP_REPORT_QUIZ_QUESTION_PAGE_ROOT: 'REPORTS_GROUP_REPORT_QUIZ_QUESTION_PAGE_ROOT',
REPORTS_QUIZ_QUESTION_PAGE_ROOT: 'REPORTS_QUIZ_QUESTION_PAGE_ROOT',
/* Lessons */
LESSONS_ROOT: 'LESSONS_ROOT',
LESSONS_ROOT_BETTER: 'LESSONS_ROOT_BETTER',
LESSON_SUMMARY: 'LESSON_SUMMARY',
LESSON_CREATION_ROOT: 'LESSON_CREATION_ROOT',
AlexVelezLl marked this conversation as resolved.
Show resolved Hide resolved
LESSON_CREATION_ROOT_BETTER: 'LESSON_CREATION_ROOT_BETTER',
RESOURCE_CONTENT_PREVIEW: 'RESOURCE_CONTENT_PREVIEW', // exclusively a route name
LESSON_RESOURCE_SELECTION_ROOT: 'LESSON_RESOURCE_SELECTION_ROOT',
LESSON_RESOURCE_SELECTION: 'LESSON_RESOURCE_SELECTION',
LESSON_RESOURCE_SELECTION_SEARCH: 'LESSON_RESOURCE_SELECTION_SEARCH',
LESSON_RESOURCE_SELECTION_CONTENT_PREVIEW: 'LESSON_RESOURCE_SELECTION_CONTENT_PREVIEW', // exclusively a route name
LESSON_CONTENT_PREVIEW: 'LESSON_CONTENT_PREVIEW',
LESSON_SELECTION_BOOKMARKS: 'LESSON_SELECTION_BOOKMARKS',
LESSON_SELECTION_BOOKMARKS_MAIN: 'LESSON_SELECTION_BOOKMARKS_MAIN',
LESSON_EDIT_DETAILS: 'LESSON_EDIT_DETAILS',
LESSON_SELECT_RESOURCES: 'LESSON_SELECT_RESOURCES',
LESSON_PREVIEW_SELECTED_RESOURCES: 'LESSON_PREVIEW_SELECTED_RESOURCES',
LESSON_PREVIEW_RESOURCE: 'LESSON_PREVIEW_RESOURCE',
LESSON_LEARNER_REPORT: 'LESSON_LEARNER_REPORT',
LESSON_RESOURCE_LEARNERS_REPORT: 'LESSON_RESOURCE_LEARNERS_REPORT',
LESSON_EXERCISE_LEARNER_PAGE_ROOT: 'LESSON_EXERCISE_LEARNER_PAGE_ROOT',
LESSON_EXERCISE_LEARNERS_REPORT: 'LESSON_EXERCISE_LEARNERS_REPORT',
LESSON_EXERCISE_LEARNER_REPORT: 'LESSON_EXERCISE_LEARNER_REPORT',
LESSON_EXERCISE_QUESTIONS_REPORT: 'LESSON_EXERCISE_QUESTIONS_REPORT',
LESSON_EXERCISE_QUESTION_PAGE_ROOT: 'LESSON_EXERCISE_QUESTION_PAGE_ROOT',
LESSON_EXERCISE_QUESTION_REPORT: 'LESSON_EXERCISE_QUESTION_REPORT',
LESSON_LEARNER_EXERCISE_PAGE_ROOT: 'LESSON_LEARNER_EXERCISE_PAGE_ROOT',
LESSON_LEARNER_EXERCISE_REPORT: 'LESSON_LEARNER_EXERCISE_REPORT',

/* Learners */
LEARNERS_ROOT: 'LEARNERS_ROOT',
LEARNER_SUMMARY: 'LEARNER_SUMMARY',
LEARNER_LESSON_REPORT: 'LEARNER_LESSON_REPORT',

/** Groups */
GROUPS_ROOT: 'GROUPS_ROOT',
GROUP_SUMMARY: 'GROUP_SUMMARY',
GROUP_ENROLL: 'GROUP_ENROLL',
GROUP_EXAM_SUMMARY: 'GROUP_EXAM_SUMMARY',
GROUP_LESSON_SUMMARY: 'GROUP_LESSON_SUMMARY',
GROUP_LESSON_LEARNER: 'GROUP_LESSON_LEARNER',
GROUP_LESSON_EXERCISE_QUESTIONS_REPORT: 'GROUP_LESSON_EXERCISE_QUESTIONS_REPORT',
GROUP_LESSON_EXERCISE_LEARNER_REPORT: 'GROUP_LESSON_EXERCISE_LEARNER_REPORT',
};

export const GroupModals = {
Expand All @@ -57,9 +78,7 @@ export const ViewMoreButtonStates = {
};

export const pageNameToModuleMap = {
[PageNames.EXAM_REPORT_DETAIL]: 'examReportDetail',
[LessonsPageNames.PLAN_LESSONS_ROOT]: 'lessonsRoot',
[LessonsPageNames.RESOURCE_USER_REPORT]: 'exerciseDetail',
[PageNames.LESSONS_ROOT]: 'lessonsRoot',
// Omitting modules for resource selection, exam creation, and preview to prevent
// default module state resetting behavior.
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export const LastPages = {
HOME_PAGE: 'homepage',
HOME_ACTIVITY: 'homeactivity',
GROUP_ACTIVITY: 'groupactivity',
LEARNER_ACTIVITY: 'learneractivity',
EXERCISE_LEARNER_LIST: 'exerciselearnerlist',
EXERCISE_LEARNER_LIST_BY_GROUPS: 'exerciselearnerlistbygroups',
Expand Down
18 changes: 0 additions & 18 deletions kolibri/plugins/coach/assets/src/constants/lessonsConstants.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
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: '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',
};

export const CollectionTypes = {
LEARNERGROUP: 'learnergroup',
ADHOCLEARNERSGROUP: 'adhoclearnersgroup',
Expand Down
7 changes: 0 additions & 7 deletions kolibri/plugins/coach/assets/src/constants/tabsConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ export const ReportsTabs = {
LEARNERS: 'tabLearners',
};

export const PLAN_TABS_ID = 'coachPlan';
export const PlanTabs = {
LESSONS: 'tabLessons',
QUIZZES: 'tabQuizzes',
GROUPS: 'tabGroups',
};

export const REPORTS_GROUP_TABS_ID = 'coachPlanGroup';
export const ReportsGroupTabs = {
REPORTS: 'tabReports',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import find from 'lodash/find';
import { CollectionTypes } from '../../constants/lessonsConstants';
import { PageNames } from '../../constants';

// Just makes an params object that should work with all the paths.
// It has extra params that may not be used by some routes.
// See reportRoutes.js for details on param naming.
function makeParams(notification) {
return {
groupId: notification.collection.id,
Expand All @@ -28,111 +28,95 @@ const pageNameToNotificationPropsMap = [
isMultiple: true,
isWholeClass: false,
},
value: 'ReportsGroupReportLessonExerciseLearnerListPage',
},
{
key: {
object: 'NonExercise',
isMultiple: true,
isWholeClass: false,
},
value: 'ReportsGroupReportLessonResourceLearnerListPage',
value: PageNames.GROUP_LESSON_EXERCISE_LEARNER_REPORT,
},
{
key: {
object: 'Lesson',
isMultiple: true,
isWholeClass: false,
},
value: 'ReportsGroupReportLessonPage',
value: PageNames.GROUP_LESSON_SUMMARY,
},
{
key: {
object: 'Quiz',
isMultiple: true,
isWholeClass: false,
},
value: 'ReportsGroupReportQuizLearnerListPage',
value: PageNames.GROUP_EXAM_SUMMARY,
},
{
key: {
object: 'Exercise',
isMultiple: true,
isWholeClass: true,
},
value: 'ReportsLessonExerciseLearnerListPage',
value: PageNames.LESSON_EXERCISE_LEARNERS_REPORT,
},
{
key: {
object: 'NonExercise',
isMultiple: true,
isWholeClass: true,
},
value: 'ReportsLessonResourceLearnerListPage',
value: PageNames.LESSON_RESOURCE_LEARNERS_REPORT,
},
{
key: {
object: 'Lesson',
isMultiple: true,
isWholeClass: true,
},
value: 'ReportsLessonLearnerListPage',
value: PageNames.LESSON_SUMMARY,
},
{
key: {
object: 'Quiz',
isMultiple: true,
isWholeClass: true,
},
value: 'ReportsQuizLearnerListPage',
},
{
key: {
object: 'Exercise',
isMultiple: false,
isWholeClass: false,
},
value: 'ReportsGroupReportLessonExerciseLearnerPage',
value: PageNames.EXAM_SUMMARY,
},
{
key: {
object: 'Lesson',
isMultiple: false,
isWholeClass: false,
},
value: 'ReportsLessonLearnerPage',
value: PageNames.LEARNER_LESSON_REPORT,
},
{
key: {
object: 'Quiz',
isMultiple: false,
isWholeClass: false,
},
value: 'ReportsLearnerReportQuizPage',
value: PageNames.QUIZ_LEARNER_PAGE_ROOT,
},
{
key: {
object: 'Exercise',
isMultiple: false,
isWholeClass: true,
},
value: 'REPORTS_LESSON_EXERCISE_LEARNER_PAGE_ROOT',
value: PageNames.LESSON_EXERCISE_LEARNER_PAGE_ROOT,
},
{
key: {
object: 'Lesson',
isMultiple: false,
isWholeClass: true,
},
value: 'ReportsLessonLearnerPage',
value: PageNames.LEARNER_LESSON_REPORT,
},
{
key: {
object: 'Quiz',
isMultiple: false,
isWholeClass: true,
},
value: 'ReportsQuizLearnerPage',
value: PageNames.QUIZ_LEARNER_PAGE_ROOT,
},
];

Expand Down
Loading