Skip to content

Commit

Permalink
Added an unprocessed comics view [#530]
Browse files Browse the repository at this point in the history
 * Changed admin-only items to only be visible to admins.
  • Loading branch information
mcpierce committed Oct 25, 2021
1 parent d990a79 commit 1722fdc
Show file tree
Hide file tree
Showing 14 changed files with 67 additions and 10 deletions.
Expand Up @@ -14,6 +14,18 @@ <h4 class="section-title" *ngIf="!!user">
<span>{{ "navigation.option.all-comics" | translate }}</span>
</button>

<button
*ngIf="isAdmin"
mat-button
class="menu-button"
routerLink="/library/unprocessed"
[queryParams]="queryParams"
routerLinkActive="active"
>
<mat-icon>incomplete_circle</mat-icon>
<span>{{ "navigation.option.unprocessed-comics" | translate }}</span>
</button>

<button
*ngIf="!!user"
mat-button
Expand All @@ -27,7 +39,7 @@ <h4 class="section-title" *ngIf="!!user">
</button>

<button
*ngIf="!!user"
*ngIf="isAdmin"
mat-button
class="menu-button"
routerLink="/library/unscraped"
Expand All @@ -39,7 +51,7 @@ <h4 class="section-title" *ngIf="!!user">
</button>

<button
*ngIf="!!user"
*ngIf="isAdmin"
mat-button
class="menu-button"
routerLink="/library/import"
Expand All @@ -51,7 +63,7 @@ <h4 class="section-title" *ngIf="!!user">
</button>

<button
*ngIf="!!user"
*ngIf="isAdmin"
mat-button
class="menu-button"
routerLink="/library/deleted"
Expand All @@ -63,7 +75,7 @@ <h4 class="section-title" *ngIf="!!user">
</button>

<button
*ngIf="!!user"
*ngIf="isAdmin"
mat-button
class="menu-button"
routerLink="/library/pages/duplicates"
Expand All @@ -75,7 +87,7 @@ <h4 class="section-title" *ngIf="!!user">
</button>

<button
*ngIf="!!user"
*ngIf="isAdmin"
mat-button
class="menu-button"
routerLink="/library/pages/blocked"
Expand Down Expand Up @@ -207,6 +219,8 @@ <h4 class="section-title" *ngIf="!!user">
<span class="cx-text-nowrap">{{ list.name }}</span>
</button>

<mat-divider *ngIf="!!user"></mat-divider>

<h4 class="section-title" *ngIf="!!user">
{{ "navigation.heading.account" | translate }}
</h4>
Expand All @@ -223,7 +237,7 @@ <h4 class="section-title" *ngIf="!!user">
<span>{{ "navigation.option.user-preferences" | translate }}</span>
</button>

<mat-divider *ngIf="!!user"></mat-divider>
<mat-divider *ngIf="isAdmin"></mat-divider>

<h4 class="section-title" *ngIf="isAdmin">
{{ "navigation.heading.admin" | translate }}
Expand Down
10 changes: 8 additions & 2 deletions comixed-webui/src/app/library/library.routing.ts
Expand Up @@ -30,6 +30,12 @@ const routes: Routes = [
component: LibraryPageComponent,
canActivate: [ReaderGuard]
},
{
path: 'library/unprocessed',
component: LibraryPageComponent,
canActivate: [AdminGuard],
data: { unprocessed: true }
},
{
path: 'library/unread',
component: LibraryPageComponent,
Expand All @@ -39,13 +45,13 @@ const routes: Routes = [
{
path: 'library/unscraped',
component: LibraryPageComponent,
canActivate: [ReaderGuard],
canActivate: [AdminGuard],
data: { unscraped: true }
},
{
path: 'library/deleted',
component: LibraryPageComponent,
canActivate: [ReaderGuard],
canActivate: [AdminGuard],
data: { deleted: true }
},
{
Expand Down
Expand Up @@ -157,12 +157,23 @@ describe('LibraryPageComponent', () => {

describe('loading page data', () => {
beforeEach(() => {
component.unprocessedOnly = false;
component.unreadOnly = false;
component.unscrapedOnly = false;
component.deletedOnly = false;
component.unscrapedOnly = false;
});

describe('when showing unprocessed comics', () => {
beforeEach(() => {
(activatedRoute.data as BehaviorSubject<{}>).next({ unprocessed: true });
});

it('sets the unread only flag', () => {
expect(component.unprocessedOnly).toBeTrue();
});
});

describe('when showing unread comics', () => {
beforeEach(() => {
(activatedRoute.data as BehaviorSubject<{}>).next({ unread: true });
Expand Down Expand Up @@ -206,6 +217,7 @@ describe('LibraryPageComponent', () => {

describe('when the language changes', () => {
beforeEach(() => {
component.unprocessedOnly = false;
component.unreadOnly = false;
component.unscrapedOnly = false;
component.deletedOnly = false;
Expand All @@ -216,6 +228,12 @@ describe('LibraryPageComponent', () => {
expect(titleService.setTitle).toHaveBeenCalledWith(jasmine.any(String));
});

it('updates the page title for unprocessed comic', () => {
component.unreadOnly = true;
translateService.use('fr');
expect(titleService.setTitle).toHaveBeenCalledWith(jasmine.any(String));
});

it('updates the page title for unread comic', () => {
component.unreadOnly = true;
translateService.use('fr');
Expand Down
Expand Up @@ -58,6 +58,7 @@ export class LibraryPageComponent implements OnInit, OnDestroy {
unreadOnly = false;
unscrapedOnly = false;
deletedOnly = false;
unprocessedOnly = false;
queryParamSubscription: Subscription;
archiveTypeFilter = null;
lastReadDatesSubscription: Subscription;
Expand All @@ -77,6 +78,7 @@ export class LibraryPageComponent implements OnInit, OnDestroy {
this.unreadOnly = !!data.unread && data.unread === true;
this.unscrapedOnly = !!data.unscraped && data.unscraped === true;
this.deletedOnly = !!data.deleted && data.deleted === true;
this.unprocessedOnly = !!data.unprocessed && data.unprocessed === true;
this.showConsolidate =
!this.unreadOnly && !this.unscrapedOnly && !this.deletedOnly;
});
Expand Down Expand Up @@ -139,7 +141,8 @@ export class LibraryPageComponent implements OnInit, OnDestroy {
this._comics = comics.filter(
comic =>
(!this.unscrapedOnly || !comic.comicVineId) &&
(!this.deletedOnly || !!comic.deletedDate)
(!this.deletedOnly || !!comic.deletedDate) &&
(!this.unprocessedOnly || !comic.fileDetails)
);
}

Expand Down Expand Up @@ -169,7 +172,13 @@ export class LibraryPageComponent implements OnInit, OnDestroy {

private loadTranslations(): void {
this.logger.trace('Setting page title');
if (this.deletedOnly) {
if (this.unprocessedOnly) {
this.titleService.setTitle(
this.translateService.instant(
'library.all-comics.tab-title-unprocessed'
)
);
} else if (this.deletedOnly) {
this.titleService.setTitle(
this.translateService.instant('library.all-comics.tab-title-deleted')
);
Expand Down
1 change: 1 addition & 0 deletions comixed-webui/src/assets/i18n/de/app.json
Expand Up @@ -119,6 +119,7 @@
"story-collection": "Stories",
"story-names": "Stories",
"team-collection": "Teams",
"unprocessed-comics": "Unprocessed Imports",
"unread-comics": "Unread Comics",
"unscraped-comics": "Unscraped Comics",
"user-preferences": "Preferences",
Expand Down
1 change: 1 addition & 0 deletions comixed-webui/src/assets/i18n/de/library.json
Expand Up @@ -50,6 +50,7 @@
"all-comics": {
"tab-title": "All Comics",
"tab-title-deleted": "Deleted Comics",
"tab-title-unprocessed": "Unprocessed Comics",
"tab-title-unread": "Unread Comics",
"tab-title-unscraped": "Unscraped Comics"
},
Expand Down
1 change: 1 addition & 0 deletions comixed-webui/src/assets/i18n/en/app.json
Expand Up @@ -119,6 +119,7 @@
"story-collection": "Stories",
"story-names": "Stories",
"team-collection": "Teams",
"unprocessed-comics": "Unprocessed Imports",
"unread-comics": "Unread Comics",
"unscraped-comics": "Unscraped Comics",
"user-preferences": "Preferences",
Expand Down
1 change: 1 addition & 0 deletions comixed-webui/src/assets/i18n/en/library.json
Expand Up @@ -51,6 +51,7 @@
"tab-title": "All Comics",
"tab-title-deleted": "Deleted Comics",
"tab-title-unread": "Unread Comics",
"tab-title-unprocessed": "Unprocessed Comics",
"tab-title-unscraped": "Unscraped Comics"
},
"comic-group": {
Expand Down
1 change: 1 addition & 0 deletions comixed-webui/src/assets/i18n/es/app.json
Expand Up @@ -119,6 +119,7 @@
"story-collection": "Historias",
"story-names": "Stories",
"team-collection": "Equipos",
"unprocessed-comics": "Unprocessed Imports",
"unread-comics": "Cómics no leídos",
"unscraped-comics": "Unscraped Comics",
"user-preferences": "Preferencias",
Expand Down
1 change: 1 addition & 0 deletions comixed-webui/src/assets/i18n/es/library.json
Expand Up @@ -50,6 +50,7 @@
"all-comics": {
"tab-title": "Todos los cómics",
"tab-title-deleted": "Cómics eliminados",
"tab-title-unprocessed": "Unprocessed Comics",
"tab-title-unread": "Cómics no leídos",
"tab-title-unscraped": "Unscraped Comics"
},
Expand Down
1 change: 1 addition & 0 deletions comixed-webui/src/assets/i18n/fr/app.json
Expand Up @@ -134,6 +134,7 @@
"series-collection": "Séries",
"story-collection": "Histoires",
"team-collection": "Équipes",
"unprocessed-comics": "Unprocessed Imports",
"unread-comics": "Bandes Dessinées non lues",
"unscraped-comics": "Bandes Dessinées sans détails récupérés",
"user-preferences": "Préférences",
Expand Down
1 change: 1 addition & 0 deletions comixed-webui/src/assets/i18n/fr/library.json
Expand Up @@ -50,6 +50,7 @@
"all-comics": {
"tab-title": "Toutes les Bandes Dessinées",
"tab-title-deleted": "Bandes dessinées supprimées",
"tab-title-unprocessed": "Unprocessed Comics",
"tab-title-unread": "Bandes dessinées non lues",
"tab-title-unscraped": "Unscraped Comics"
},
Expand Down
1 change: 1 addition & 0 deletions comixed-webui/src/assets/i18n/pt/app.json
Expand Up @@ -119,6 +119,7 @@
"story-collection": "Stories",
"story-names": "Stories",
"team-collection": "Teams",
"unprocessed-comics": "Unprocessed Imports",
"unread-comics": "Unread Comics",
"unscraped-comics": "Unscraped Comics",
"user-preferences": "Preferences",
Expand Down
1 change: 1 addition & 0 deletions comixed-webui/src/assets/i18n/pt/library.json
Expand Up @@ -50,6 +50,7 @@
"all-comics": {
"tab-title": "All Comics",
"tab-title-deleted": "Deleted Comics",
"tab-title-unprocessed": "Unprocessed Comics",
"tab-title-unread": "Unread Comics",
"tab-title-unscraped": "Unscraped Comics"
},
Expand Down

0 comments on commit 1722fdc

Please sign in to comment.