Skip to content

Commit 3927eb2

Browse files
authored
Merge pull request #1792 from DXCanas/learn-rec-modularize-actions
View More page links in recommended
2 parents 08ecbb8 + 940a419 commit 3927eb2

File tree

16 files changed

+601
-353
lines changed

16 files changed

+601
-353
lines changed

kolibri/plugins/learn/assets/src/app.js

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,15 @@ import router from 'kolibri.coreVue.router';
55
import Vue from 'kolibri.lib.vue';
66

77
import RootVue from './views';
8-
import * as actions from './state/actions';
8+
import * as actions from './state/actions/main';
9+
import {
10+
showLearnChannel,
11+
showPopularPage,
12+
showNextStepsPage,
13+
showResumePage,
14+
showFeaturedPage,
15+
showLearnContent,
16+
} from './state/actions/recommended';
917
import store from './state/store';
1018
import { PageNames } from './constants';
1119

@@ -71,14 +79,42 @@ class LearnModule extends KolibriModule {
7179
path: '/:channel_id/recommended',
7280
handler: (toRoute, fromRoute) => {
7381
const cursor = toRoute.query.cursor;
74-
actions.showLearnChannel(store, toRoute.params.channel_id, cursor);
82+
showLearnChannel(store, toRoute.params.channel_id, cursor);
83+
},
84+
},
85+
{
86+
name: PageNames.RECOMMENDED_POPULAR,
87+
path: '/:channel_id/recommended/popular',
88+
handler: (toRoute, fromRoute) => {
89+
showPopularPage(store, toRoute.params.channel_id);
90+
},
91+
},
92+
{
93+
name: PageNames.RECOMMENDED_RESUME,
94+
path: '/:channel_id/recommended/resume',
95+
handler: (toRoute, fromRoute) => {
96+
showResumePage(store, toRoute.params.channel_id);
97+
},
98+
},
99+
{
100+
name: PageNames.RECOMMENDED_NEXT_STEPS,
101+
path: '/:channel_id/recommended/nextsteps',
102+
handler: (toRoute, fromRoute) => {
103+
showNextStepsPage(store, toRoute.params.channel_id);
104+
},
105+
},
106+
{
107+
name: PageNames.RECOMMENDED_FEATURED,
108+
path: '/:channel_id/recommended/featured',
109+
handler: (toRoute, fromRoute) => {
110+
showFeaturedPage(store, toRoute.params.channel_id);
75111
},
76112
},
77113
{
78114
name: PageNames.LEARN_CONTENT,
79115
path: '/:channel_id/recommended/:id',
80116
handler: (toRoute, fromRoute) => {
81-
actions.showLearnContent(store, toRoute.params.channel_id, toRoute.params.id);
117+
showLearnContent(store, toRoute.params.channel_id, toRoute.params.id);
82118
},
83119
},
84120
{

kolibri/plugins/learn/assets/src/constants.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ const PageNames = {
66
EXPLORE_CONTENT: 'EXPLORE_CONTENT',
77
LEARN_ROOT: 'LEARN_ROOT',
88
LEARN_CHANNEL: 'LEARN_CHANNEL',
9+
RECOMMENDED_POPULAR: 'RECOMMENDED_POPULAR',
10+
RECOMMENDED_RESUME: 'RECOMMENDED_RESUME',
11+
RECOMMENDED_NEXT_STEPS: 'RECOMMENDED_NEXT_STEPS',
12+
RECOMMENDED_FEATURED: 'RECOMMENDED_FEATURED',
913
LEARN_CONTENT: 'LEARN_CONTENT',
1014
CONTENT_UNAVAILABLE: 'CONTENT_UNAVAILABLE',
1115
SEARCH_ROOT: 'SEARCH_ROOT',
@@ -23,4 +27,11 @@ const PageModes = {
2327
EXAM: 'EXAM',
2428
};
2529

26-
export { PageNames, PageModes };
30+
const RecommendedPages = [
31+
PageNames.RECOMMENDED_POPULAR,
32+
PageNames.RECOMMENDED_RESUME,
33+
PageNames.RECOMMENDED_NEXT_STEPS,
34+
PageNames.RECOMMENDED_FEATURED,
35+
];
36+
37+
export { PageNames, PageModes, RecommendedPages };

0 commit comments

Comments
 (0)