Skip to content

Commit

Permalink
Added a reading lists navigation link [#950]
Browse files Browse the repository at this point in the history
  • Loading branch information
mcpierce committed Sep 24, 2021
1 parent 8a734e1 commit 33ce148
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
Expand Up @@ -157,6 +157,18 @@ <h4 class="section-title" *ngIf="!!user">
{{ "navigation.heading.reading-lists" | translate }}
</h4>

<button
mat-button
class="menu-button"
routerLink="/lists/reading/all"
routerLinkActive="active"
>
<mat-icon>library_add</mat-icon>
<span>
{{ "navigation.heading.reading-lists" | translate }}
</span>
</button>

<button
mat-button
*ngFor="let list of readingLists"
Expand Down
8 changes: 4 additions & 4 deletions comixed-webui/src/app/lists/lists.routing.ts
Expand Up @@ -29,13 +29,13 @@ const routes: Routes = [
canActivate: [ReaderGuard]
},
{
path: 'lists/reading/:id',
component: ReadingListPageComponent,
path: 'lists/reading/all',
component: ReadingListsPageComponent,
canActivate: [ReaderGuard]
},
{
path: 'lists/reading',
component: ReadingListsPageComponent,
path: 'lists/reading/:id',
component: ReadingListPageComponent,
canActivate: [ReaderGuard]
}
];
Expand Down
Expand Up @@ -186,7 +186,7 @@ describe('ReadingListPageComponent', () => {
});

it('redirects the browser', () => {
expect(router.navigateByUrl).toHaveBeenCalledWith('/lists/reading');
expect(router.navigateByUrl).toHaveBeenCalledWith('/lists/reading/all');
});
});

Expand Down Expand Up @@ -380,7 +380,7 @@ describe('ReadingListPageComponent', () => {

it('redirects the browser when the current list was removed', () => {
readingListRemovalSubscription(READING_LIST);
expect(router.navigateByUrl).toHaveBeenCalledWith('/lists/reading');
expect(router.navigateByUrl).toHaveBeenCalledWith('/lists/reading/all');
});

it('ignores when a different list was removed', () => {
Expand Down
Expand Up @@ -101,7 +101,7 @@ export class ReadingListPageComponent implements OnInit, OnDestroy {
.subscribe(state => {
if (state.notFound) {
this.logger.trace('Reading list not found');
this.router.navigateByUrl('/lists/reading');
this.router.navigateByUrl('/lists/reading/all');
} else {
this.store.dispatch(setBusyState({ enabled: state.loading }));
}
Expand Down Expand Up @@ -150,7 +150,7 @@ export class ReadingListPageComponent implements OnInit, OnDestroy {
this.store.dispatch(readingListRemoved({ list }));
if (list.id === this.readingListId) {
this.logger.trace('This reading list was removed');
this.router.navigateByUrl('/lists/reading');
this.router.navigateByUrl('/lists/reading/all');
}
}
);
Expand Down

0 comments on commit 33ce148

Please sign in to comment.