Skip to content

Commit 3a44f2c

Browse files
committed
refactor: strictTemplates: true
1 parent d69e015 commit 3a44f2c

File tree

98 files changed

+527
-429
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+527
-429
lines changed

src/app/account/account.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
@if (item.count !== undefined) {
2727
<span
2828
class="badge rounded-pill float-end"
29-
[class.text-bg-secondary]="item.newCount <= 0"
30-
[class.text-bg-danger]="item.newCount > 0"
29+
[class.text-bg-secondary]="(item.newCount || 0) <= 0"
30+
[class.text-bg-danger]="(item.newCount || 0) > 0"
3131
>
3232
@if (item.count <= 0) {
3333
<span i18n="@@count-zero">none</span>

src/app/account/contacts/contacts.component.html

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,37 @@ <h1 i18n>Contacts</h1>
33
</div>
44
<div class="row">
55
@for (contact of items$ | async; track contact.contactUserId) {
6-
<div class="col-md-6 mb-2">
7-
<div class="d-flex justify-content-start">
8-
<div class="align-self-start me-3">
9-
@if (!contact.user.deleted) {
10-
<a
11-
[routerLink]="['/users', contact.user.identity ? contact.user.identity : 'user' + contact.user.id]"
12-
class="photo"
13-
>
14-
@if (contact.user.avatar) {
15-
<img alt="" [src]="contact.user.avatar.src" class="rounded" loading="lazy" />
16-
} @else if (contact.user.gravatar) {
17-
<img alt="" [src]="contact.user.gravatar" class="rounded" loading="lazy" />
18-
}
19-
</a>
20-
}
21-
</div>
22-
<div class="flex-grow-1">
23-
<button class="btn-close float-end" (click)="deleteContact(contact.user.id)"></button>
24-
<h4>
25-
<app-user [user]="contact.user"></app-user>
26-
</h4>
27-
@if (contact.user.lastOnline) {
28-
<p
29-
[textContent]="contact.user.lastOnline.toDate() | timeAgo"
30-
[ngbTooltip]="contact.user.lastOnline.toDate() | date: 'medium'"
31-
></p>
32-
}
6+
@if (contact.user) {
7+
<div class="col-md-6 mb-2">
8+
<div class="d-flex justify-content-start">
9+
<div class="align-self-start me-3">
10+
@if (!contact.user.deleted) {
11+
<a
12+
[routerLink]="['/users', contact.user.identity ? contact.user.identity : 'user' + contact.user.id]"
13+
class="photo"
14+
>
15+
@if (contact.user.avatar) {
16+
<img alt="" [src]="contact.user.avatar.src" class="rounded" loading="lazy" />
17+
} @else if (contact.user.gravatar) {
18+
<img alt="" [src]="contact.user.gravatar" class="rounded" loading="lazy" />
19+
}
20+
</a>
21+
}
22+
</div>
23+
<div class="flex-grow-1">
24+
<button class="btn-close float-end" (click)="deleteContact(contact.user.id)"></button>
25+
<h4>
26+
<app-user [user]="contact.user"></app-user>
27+
</h4>
28+
@if (contact.user.lastOnline) {
29+
<p
30+
[textContent]="contact.user.lastOnline.toDate() | timeAgo"
31+
[ngbTooltip]="contact.user.lastOnline.toDate() | date: 'medium'"
32+
></p>
33+
}
34+
</div>
3335
</div>
3436
</div>
35-
</div>
37+
}
3638
}
3739
</div>

src/app/account/messages/messages.component.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ <h1>{{ pageName }}</h1>
8383
&nbsp;
8484
</span>
8585
}
86-
<app-past-time-indicator [date]="message.message.date.toDate()"></app-past-time-indicator>
86+
@if (message.message.date) {
87+
<app-past-time-indicator [date]="message.message.date.toDate()"></app-past-time-indicator>
88+
}
8789
</div>
8890
</div>
8991
</div>

src/app/account/specs-conflicts/specs-conflicts.component.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ <h1 i18n id="header">Conflicts</h1>
1010
<div class="spinner-border" role="status"><span class="visually-hidden" i18n>Loading…</span></div>
1111
}
1212

