docs: add JSDoc comments to HeaderComponent
This commit is contained in:
parent
e8d6c99089
commit
e49f6bd9ff
2 changed files with 31 additions and 5 deletions
|
|
@ -18,16 +18,29 @@ export class HeaderComponent {
|
|||
|
||||
constructor(public firebaseService: FirebaseService) {}
|
||||
|
||||
toggleNavbar() {
|
||||
/**
|
||||
* Toggles the visibility of the navbar.
|
||||
* @returns {void}
|
||||
*/
|
||||
toggleNavbar(): void {
|
||||
this.navbarVisible = !this.navbarVisible;
|
||||
}
|
||||
|
||||
toggleLanguage() {
|
||||
/**
|
||||
* Toggles the visibility of the language selection navbar.
|
||||
* @returns {void}
|
||||
*/
|
||||
toggleLanguage(): void {
|
||||
this.navbarLanguageVisible = !this.navbarLanguageVisible;
|
||||
}
|
||||
|
||||
@HostListener('document:click', ['$event'])
|
||||
checkOpenNavbar(event: MouseEvent) {
|
||||
/**
|
||||
* Closes the navbar if the user clicks outside of it
|
||||
* @param event a MouseEvent
|
||||
* @returns {void}
|
||||
*/
|
||||
checkOpenNavbar(event: MouseEvent): void {
|
||||
const targetElement = event.target as HTMLElement;
|
||||
if (
|
||||
!targetElement.closest('app-navbar') &&
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { Component, Input } from '@angular/core';
|
||||
import { Router, RouterModule } from '@angular/router';
|
||||
import { HeaderComponent } from '../header.component';
|
||||
import { LanguageService } from '../../../../services/language.service';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
|
@ -10,7 +9,7 @@ import { FirebaseService } from '../../../../services/firebase.service';
|
|||
@Component({
|
||||
selector: 'app-navbar',
|
||||
standalone: true,
|
||||
imports: [RouterModule, HeaderComponent, CommonModule, TranslateModule],
|
||||
imports: [RouterModule, CommonModule, TranslateModule],
|
||||
templateUrl: './navbar.component.html',
|
||||
styleUrl: './navbar.component.scss',
|
||||
})
|
||||
|
|
@ -27,10 +26,24 @@ export class NavbarComponent {
|
|||
private firebaseService: FirebaseService
|
||||
) {}
|
||||
|
||||
/**
|
||||
* OnInit lifecycle hook.
|
||||
*
|
||||
* Sets the currentRoute property to the current route's url.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.currentRoute = this.router.url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs out the current user and navigates to the login page.
|
||||
*
|
||||
* The logout method of the LoginService is called with the current user ID as
|
||||
* its argument. This will remove the user ID from the local storage and
|
||||
* perform any other necessary cleanup operations.
|
||||
*
|
||||
* The user is then navigated to the login page.
|
||||
*/
|
||||
logout() {
|
||||
this.loginService.logout(this.firebaseService.getCurrentUserId());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue