Skip to content

Commit 865be32

Browse files
committed
fix(pwd-reset): fixed footer position in password-reset app
* fixed initial position of footer in password reset app according to the monitor size * fixed error in console regarding reading value from null object
1 parent ea5b6e6 commit 865be32

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
[authWithoutToken]="authWithoutToken">
1212
</perun-web-apps-password-reset-page>
1313
</div>
14-
<perun-web-apps-footer (footerHeight)="setContentHeight($event)"></perun-web-apps-footer>
14+
<div #footer>
15+
<perun-web-apps-footer></perun-web-apps-footer>
16+
</div>
1517
</div>
1618
</div>

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
1+
import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
22
import { MatDialog } from '@angular/material/dialog';
33
import { AttributesManagerService, UsersManagerService } from '@perun-web-apps/perun/openapi';
44
import { PreferredLanguageService, StoreService } from '@perun-web-apps/perun/services';
@@ -9,7 +9,7 @@ import { TranslateService } from '@ngx-translate/core';
99
templateUrl: './app.component.html',
1010
styleUrls: ['./app.component.scss'],
1111
})
12-
export class AppComponent implements OnInit{
12+
export class AppComponent implements OnInit, AfterViewInit{
1313

1414
constructor(private dialog: MatDialog,
1515
private usersService: UsersManagerService,
@@ -27,6 +27,7 @@ export class AppComponent implements OnInit{
2727
authWithoutToken = false;
2828
contentHeight = 'calc(100vh - 84px)';
2929
contentBackgroundColor = this.store.get('theme', 'content_bg_color');
30+
@ViewChild('footer') footer: ElementRef;
3031

3132
ngOnInit() {
3233
const prefLang = this.preferredLangService.getPreferredLanguage(null);
@@ -47,7 +48,8 @@ export class AppComponent implements OnInit{
4748
} else {
4849
this.authWithoutToken = true;
4950
this.attributesManagerService.getLogins(this.store.getPerunPrincipal().userId).subscribe(logins => {
50-
this.login = logins.find(login => login.friendlyNameParameter === this.namespace).value.toString();
51+
const selectedLogin = logins.find(login => login.friendlyNameParameter === this.namespace);
52+
this.login = selectedLogin ? selectedLogin.value.toString() : '';
5153
});
5254
}
5355
}
@@ -62,9 +64,8 @@ export class AppComponent implements OnInit{
6264
}
6365
}
6466

65-
setContentHeight(height: number) {
66-
this.contentHeight = 'calc(100vh - 84px - '+height+'px)';
67+
ngAfterViewInit(): void {
68+
this.contentHeight = 'calc(100vh - 84px - '+this.footer.nativeElement.offsetHeight+'px)';
6769
this.changeDetector.detectChanges();
6870
}
69-
7071
}

0 commit comments

Comments
 (0)