13-
@if (filter$ | async; as filter) {
13+
@if ({value: filter$ | async}; as filter) {
1414
<div class="nav nav-pills mb-3">
1515
<a
1616
class="nav-link"
17-
[class.active]="filter === AttrConflictsRequest.Filter.ALL"
17+
[class.active]="filter.value === AttrConflictsRequest.Filter.ALL"
1818
routerLink="."
1919
[queryParams]="{filter: undefined}"
2020
queryParamsHandling="merge"
@@ -23,7 +23,7 @@ <h1 i18n id="header">Conflicts</h1>
2323
>
2424
<a
2525
class="nav-link"
26-
[class.active]="filter === AttrConflictsRequest.Filter.I_DISAGREE"
26+
[class.active]="filter.value === AttrConflictsRequest.Filter.I_DISAGREE"
2727
routerLink="."
2828
[queryParams]="{filter: '-1'}"
2929
queryParamsHandling="merge"
@@ -32,7 +32,7 @@ <h1 i18n id="header">Conflicts</h1>
3232
>
3333
<a
3434
class="nav-link"
35-
[class.active]="filter === AttrConflictsRequest.Filter.DO_NOT_AGREE_WITH_ME"
35+
[class.active]="filter.value === AttrConflictsRequest.Filter.DO_NOT_AGREE_WITH_ME"
3636
routerLink="."
3737
[queryParams]="{filter: '1'}"
3838
queryParamsHandling="merge"
@@ -41,7 +41,7 @@ <h1 i18n id="header">Conflicts</h1>
4141
>
4242
<a
4343
class="nav-link"
44-
[class.active]="filter === AttrConflictsRequest.Filter.MINUS_WEIGHT"
44+
[class.active]="filter.value === AttrConflictsRequest.Filter.MINUS_WEIGHT"
4545
routerLink="."
4646
[queryParams]="{filter: 'minus-weight'}"
4747
queryParamsHandling="merge"
@@ -68,7 +68,7 @@ <h1 i18n id="header">Conflicts</h1>
6868
<tr>
6969
<td>
7070
@if (conflict.item$ | async; as item) {
71-
<ng-container [textContent]="item.nameHtml"></ng-container>
71+
{{ item.nameHtml }}
7272
}
7373
</td>
7474
<td>

src/app/account/specs-conflicts/specs-conflicts.component.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ interface APIAttrConflictInList {
3535
values: APIAttrConflictValueInList[];
3636
}
3737

38-
function mapFilter(filter: string): AttrConflictsRequest.Filter {
38+
function mapFilter(filter: null | string): AttrConflictsRequest.Filter {
3939
switch (filter) {
4040
case '-1':
4141
return AttrConflictsRequest.Filter.I_DISAGREE;
42+
case '0':
43+
return AttrConflictsRequest.Filter.ALL;
4244
case '1':
4345
return AttrConflictsRequest.Filter.DO_NOT_AGREE_WITH_ME;
4446
case 'minus-weight':
@@ -68,11 +70,11 @@ export class AccountSpecsConflictsComponent implements OnInit {
6870
debounceTime(10),
6971
);
7072

71-
protected readonly filter$ = this.route.queryParamMap.pipe(
73+
protected readonly filter$: Observable<AttrConflictsRequest.Filter> = this.route.queryParamMap.pipe(
7274
map((params) => params.get('filter')),
7375
distinctUntilChanged(),
7476
debounceTime(10),
75-
map((filter) => mapFilter(filter || '')),
77+
map((filter) => mapFilter(filter)),
7678
);
7779

7880
protected readonly user$: Observable<APIUser | null> = this.auth.getUser$();

src/app/app.component.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
@if (!(layoutParams$ | async).isGalleryPage) {
1+
@if (!(layoutParams$ | async)?.isGalleryPage) {
22
<app-moder-menu></app-moder-menu>
33
}
44

5-
@if (!(layoutParams$ | async).isGalleryPage) {
5+
@if (!(layoutParams$ | async)?.isGalleryPage) {
66
<div class="navbar navbar-expand-md navbar-dark bg-dark">
77
<div class="container">
88
<button
@@ -176,12 +176,12 @@
176176
}
177177

178178
<div
179-
[class.container]="!(layoutParams$ | async).isGalleryPage"
180-
[class.container-fluid]="(layoutParams$ | async).isGalleryPage"
179+
[class.container]="!(layoutParams$ | async)?.isGalleryPage"
180+
[class.container-fluid]="(layoutParams$ | async)?.isGalleryPage"
181181
>
182182
<router-outlet></router-outlet>
183183

184-
@if (!(layoutParams$ | async).isAdminPage && !(layoutParams$ | async).isGalleryPage) {
184+
@if (!(layoutParams$ | async)?.isAdminPage && !(layoutParams$ | async)?.isGalleryPage) {
185185
<div class="bottom-line">
186186
<p>
187187
<strong>
@@ -193,7 +193,7 @@
193193
</div>
194194
}
195195

196-
@if (!(layoutParams$ | async).isAdminPage && !(layoutParams$ | async).isGalleryPage) {
196+
@if (!(layoutParams$ | async)?.isAdminPage && !(layoutParams$ | async)?.isGalleryPage) {
197197
<footer class="footer">
198198
<div class="row">
199199
<div class="col-md-6">

src/app/brands/item/item.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<ng-template #popover>
22
@if (response$ | async; as response) {
33
<div>
4-
@if (response.items.length > 0) {
5-
@if (response.brand.brandicon) {
6-
<img alt="" [src]="response.brand.brandicon.src" style="float: right; margin: 0 0 5px 5px" />
4+
@if ((response.items || []).length > 0) {
5+
@if (response.brand?.brandicon?.src) {
6+
<img alt="" [src]="response.brand?.brandicon?.src" style="float: right; margin: 0 0 5px 5px" />
77
}
88
@for (item of response.items; track item.id) {
99
<p [innerHTML]="item.nameHtml"></p>
@@ -21,7 +21,7 @@
2121
[routerLink]="['/', brand.catname]"
2222
class="brandicon"
2323
[ngClass]="'brandicon-' + cssClass(brand)"
24-
[ngStyle]="{'background-image': 'url(' + icons.image + ')'}"
24+
[ngStyle]="{'background-image': 'url(' + icons?.image + ')'}"
2525
></a>
2626
<h4>
2727
<a [routerLink]="['/', brand.catname]" [textContent]="brand.name"></a>

src/app/cars/specifications-editor/spec/spec.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ <h4>{{ control.attr.name }}</h4>
115115
@if (values$ | async; as values) {
116116
@if (values.get(control.attr.id); as value) {
117117
<div>
118-
@if (value.value.isEmpty) {
118+
@if (value.value?.isEmpty) {
119119
<em i18n>none</em>
120120
} @else {
121121
<span>
@@ -133,7 +133,7 @@ <h4>{{ control.attr.name }}</h4>
133133
@if (userValues$ | async; as userValues) {
134134
@for (value of userValues.get(control.attr.id); track value) {
135135
<div>
136-
@if (value.userValue.value.isEmpty) {
136+
@if (value.userValue.value?.isEmpty) {
137137
<em i18n>none</em>
138138
} @else {
139139
<span [textContent]="value.userValue.valueText"></span>

src/app/catalogue/index/index.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ <h2 i18n>Popular images</h2>
174174
<div class="row">
175175
@for (item of chunk; track item) {
176176
<div class="col-sm-3">
177-
<app-thumbnail [picture]="item.picture" [route]="item.route"></app-thumbnail>
177+
<app-thumbnail [picture]="item.picture" [route]="item.route || []"></app-thumbnail>
178178
</div>
179179
}
180180
</div>

src/app/catalogue/item-menu/item-menu.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<li class="nav-item">
55
<a class="nav-link" [class.active]="active === 'default'" [routerLink]="itemRouterLink">
66
<i class="bi bi-list" aria-hidden="true"></i>
7-
<app-item-header [item]="{nameHTML: header.nameHTML}"></app-item-header>
7+
<app-item-header [item]="{nameHTML: header?.nameHTML || ''}"></app-item-header>
88
<span class="badge rounded-pill text-bg-secondary">{{ childsCounts.stock }}</span>
99
</a>
1010
</li>
@@ -14,7 +14,7 @@
1414
<a class="nav-link" [class.active]="active === 'tuning'" [routerLink]="itemRouterLink.concat(['tuning'])">
1515
<i class="bi bi-list" aria-hidden="true"></i>
1616
<ng-container i18n>Related</ng-container>
17-
<app-item-header [item]="{nameHTML: header.nameHTML}"></app-item-header>
17+
<app-item-header [item]="{nameHTML: header?.nameHTML || ''}"></app-item-header>
1818
<span class="badge rounded-pill text-bg-secondary">{{ childsCounts.tuning }}</span>
1919
</a>
2020
</li>
@@ -23,7 +23,7 @@
2323
<li class="nav-item">
2424
<a class="nav-link" [class.active]="active === 'sport'" [routerLink]="itemRouterLink.concat(['sport'])">
2525
<i class="bi bi-list" aria-hidden="true"></i>
26-
<app-item-header [item]="{nameHTML: header.nameHTML}"></app-item-header>
26+
<app-item-header [item]="{nameHTML: header?.nameHTML || ''}"></app-item-header>
2727
<ng-container i18n>Sport</ng-container>
2828
<span class="badge rounded-pill text-bg-secondary">{{ childsCounts.sport }}</span>
2929
</a>
@@ -35,7 +35,7 @@
3535
<a class="nav-link" [class.active]="active === 'pictures'" [routerLink]="itemRouterLink.concat(['pictures'])">
3636
<i class="bi bi-grid-3x2-gap-fill" aria-hidden="true"></i>
3737
<ng-container i18n>All pictures of</ng-container>
38-
<app-item-header [item]="{nameHTML: header.nameHTML}"></app-item-header>
38+
<app-item-header [item]="{nameHTML: header?.nameHTML || ''}"></app-item-header>
3939
<span class="badge rounded-pill text-bg-secondary">{{ picturesCount }}</span>
4040
</a>
4141
</li>

0 commit comments

Comments
 (0)