Skip to content

Commit 465595a

Browse files
committed
MOBILE-4759 chore: Remove basic lazy modules without provide: ROUTES
1 parent 825c376 commit 465595a

31 files changed

+572
-1052
lines changed

src/addons/badges/badges-lazy.module.ts

Lines changed: 0 additions & 58 deletions
This file was deleted.

src/addons/badges/badges.module.ts

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import { CorePushNotificationsDelegate } from '@features/pushnotifications/servi
2626
import { AddonBadgesPushClickHandler } from './services/handlers/push-click';
2727
import { CoreTagAreaDelegate } from '@features/tag/services/tag-area-delegate';
2828
import { AddonBadgesTagAreaHandler } from './services/handlers/tag-area';
29+
import { conditionalRoutes } from '@/app/app-routing.module';
30+
import { CoreScreen } from '@services/screen';
2931

3032
/**
3133
* Get badges services.
@@ -40,6 +42,38 @@ export async function getBadgesServices(): Promise<Type<unknown>[]> {
4042
];
4143
}
4244

45+
const mobileRoutes: Routes = [
46+
{
47+
path: '',
48+
pathMatch: 'full',
49+
loadComponent: () => import('./pages/user-badges/user-badges'),
50+
},
51+
{
52+
path: ':badgeHash',
53+
loadComponent: () => import('./pages/issued-badge/issued-badge'),
54+
data: { usesSwipeNavigation: true },
55+
},
56+
];
57+
58+
const tabletRoutes: Routes = [
59+
{
60+
path: '',
61+
loadComponent: () => import('./pages/user-badges/user-badges'),
62+
children: [
63+
{
64+
path: ':badgeHash',
65+
loadComponent: () => import('./pages/issued-badge/issued-badge'),
66+
data: { usesSwipeNavigation: true },
67+
},
68+
],
69+
},
70+
];
71+
72+
const routes: Routes = [
73+
...conditionalRoutes(mobileRoutes, () => CoreScreen.isMobile),
74+
...conditionalRoutes(tabletRoutes, () => CoreScreen.isTablet),
75+
];
76+
4377
const mainMenuRoutes: Routes = [
4478
{
4579
path: 'badge/:badgeHash',
@@ -48,7 +82,7 @@ const mainMenuRoutes: Routes = [
4882
},
4983
{
5084
path: 'badges',
51-
loadChildren: () => import('./badges-lazy.module'),
85+
children: routes,
5286
},
5387
{
5488
path: 'badgeclass/:badgeId',

src/addons/competency/competency-course-details-lazy.module.ts

Lines changed: 0 additions & 60 deletions
This file was deleted.

src/addons/competency/competency-learning-plans-lazy.module.ts

Lines changed: 0 additions & 75 deletions
This file was deleted.

src/addons/competency/competency.module.ts

Lines changed: 105 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@ import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-ro
2929
import { CoreCourseIndexRoutingModule } from '@features/course/course-routing.module';
3030
import { PARTICIPANTS_PAGE_NAME } from '@features/user/constants';
3131
import { CORE_COURSE_PAGE_NAME } from '@features/course/constants';
32-
import { ADDON_COMPETENCY_LEARNING_PLANS_PAGE, ADDON_COMPETENCY_COMPETENCIES_PAGE } from './constants';
32+
import {
33+
ADDON_COMPETENCY_LEARNING_PLANS_PAGE,
34+
ADDON_COMPETENCY_COMPETENCIES_PAGE,
35+
ADDON_COMPETENCY_SUMMARY_PAGE,
36+
} from './constants';
37+
import { conditionalRoutes } from '@/app/app-routing.module';
38+
import { CoreScreen } from '@services/screen';
3339

3440
/**
3541
* Get competency services.
@@ -46,18 +52,113 @@ export async function getCompetencyServices(): Promise<Type<unknown>[]> {
4652
];
4753
}
4854

55+
/**
56+
* Routes for competency learning plans.
57+
*
58+
* @returns Routes.
59+
*/
60+
function getCompetencyLearningPlansRoutes(): Routes {
61+
const mobileRoutes: Routes = [
62+
{
63+
path: '',
64+
pathMatch: 'full',
65+
loadComponent: () => import('./pages/planlist/planlist'),
66+
},
67+
{
68+
path: `:planId/${ADDON_COMPETENCY_COMPETENCIES_PAGE}`,
69+
loadComponent: () => import('./pages/plan/plan'),
70+
},
71+
{
72+
path: `:planId/${ADDON_COMPETENCY_COMPETENCIES_PAGE}/:competencyId`,
73+
loadComponent: () => import('./pages/competency/competency'),
74+
},
75+
];
76+
77+
const tabletRoutes: Routes = [
78+
{
79+
path: '',
80+
loadComponent: () => import('./pages/planlist/planlist'),
81+
children: [
82+
{
83+
path: `:planId/${ADDON_COMPETENCY_COMPETENCIES_PAGE}`,
84+
loadComponent: () => import('./pages/plan/plan'),
85+
},
86+
],
87+
},
88+
{
89+
path: `:planId/${ADDON_COMPETENCY_COMPETENCIES_PAGE}`,
90+
loadComponent: () => import('./pages/competencies/competencies'),
91+
children: [
92+
{
93+
path: ':competencyId',
94+
loadComponent: () => import('./pages/competency/competency'),
95+
},
96+
],
97+
},
98+
];
99+
100+
return [
101+
...conditionalRoutes(mobileRoutes, () => CoreScreen.isMobile),
102+
...conditionalRoutes(tabletRoutes, () => CoreScreen.isTablet),
103+
{
104+
path: `:planId/${ADDON_COMPETENCY_COMPETENCIES_PAGE}/:competencyId/${ADDON_COMPETENCY_SUMMARY_PAGE}`,
105+
loadComponent: () => import('./pages/competencysummary/competencysummary'),
106+
},
107+
];
108+
}
109+
110+
/**
111+
* Routes for competency course details.
112+
*
113+
* @returns Routes.
114+
*/
115+
function getCompetencyCourseDetailsRoutes(): Routes {
116+
const mobileRoutes: Routes = [
117+
{
118+
path: '',
119+
loadComponent: () => import('./pages/coursecompetencies/coursecompetencies'),
120+
},
121+
{
122+
path: ':competencyId',
123+
loadComponent: () => import('./pages/competency/competency'),
124+
},
125+
];
126+
127+
const tabletRoutes: Routes = [
128+
{
129+
path: '',
130+
loadComponent: () => import('./pages/competencies/competencies'),
131+
children: [
132+
{
133+
path: ':competencyId',
134+
loadComponent: () => import('./pages/competency/competency'),
135+
},
136+
],
137+
},
138+
];
139+
140+
return [
141+
...conditionalRoutes(mobileRoutes, () => CoreScreen.isMobile),
142+
...conditionalRoutes(tabletRoutes, () => CoreScreen.isTablet),
143+
{
144+
path: `:competencyId/${ADDON_COMPETENCY_SUMMARY_PAGE}`,
145+
loadComponent: () => import('./pages/competencysummary/competencysummary'),
146+
},
147+
];
148+
}
149+
49150
const mainMenuChildrenRoutes: Routes = [
50151
{
51152
path: ADDON_COMPETENCY_LEARNING_PLANS_PAGE,
52-
loadChildren: () => import('./competency-learning-plans-lazy.module'),
153+
children: getCompetencyLearningPlansRoutes(),
53154
},
54155
{
55156
path: `${CORE_COURSE_PAGE_NAME}/:courseId/${ADDON_COMPETENCY_COMPETENCIES_PAGE}`,
56-
loadChildren: () => import('./competency-course-details-lazy.module'),
157+
children: getCompetencyCourseDetailsRoutes(),
57158
},
58159
{
59160
path: `${CORE_COURSE_PAGE_NAME}/:courseId/${PARTICIPANTS_PAGE_NAME}/:userId/${ADDON_COMPETENCY_COMPETENCIES_PAGE}`,
60-
loadChildren: () => import('./competency-course-details-lazy.module'),
161+
children: getCompetencyCourseDetailsRoutes(),
61162
},
62163
];
63164

0 commit comments

Comments
 (0)