Skip to content

Commit 3fb7919

Browse files
committed
Migrate control flow & replace bkdLet with @let #705
1 parent 36f8e34 commit 3fb7919

File tree

135 files changed

+5208
-5014
lines changed

Some content is hidden

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

135 files changed

+5208
-5014
lines changed

package-lock.json

+2,483-2,045
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+15-15
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@
3232
},
3333
"private": true,
3434
"dependencies": {
35-
"@angular/animations": "18.0.3",
36-
"@angular/common": "18.0.3",
37-
"@angular/compiler": "18.0.3",
38-
"@angular/core": "18.0.3",
39-
"@angular/forms": "18.0.3",
40-
"@angular/localize": "18.0.3",
41-
"@angular/platform-browser": "18.0.3",
42-
"@angular/platform-browser-dynamic": "18.0.3",
43-
"@angular/router": "18.0.3",
35+
"@angular/animations": "18.2.8",
36+
"@angular/common": "18.2.8",
37+
"@angular/compiler": "18.2.8",
38+
"@angular/core": "18.2.8",
39+
"@angular/forms": "18.2.8",
40+
"@angular/localize": "18.2.8",
41+
"@angular/platform-browser": "18.2.8",
42+
"@angular/platform-browser-dynamic": "18.2.8",
43+
"@angular/router": "18.2.8",
4444
"@ng-bootstrap/ng-bootstrap": "17.0.0",
4545
"@ng-select/ng-select": "13.2.0",
4646
"@ngx-translate/core": "15.0.0",
@@ -57,18 +57,18 @@
5757
"ngx-infinite-scroll": "18.0.0",
5858
"rxjs": "7.8.1",
5959
"tslib": "2.6.3",
60-
"zone.js": "0.14.7"
60+
"zone.js": "0.14.10"
6161
},
6262
"devDependencies": {
63-
"@angular-devkit/build-angular": "18.0.4",
63+
"@angular-devkit/build-angular": "18.2.8",
6464
"@angular-eslint/builder": "18.0.1",
6565
"@angular-eslint/eslint-plugin": "18.0.1",
6666
"@angular-eslint/eslint-plugin-template": "18.0.1",
6767
"@angular-eslint/schematics": "18.0.1",
6868
"@angular-eslint/template-parser": "18.0.1",
69-
"@angular/cli": "18.0.4",
70-
"@angular/compiler-cli": "18.0.3",
71-
"@angular/language-service": "18.0.3",
69+
"@angular/cli": "18.2.8",
70+
"@angular/compiler-cli": "18.2.8",
71+
"@angular/language-service": "18.2.8",
7272
"@trivago/prettier-plugin-sort-imports": "4.3.0",
7373
"@types/jasmine": "5.1.4",
7474
"@types/lodash-es": "4.17.12",
@@ -89,7 +89,7 @@
8989
"karma-jasmine-html-reporter": "2.1.0",
9090
"karma-spec-reporter": "0.0.36",
9191
"lint-staged": "15.2.7",
92-
"prettier": "3.3.2",
92+
"prettier": "3.3.3",
9393
"typescript": "5.4.5"
9494
},
9595
"lint-staged": {
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
1-
<a *ngIf="!externalLink" [routerLink]="link" [queryParams]="linkParams">
2-
<ng-container *ngTemplateOutlet="actionContent"></ng-container>
3-
</a>
1+
@if (!externalLink) {
2+
<a [routerLink]="link" [queryParams]="linkParams">
3+
<ng-container *ngTemplateOutlet="actionContent"></ng-container>
4+
</a>
5+
}
46

5-
<a *ngIf="externalLink" [href]="externalLink">
6-
<ng-container *ngTemplateOutlet="actionContent"></ng-container>
7-
</a>
7+
@if (externalLink) {
8+
<a [href]="externalLink">
9+
<ng-container *ngTemplateOutlet="actionContent"></ng-container>
10+
</a>
11+
}
812

913
<ng-template #actionContent>
1014
<span class="label">{{ label | translate }}</span>
1115
<div>
1216
<ng-content></ng-content>
13-
<span class="count" *ngIf="hasCount(count); else icon">{{ count }}</span>
14-
<ng-template #icon>
17+
@if (hasCount(count)) {
18+
<span class="count">{{ count }}</span>
19+
} @else {
1520
<svg
1621
xmlns="http://www.w3.org/2000/svg"
1722
width="24"
@@ -23,6 +28,6 @@
2328
d="m12 20-1.425-1.4 5.6-5.6H4v-2h12.175l-5.6-5.6L12 4l8 8-8 8Z"
2429
/>
2530
</svg>
26-
</ng-template>
31+
}
2732
</div>
2833
</ng-template>

src/app/dashboard/components/dashboard-action/dashboard-action.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { NgIf, NgTemplateOutlet } from "@angular/common";
1+
import { NgTemplateOutlet } from "@angular/common";
22
import { Component, Input } from "@angular/core";
33
import { Params, RouterLink } from "@angular/router";
44
import { TranslateModule } from "@ngx-translate/core";
@@ -8,7 +8,7 @@ import { TranslateModule } from "@ngx-translate/core";
88
templateUrl: "./dashboard-action.component.html",
99
styleUrls: ["./dashboard-action.component.scss"],
1010
standalone: true,
11-
imports: [NgIf, RouterLink, NgTemplateOutlet, TranslateModule],
11+
imports: [RouterLink, NgTemplateOutlet, TranslateModule],
1212
})
1313
export class DashboardActionComponent {
1414
@Input() label: string;
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,62 @@
1-
<bkd-dashboard-action
2-
*ngIf="dashboardService.hasPresenceControl$ | async"
3-
[label]="'dashboard.actions.presence-control'"
4-
[link]="['/presence-control']"
5-
></bkd-dashboard-action>
1+
@if (dashboardService.hasPresenceControl$ | async) {
2+
<bkd-dashboard-action
3+
[label]="'dashboard.actions.presence-control'"
4+
[link]="['/presence-control']"
5+
></bkd-dashboard-action>
6+
}
67

7-
<bkd-dashboard-action
8-
*ngIf="
9-
(dashboardService.hasLessonTeacherRole$ | async) &&
10-
(dashboardService.editAbsencesParams$ | async)
11-
"
12-
[label]="'dashboard.actions.edit-absences'"
13-
[link]="['/edit-absences']"
14-
[linkParams]="dashboardService.editAbsencesParams$ | async"
15-
[count]="dashboardService.editAbsencesCount$ | async"
16-
></bkd-dashboard-action>
8+
@if (
9+
(dashboardService.hasLessonTeacherRole$ | async) &&
10+
(dashboardService.editAbsencesParams$ | async)
11+
) {
12+
<bkd-dashboard-action
13+
[label]="'dashboard.actions.edit-absences'"
14+
[link]="['/edit-absences']"
15+
[linkParams]="dashboardService.editAbsencesParams$ | async"
16+
[count]="dashboardService.editAbsencesCount$ | async"
17+
></bkd-dashboard-action>
18+
}
1719

18-
<bkd-dashboard-action
19-
*ngIf="dashboardService.hasOpenAbsences$ | async"
20-
[label]="'dashboard.actions.open-absences'"
21-
[link]="['/open-absences']"
22-
[count]="dashboardService.openAbsencesCount$ | async"
23-
></bkd-dashboard-action>
20+
@if (dashboardService.hasOpenAbsences$ | async) {
21+
<bkd-dashboard-action
22+
[label]="'dashboard.actions.open-absences'"
23+
[link]="['/open-absences']"
24+
[count]="dashboardService.openAbsencesCount$ | async"
25+
></bkd-dashboard-action>
26+
}
2427

25-
<bkd-dashboard-action
26-
*ngIf="dashboardService.hasTeacherRole$ | async"
27-
[label]="'dashboard.actions.tests'"
28-
[link]="['/events']"
29-
>
30-
<bkd-dashboard-deadline
31-
*ngIf="(dashboardService.coursesToRateCount$ | async) ?? 0 > 0"
32-
[count]="dashboardService.coursesToRateCount$ | async"
33-
></bkd-dashboard-deadline>
34-
</bkd-dashboard-action>
28+
@if (dashboardService.hasTeacherRole$ | async) {
29+
<bkd-dashboard-action
30+
[label]="'dashboard.actions.tests'"
31+
[link]="['/events']"
32+
>
33+
@if ((dashboardService.coursesToRateCount$ | async) ?? 0 > 0) {
34+
<bkd-dashboard-deadline
35+
[count]="dashboardService.coursesToRateCount$ | async"
36+
></bkd-dashboard-deadline>
37+
}
38+
</bkd-dashboard-action>
39+
}
3540

36-
<bkd-dashboard-action
37-
*ngIf="dashboardService.hasStudentRole$ | async"
38-
[label]="'dashboard.actions.my-absences-report'"
39-
[link]="['/my-absences', 'report']"
40-
>
41-
</bkd-dashboard-action>
41+
@if (dashboardService.hasStudentRole$ | async) {
42+
<bkd-dashboard-action
43+
[label]="'dashboard.actions.my-absences-report'"
44+
[link]="['/my-absences', 'report']"
45+
>
46+
</bkd-dashboard-action>
47+
}
4248

43-
<bkd-dashboard-action
44-
*ngIf="dashboardService.hasStudentRole$ | async"
45-
[label]="'dashboard.actions.my-absences'"
46-
[link]="['/my-absences']"
47-
[count]="dashboardService.myAbsencesCount$ | async"
48-
></bkd-dashboard-action>
49+
@if (dashboardService.hasStudentRole$ | async) {
50+
<bkd-dashboard-action
51+
[label]="'dashboard.actions.my-absences'"
52+
[link]="['/my-absences']"
53+
[count]="dashboardService.myAbsencesCount$ | async"
54+
></bkd-dashboard-action>
55+
}
4956

50-
<bkd-dashboard-action
51-
*ngIf="dashboardService.hasSubstituteAdministratorRole$ | async"
52-
[label]="'dashboard.actions.substitutions'"
53-
[externalLink]="substitutionsAdminLink"
54-
></bkd-dashboard-action>
57+
@if (dashboardService.hasSubstituteAdministratorRole$ | async) {
58+
<bkd-dashboard-action
59+
[label]="'dashboard.actions.substitutions'"
60+
[externalLink]="substitutionsAdminLink"
61+
></bkd-dashboard-action>
62+
}

src/app/dashboard/components/dashboard-actions/dashboard-actions.component.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AsyncPipe, NgIf } from "@angular/common";
1+
import { AsyncPipe } from "@angular/common";
22
import { Component, Inject } from "@angular/core";
33
import { SETTINGS, Settings } from "../../../settings";
44
import { DashboardService } from "../../services/dashboard.service";
@@ -10,12 +10,7 @@ import { DashboardDeadlineComponent } from "../dashboard-deadline/dashboard-dead
1010
templateUrl: "./dashboard-actions.component.html",
1111
styleUrls: ["./dashboard-actions.component.scss"],
1212
standalone: true,
13-
imports: [
14-
NgIf,
15-
DashboardActionComponent,
16-
DashboardDeadlineComponent,
17-
AsyncPipe,
18-
],
13+
imports: [DashboardActionComponent, DashboardDeadlineComponent, AsyncPipe],
1914
})
2015
export class DashboardActionsComponent {
2116
constructor(
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
1-
<div
2-
*bkdLet="{
3-
loading: dashboardService.loading$ | async,
4-
hasSearch: dashboardService.hasSearch$ | async,
5-
hasActions: dashboardService.hasActions$ | async,
6-
hasTimetable: dashboardService.hasTimetable$ | async,
7-
} as data"
8-
>
1+
@let loading = dashboardService.loading$ | async;
2+
@let hasSearch = dashboardService.hasSearch$ | async;
3+
@let hasActions = dashboardService.hasActions$ | async;
4+
@let hasTimetable = dashboardService.hasTimetable$ | async;
5+
<div>
96
<h1
10-
[class.visually-hidden]="
11-
data.loading || data.hasSearch || data.hasActions || data.hasTimetable
12-
"
7+
[class.visually-hidden]="loading || hasSearch || hasActions || hasTimetable"
138
>
149
{{ "dashboard.heading" | translate }}
1510
</h1>
16-
<bkd-spinner *ngIf="data.loading"></bkd-spinner>
17-
<p
18-
*ngIf="
19-
!data.loading && !data.hasSearch && !data.hasActions && !data.hasTimetable
20-
"
21-
>
22-
{{ "dashboard.no-access" | translate }}
23-
</p>
11+
@if (loading) {
12+
<bkd-spinner></bkd-spinner>
13+
}
14+
@if (!loading && !hasSearch && !hasActions && !hasTimetable) {
15+
<p>
16+
{{ "dashboard.no-access" | translate }}
17+
</p>
18+
}
2419

2520
<div class="columns">
26-
<div
27-
class="search-actions-column"
28-
*ngIf="data.hasSearch || data.hasActions"
29-
>
30-
<div *ngIf="data.hasSearch">
31-
<h2>{{ "dashboard.search.title" | translate }}</h2>
32-
<bkd-dashboard-search></bkd-dashboard-search>
21+
@if (hasSearch || hasActions) {
22+
<div class="search-actions-column">
23+
@if (hasSearch) {
24+
<div>
25+
<h2>{{ "dashboard.search.title" | translate }}</h2>
26+
<bkd-dashboard-search></bkd-dashboard-search>
27+
</div>
28+
}
29+
@if (hasActions) {
30+
<div>
31+
<h2>{{ "dashboard.actions.title" | translate }}</h2>
32+
<bkd-dashboard-actions></bkd-dashboard-actions>
33+
</div>
34+
}
3335
</div>
34-
<div *ngIf="data.hasActions">
35-
<h2>{{ "dashboard.actions.title" | translate }}</h2>
36-
<bkd-dashboard-actions></bkd-dashboard-actions>
36+
}
37+
@if (hasTimetable) {
38+
<div class="timetable-column">
39+
<h2>{{ "dashboard.timetable.title" | translate }}</h2>
40+
<bkd-dashboard-timetable></bkd-dashboard-timetable>
3741
</div>
38-
</div>
39-
<div *ngIf="data.hasTimetable" class="timetable-column">
40-
<h2>{{ "dashboard.timetable.title" | translate }}</h2>
41-
<bkd-dashboard-timetable></bkd-dashboard-timetable>
42-
</div>
42+
}
4343
</div>
4444
</div>

src/app/dashboard/components/dashboard-layout/dashboard-layout.component.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { AsyncPipe, NgIf } from "@angular/common";
1+
import { AsyncPipe } from "@angular/common";
22
import { ChangeDetectionStrategy, Component } from "@angular/core";
33
import { TranslateModule } from "@ngx-translate/core";
44
import { SpinnerComponent } from "../../../shared/components/spinner/spinner.component";
5-
import { LetDirective } from "../../../shared/directives/let.directive";
65
import { DashboardService } from "../../services/dashboard.service";
76
import { DashboardActionsComponent } from "../dashboard-actions/dashboard-actions.component";
87
import { DashboardSearchComponent } from "../dashboard-search/dashboard-search.component";
@@ -15,8 +14,6 @@ import { DashboardTimetableComponent } from "../dashboard-timetable/dashboard-ti
1514
changeDetection: ChangeDetectionStrategy.OnPush,
1615
standalone: true,
1716
imports: [
18-
LetDirective,
19-
NgIf,
2017
SpinnerComponent,
2118
DashboardSearchComponent,
2219
DashboardActionsComponent,

0 commit comments

Comments
 (0)