Skip to content

Commit 9e54db6

Browse files
committed
WIP: replace bkdLet with @let & migrate remaining ngFor/ngIf
1 parent 2def3ec commit 9e54db6

File tree

64 files changed

+1479
-1787
lines changed

Some content is hidden

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

64 files changed

+1479
-1787
lines changed

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

+12-19
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,40 @@
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-
@if (data.loading) {
11+
@if (loading) {
1712
<bkd-spinner></bkd-spinner>
1813
}
19-
@if (
20-
!data.loading && !data.hasSearch && !data.hasActions && !data.hasTimetable
21-
) {
14+
@if (!loading && !hasSearch && !hasActions && !hasTimetable) {
2215
<p>
2316
{{ "dashboard.no-access" | translate }}
2417
</p>
2518
}
2619

2720
<div class="columns">
28-
@if (data.hasSearch || data.hasActions) {
21+
@if (hasSearch || hasActions) {
2922
<div class="search-actions-column">
30-
@if (data.hasSearch) {
23+
@if (hasSearch) {
3124
<div>
3225
<h2>{{ "dashboard.search.title" | translate }}</h2>
3326
<bkd-dashboard-search></bkd-dashboard-search>
3427
</div>
3528
}
36-
@if (data.hasActions) {
29+
@if (hasActions) {
3730
<div>
3831
<h2>{{ "dashboard.actions.title" | translate }}</h2>
3932
<bkd-dashboard-actions></bkd-dashboard-actions>
4033
</div>
4134
}
4235
</div>
4336
}
44-
@if (data.hasTimetable) {
37+
@if (hasTimetable) {
4538
<div class="timetable-column">
4639
<h2>{{ "dashboard.timetable.title" | translate }}</h2>
4740
<bkd-dashboard-timetable></bkd-dashboard-timetable>

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

-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ 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,7 +14,6 @@ import { DashboardTimetableComponent } from "../dashboard-timetable/dashboard-ti
1514
changeDetection: ChangeDetectionStrategy.OnPush,
1615
standalone: true,
1716
imports: [
18-
LetDirective,
1917
SpinnerComponent,
2018
DashboardSearchComponent,
2119
DashboardActionsComponent,

src/app/dashboard/components/dashboard-timetable/dashboard-timetable.component.html

+16-17
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,20 @@
3030
}
3131
</div>
3232

33-
<ng-container *bkdLet="timetableEntries$ | async as entries">
34-
@if ((loading$ | async) === false) {
35-
<bkd-dashboard-timetable-table
36-
[entries]="entries"
37-
></bkd-dashboard-timetable-table>
38-
@if (getSubscribeCalendarUrl() | async; as url) {
39-
<a
40-
[href]="url | safe: 'url'"
41-
target="_parent"
42-
class="btn btn-secondary subscribe-calendar-bottom"
43-
>
44-
{{ "dashboard.timetable.subscribe-calendar" | translate }}
45-
</a>
46-
}
47-
} @else {
48-
<bkd-spinner></bkd-spinner>
33+
@let entries = timetableEntries$ | async;
34+
@if (loading$ | async) {
35+
<bkd-spinner></bkd-spinner>
36+
} @else {
37+
<bkd-dashboard-timetable-table
38+
[entries]="entries"
39+
></bkd-dashboard-timetable-table>
40+
@if (getSubscribeCalendarUrl() | async; as url) {
41+
<a
42+
[href]="url | safe: 'url'"
43+
target="_parent"
44+
class="btn btn-secondary subscribe-calendar-bottom"
45+
>
46+
{{ "dashboard.timetable.subscribe-calendar" | translate }}
47+
</a>
4948
}
50-
</ng-container>
49+
}

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

-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { LessonPresencesRestService } from "src/app/shared/services/lesson-prese
1818
import { StudentsRestService } from "src/app/shared/services/students-rest.service";
1919
import { UserSettingsService } from "src/app/shared/services/user-settings.service";
2020
import { SpinnerComponent } from "../../../shared/components/spinner/spinner.component";
21-
import { LetDirective } from "../../../shared/directives/let.directive";
2221
import { SafePipe } from "../../../shared/pipes/safe.pipe";
2322
import { DashboardService } from "../../services/dashboard.service";
2423
import { DashboardTimetableTableComponent } from "../dashboard-timetable-table/dashboard-timetable-table.component";
@@ -42,7 +41,6 @@ const CALENDAR_SUBSCRIBE_KEY = "cal";
4241
styleUrls: ["./dashboard-timetable.component.scss"],
4342
standalone: true,
4443
imports: [
45-
LetDirective,
4644
DashboardTimetableTableComponent,
4745
SpinnerComponent,
4846
AsyncPipe,

src/app/edit-absences/components/edit-absences-edit/edit-absences-edit.component.html

+9-12
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1+
@let confirmationStates = confirmationStates$ | async;
2+
@let categories = activeCategories$ | async;
3+
@let formGroup = formGroup$ | async;
4+
15
<h1>{{ "edit-absences.title" | translate }}</h1>
2-
<div
3-
class="bkd-container bkd-container-limited"
4-
*bkdLet="{
5-
confirmationStates: confirmationStates$ | async,
6-
categories: activeCategories$ | async,
7-
formGroup: formGroup$ | async,
8-
} as data"
9-
>
10-
@if (data.formGroup && data.confirmationStates) {
11-
<form [formGroup]="data.formGroup" (ngSubmit)="onSubmit()">
6+
<div class="bkd-container bkd-container-limited">
7+
@if (formGroup && confirmationStates) {
8+
<form [formGroup]="formGroup" (ngSubmit)="onSubmit()">
129
@for (error of formErrors$ | async; track error) {
1310
<div class="alert alert-danger">
1411
{{
@@ -17,7 +14,7 @@ <h1>{{ "edit-absences.title" | translate }}</h1>
1714
</div>
1815
}
1916
<div class="form-group pb-4">
20-
@for (category of data.categories; track category) {
17+
@for (category of categories; track category) {
2118
<div class="form-check mt-2 mb-3">
2219
<input
2320
type="radio"
@@ -32,7 +29,7 @@ <h1>{{ "edit-absences.title" | translate }}</h1>
3229
@if (isAbsent(category)) {
3330
<div class="ms-5">
3431
@for (
35-
confirmationState of data.confirmationStates;
32+
confirmationState of confirmationStates;
3633
track confirmationState.Key
3734
) {
3835
<div class="form-check mt-2 mb-2">

src/app/edit-absences/components/edit-absences-edit/edit-absences-edit.component.ts

+1-8
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import {
3434
getValidationErrors,
3535
} from "src/app/shared/utils/form";
3636
import { parseQueryString } from "src/app/shared/utils/url";
37-
import { LetDirective } from "../../../shared/directives/let.directive";
3837
import { ToastService } from "../../../shared/services/toast.service";
3938
import { EditAbsencesStateService } from "../../services/edit-absences-state.service";
4039
import {
@@ -48,13 +47,7 @@ import {
4847
styleUrls: ["./edit-absences-edit.component.scss"],
4948
changeDetection: ChangeDetectionStrategy.OnPush,
5049
standalone: true,
51-
imports: [
52-
LetDirective,
53-
FormsModule,
54-
ReactiveFormsModule,
55-
AsyncPipe,
56-
TranslateModule,
57-
],
50+
imports: [FormsModule, ReactiveFormsModule, AsyncPipe, TranslateModule],
5851
})
5952
export class EditAbsencesEditComponent implements OnInit, OnDestroy {
6053
absenceTypes$ = this.presenceTypesService.confirmationTypes$;

0 commit comments

Comments
 (0)