Skip to content

Commit 3b242a6

Browse files
committed
Changed the sidebar to use badges for counts [#2581]
1 parent 697313d commit 3b242a6

File tree

3 files changed

+44
-21
lines changed

3 files changed

+44
-21
lines changed

comixed-webui/src/app/components/side-navigation/side-navigation.component.html

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@ <h4 class="section-title">
2727
routerLinkActive="active-nav-button"
2828
>
2929
<mat-icon>local_library</mat-icon>
30-
<mat-label class="cx-text-nowrap">
30+
<mat-label
31+
class="cx-text-nowrap"
32+
[matBadge]="totalComicBooks$ | async | number"
33+
matBadgePosition="after"
34+
>
3135
<span class="cx-align-left">
3236
{{ "navigation.option.all-comics" | translate }}
3337
</span>
34-
<span class="cx-align-right">
35-
({{ totalComicBooks$ | async | number }})
36-
</span>
3738
</mat-label>
3839
</button>
3940
}
@@ -45,13 +46,14 @@ <h4 class="section-title">
4546
routerLinkActive="active-nav-button"
4647
>
4748
<mat-icon>check_circle</mat-icon>
48-
<mat-label class="cx-text-nowrap">
49+
<mat-label
50+
class="cx-text-nowrap"
51+
[matBadge]="selectedComicBooks$ | async | number"
52+
matBadgePosition="after"
53+
>
4954
<span class="cx-align-left">
5055
{{ "navigation.option.selected-comics" | translate }}
5156
</span>
52-
<span class="cx-align-right">
53-
({{ selectedComicBooks$ | async | number }})
54-
</span>
5557
</mat-label>
5658
</button>
5759
}
@@ -64,9 +66,12 @@ <h4 class="section-title">
6466
routerLinkActive="active-nav-button"
6567
>
6668
<mat-icon>incomplete_circle</mat-icon>
67-
<mat-label class="cx-text-nowrap">
69+
<mat-label
70+
class="cx-text-nowrap"
71+
[matBadge]="unprocessedComicBooks$ | async | number"
72+
matBadgePosition="after"
73+
>
6874
{{ "navigation.option.unprocessed-comics" | translate }}
69-
({{ unprocessedComicBooks$ | async | number }})
7075
</mat-label>
7176
</button>
7277
}
@@ -78,9 +83,12 @@ <h4 class="section-title">
7883
routerLinkActive="active-nav-button"
7984
>
8085
<mat-icon>read_more</mat-icon>
81-
<mat-label class="cx-text-nowrap">
86+
<mat-label
87+
class="cx-text-nowrap"
88+
[matBadge]="readComicBooks$ | async | number"
89+
matBadgePosition="after"
90+
>
8291
{{ "navigation.option.read-comics" | translate }}
83-
({{ readComicBooks$ | async | number }})
8492
</mat-label>
8593
</button>
8694
}
@@ -92,9 +100,12 @@ <h4 class="section-title">
92100
routerLinkActive="active-nav-button"
93101
>
94102
<mat-icon>cloud_download</mat-icon>
95-
<mat-label class="cx-text-nowrap">
103+
<mat-label
104+
class="cx-text-nowrap"
105+
[matBadge]="unscrapedComicBooks$ | async | number"
106+
matBadgePosition="after"
107+
>
96108
{{ "navigation.option.unscraped-comics" | translate }}
97-
({{ unscrapedComicBooks$ | async | number }})
98109
</mat-label>
99110
</button>
100111
}
@@ -106,9 +117,12 @@ <h4 class="section-title">
106117
routerLinkActive="active-nav-button"
107118
>
108119
<mat-icon>cloud_download</mat-icon>
109-
<mat-label class="cx-text-nowrap">
120+
<mat-label
121+
class="cx-text-nowrap"
122+
[matBadge]="changedComicBooks$ | async | number"
123+
matBadgePosition="after"
124+
>
110125
{{ "navigation.option.changed-comics" | translate }}
111-
({{ changedComicBooks$ | async | number }})
112126
</mat-label>
113127
</button>
114128
}
@@ -120,9 +134,12 @@ <h4 class="section-title">
120134
routerLinkActive="active-nav-button"
121135
>
122136
<mat-icon>delete_sweep</mat-icon>
123-
<mat-label class="cx-text-nowrap">
137+
<mat-label
138+
class="cx-text-nowrap"
139+
[matBadge]="deletedComicBooks$ | async | number"
140+
matBadgePosition="after"
141+
>
124142
{{ "navigation.option.deleted-comics" | translate }}
125-
({{ deletedComicBooks$ | async | number }})
126143
</mat-label>
127144
</button>
128145
}
@@ -134,9 +151,12 @@ <h4 class="section-title">
134151
routerLinkActive="active-nav-button"
135152
>
136153
<mat-icon>dynamic_feed</mat-icon>
137-
<mat-label class="cx-text-nowrap">
154+
<mat-label
155+
class="cx-text-nowrap"
156+
[matBadge]="duplicateComicBooks$ | async | number"
157+
matBadgePosition="after"
158+
>
138159
{{ "navigation.option.duplicate-comics" | translate }}
139-
({{ duplicateComicBooks$ | async | number }})
140160
</mat-label>
141161
</button>
142162
}

comixed-webui/src/app/components/side-navigation/side-navigation.component.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
mat-label {
2626
display: block !important;
2727
width: 100% !important;
28+
padding-right: 10px;
2829
}
2930
}
3031

comixed-webui/src/app/components/side-navigation/side-navigation.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import { MatLabel } from '@angular/material/form-field';
4040
import { MatDivider } from '@angular/material/divider';
4141
import { AsyncPipe, DecimalPipe } from '@angular/common';
4242
import { TranslateModule } from '@ngx-translate/core';
43+
import { MatBadge } from '@angular/material/badge';
4344

4445
@Component({
4546
selector: 'cx-side-navigation',
@@ -54,7 +55,8 @@ import { TranslateModule } from '@ngx-translate/core';
5455
MatDivider,
5556
AsyncPipe,
5657
DecimalPipe,
57-
TranslateModule
58+
TranslateModule,
59+
MatBadge
5860
]
5961
})
6062
export class SideNavigationComponent implements OnDestroy {

0 commit comments

Comments
 (0)