Skip to content

Commit 3d1d69d

Browse files
bodnaraxkureck
authored andcommitted
fix: undefined footer element
* fixed accesing of undefined footer on login pages
1 parent 369ef4b commit 3d1d69d

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed

apps/admin-gui/src/app/app.component.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ declare let require: any;
2929
export class AppComponent implements OnInit, AfterViewInit {
3030
static minWidth = 992;
3131

32-
@ViewChild('footer') footer: ElementRef;
32+
@ViewChild('footer') footer: ElementRef<HTMLDivElement>;
3333

3434
sidebarMode: 'over' | 'push' | 'side' = 'side';
3535
lastScreenWidth: number;
@@ -129,13 +129,10 @@ export class AppComponent implements OnInit, AfterViewInit {
129129
}
130130

131131
ngAfterViewInit(): void {
132+
const footerHeight: string = this.footer?.nativeElement?.offsetHeight?.toString() ?? '0';
132133
this.contentInnerMinHeight = this.displayWarning
133-
? 'calc(100vh - ' +
134-
(this.footer.nativeElement as HTMLElement).offsetHeight.toString() +
135-
'px - 112px)'
136-
: 'calc(100vh - ' +
137-
(this.footer.nativeElement as HTMLElement).offsetHeight.toString() +
138-
'px - 64px)';
134+
? 'calc(100vh - ' + footerHeight + 'px - 112px)'
135+
: 'calc(100vh - ' + footerHeight + 'px - 64px)';
139136
this.cd.detectChanges();
140137
}
141138

apps/password-reset/src/app/app.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ export class AppComponent implements OnInit, AfterViewInit {
8080
}
8181

8282
ngAfterViewInit(): void {
83-
this.contentHeight =
84-
'calc(100vh - 84px - ' + String(this.footer.nativeElement.offsetHeight) + 'px)';
83+
const footerHeight: string = this.footer?.nativeElement?.offsetHeight?.toString() ?? '0';
84+
this.contentHeight = 'calc(100vh - 84px - ' + footerHeight + 'px)';
8585
this.changeDetector.detectChanges();
8686
}
8787
}

apps/publications/src/app/app.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ export class AppComponent implements OnInit, AfterViewInit {
6363
}
6464

6565
ngAfterViewInit(): void {
66-
this.contentHeight =
67-
'calc(100vh - 84px - ' + String(this.footer.nativeElement.offsetHeight) + 'px)';
66+
const footerHeight: string = this.footer?.nativeElement?.offsetHeight?.toString() ?? '0';
67+
this.contentHeight = 'calc(100vh - 84px - ' + footerHeight + 'px)';
6868
this.changeDetector.detectChanges();
6969
}
7070
}

apps/user-profile/src/app/app.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ export class AppComponent implements OnInit, AfterViewInit {
9191
}
9292

9393
ngAfterViewInit(): void {
94-
this.contentHeight =
95-
'calc(100vh - 84px - ' + String(this.footer.nativeElement.offsetHeight) + 'px)';
94+
const footerHeight: string = this.footer?.nativeElement?.offsetHeight?.toString() ?? '0';
95+
this.contentHeight = 'calc(100vh - 84px - ' + footerHeight + 'px)';
9696
this.changeDetector.detectChanges();
9797
}
9898
}

0 commit comments

Comments
 (0)