diff --git a/projects/aca-shared/store/src/actions/library.actions.ts b/projects/aca-shared/store/src/actions/library.actions.ts index 9843d4a7d..dcd03c509 100644 --- a/projects/aca-shared/store/src/actions/library.actions.ts +++ b/projects/aca-shared/store/src/actions/library.actions.ts @@ -47,7 +47,7 @@ export class CreateLibraryAction implements Action { export class NavigateLibraryAction implements Action { readonly type = LibraryActionTypes.Navigate; - constructor(public payload?: string) {} + constructor(public payload?: string, public route?: string) {} } export class UpdateLibraryAction implements Action { diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index d884b8063..9bde412f4 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -212,10 +212,15 @@ export const APP_ROUTES: Routes = [ ] }, { - path: 'favorite/libraries', + path: 'favorite', children: [ { path: '', + pathMatch: 'full', + redirectTo: 'libraries' + }, + { + path: 'libraries', component: FavoriteLibrariesComponent, data: { title: 'APP.BROWSE.LIBRARIES.MENU.FAVORITE_LIBRARIES.TITLE', @@ -224,6 +229,33 @@ export const APP_ROUTES: Routes = [ } ] }, + { + path: 'favorite/libraries/:folderId', + children: [ + { + path: '', + component: FilesComponent, + data: { + title: 'APP.BROWSE.LIBRARIES.MENU.FAVORITE_LIBRARIES.TITLE', + sortingPreferenceKey: 'libraries-files' + } + }, + { + path: 'view/:nodeId', + outlet: 'viewer', + children: [ + { + path: '', + data: { + navigateSource: 'libraries' + }, + loadChildren: + './components/viewer/viewer.module#AppViewerModule' + } + ] + } + ] + }, { path: 'favorites', data: { diff --git a/src/app/components/favorite-libraries/favorite-libraries.component.spec.ts b/src/app/components/favorite-libraries/favorite-libraries.component.spec.ts index e31d4ac5d..e6a35c3c7 100644 --- a/src/app/components/favorite-libraries/favorite-libraries.component.spec.ts +++ b/src/app/components/favorite-libraries/favorite-libraries.component.spec.ts @@ -144,7 +144,10 @@ describe('FavoriteLibrariesComponent', () => { spyOn(router, 'navigate').and.stub(); component.navigateTo({ entry: { guid: 'guid' } } as any); - expect(router.navigate).toHaveBeenCalledWith(['libraries', 'libraryId']); + expect(router.navigate).toHaveBeenCalledWith([ + 'favorite/libraries', + 'libraryId' + ]); }); }); diff --git a/src/app/components/favorite-libraries/favorite-libraries.component.ts b/src/app/components/favorite-libraries/favorite-libraries.component.ts index d95181657..fd8d615dd 100644 --- a/src/app/components/favorite-libraries/favorite-libraries.component.ts +++ b/src/app/components/favorite-libraries/favorite-libraries.component.ts @@ -82,7 +82,9 @@ export class FavoriteLibrariesComponent extends PageComponent navigateTo(node: SiteEntry) { if (node && node.entry && node.entry.guid) { - this.store.dispatch(new NavigateLibraryAction(node.entry.guid)); + this.store.dispatch( + new NavigateLibraryAction(node.entry.guid, 'favorite/libraries') + ); } } diff --git a/src/app/store/effects/library.effects.ts b/src/app/store/effects/library.effects.ts index 22c17dd8d..0a0217b71 100644 --- a/src/app/store/effects/library.effects.ts +++ b/src/app/store/effects/library.effects.ts @@ -107,7 +107,8 @@ export class LibraryEffects { .pipe(map(node => node.entry.id)) .subscribe( id => { - this.store.dispatch(new NavigateRouteAction(['libraries', id])); + const route = action.route ? action.route : 'libraries'; + this.store.dispatch(new NavigateRouteAction([route, id])); }, () => { this.store.dispatch(