diff --git a/src/core/features/user/pages/participants/participants.page.ts b/src/core/features/user/pages/participants/participants.page.ts index b1508eb2b..82a9f22f0 100644 --- a/src/core/features/user/pages/participants/participants.page.ts +++ b/src/core/features/user/pages/participants/participants.page.ts @@ -19,7 +19,6 @@ import { CoreApp } from '@services/app'; import { CoreDomUtils } from '@services/utils/dom'; import { CoreNavigator } from '@services/navigator'; import { CorePageItemsListManager } from '@classes/page-items-list-manager'; -import { CoreScreen } from '@services/screen'; import { CoreSplitViewComponent } from '@components/split-view/split-view'; import { CoreUser, CoreUserProvider, CoreUserParticipant, CoreUserData } from '@features/user/services/user'; import { CoreUtils } from '@services/utils/utils'; @@ -213,22 +212,6 @@ class CoreUserParticipantsManager extends CorePageItemsListManager { - if (CoreScreen.isMobile) { - await CoreNavigator.navigateToSitePath( - '/user/profile', - { params: { userId: participant.id, courseId: this.courseId } }, - ); - - return; - } - - return super.select(participant); - } - /** * @inheritdoc */ diff --git a/src/core/features/user/services/handlers/course-option.ts b/src/core/features/user/services/handlers/course-option.ts index 9be660d77..8d0484c9e 100644 --- a/src/core/features/user/services/handlers/course-option.ts +++ b/src/core/features/user/services/handlers/course-option.ts @@ -21,6 +21,7 @@ import { } from '@features/course/services/course-options-delegate'; import { CoreCourseUserAdminOrNavOptionIndexed } from '@features/courses/services/courses'; import { CoreEnrolledCourseDataWithExtraInfoAndOptions } from '@features/courses/services/courses-helper'; +import { PARTICIPANTS_PAGE_NAME } from '@features/user/user.module'; import { makeSingleton } from '@singletons'; import { CoreUser } from '../user'; @@ -89,7 +90,7 @@ export class CoreUserCourseOptionHandlerService implements CoreCourseOptionsHand return { title: 'core.user.participants', class: 'core-user-participants-handler', - page: 'participants', + page: PARTICIPANTS_PAGE_NAME, }; } diff --git a/src/core/features/user/user-course-lazy.module.ts b/src/core/features/user/user-course-lazy.module.ts index e08c9408f..9992c1ff1 100644 --- a/src/core/features/user/user-course-lazy.module.ts +++ b/src/core/features/user/user-course-lazy.module.ts @@ -19,17 +19,19 @@ import { CoreSharedModule } from '@/core/shared.module'; import { CoreSearchComponentsModule } from '@features/search/components/components.module'; import { CoreUserParticipantsPage } from './pages/participants/participants.page'; +import { conditionalRoutes } from '@/app/app-routing.module'; +import { CoreScreen } from '@services/screen'; const routes: Routes = [ { path: '', component: CoreUserParticipantsPage, - children: [ + children: conditionalRoutes([ { path: ':userId', loadChildren: () => import('@features/user/pages/profile/profile.module').then(m => m.CoreUserProfilePageModule), }, - ], + ], () => CoreScreen.isTablet), }, ]; diff --git a/src/core/features/user/user.module.ts b/src/core/features/user/user.module.ts index 75901a66e..ff8bb99ad 100644 --- a/src/core/features/user/user.module.ts +++ b/src/core/features/user/user.module.ts @@ -35,6 +35,10 @@ import { CoreUserProvider } from './services/user'; import { CoreUserHelperProvider } from './services/user-helper'; import { CoreUserOfflineProvider } from './services/user-offline'; import { CoreUserSyncProvider } from './services/user-sync'; +import { conditionalRoutes } from '@/app/app-routing.module'; +import { CoreScreen } from '@services/screen'; +import { COURSE_PAGE_NAME } from '@features/course/course.module'; +import { COURSE_INDEX_PATH } from '@features/course/course-lazy.module'; export const CORE_USER_SERVICES: Type[] = [ CoreUserDelegateService, @@ -45,16 +49,24 @@ export const CORE_USER_SERVICES: Type[] = [ CoreUserSyncProvider, ]; +export const PARTICIPANTS_PAGE_NAME = 'participants'; + const routes: Routes = [ { path: 'user', loadChildren: () => import('@features/user/user-lazy.module').then(m => m.CoreUserLazyModule), }, + ...conditionalRoutes([ + { + path: `${COURSE_PAGE_NAME}/${COURSE_INDEX_PATH}/${PARTICIPANTS_PAGE_NAME}/:userId`, + loadChildren: () => import('@features/user/pages/profile/profile.module').then(m => m.CoreUserProfilePageModule), + }, + ], () => CoreScreen.isMobile), ]; const courseIndexRoutes: Routes = [ { - path: 'participants', + path: PARTICIPANTS_PAGE_NAME, loadChildren: () => import('@features/user/user-course-lazy.module').then(m => m.CoreUserCourseLazyModule), }, ];