All files / toolbar toolbar.component.ts

100% Statements 13/13
87.5% Branches 7/8
100% Functions 4/4
100% Lines 13/13

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60                    1x 4x                                       4x   4x   4x   4x   4x   4x     1x       2x 2x         2x 1x        
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
import { anchorButton, IAnchorButton } from '@app/client-util';
 
@Component({
  selector: 'app-toolbar',
  templateUrl: './toolbar.component.html',
  styleUrls: ['./toolbar.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush,
  standalone: false,
})
export class AppToolbarComponent {
  @Input() public version = 'N/A';
 
  @Input() public anchors: IAnchorButton[] = [
    anchorButton(
      'Report a bug',
      'bug_report',
      'https://github.com/rfprod/nx-ng-starter/issues/new?assignees=&labels=&template=bug_report.md&title=',
    ),
    anchorButton(
      'Request a feature',
      'lightbulb',
      'https://github.com/rfprod/nx-ng-starter/issues/new?assignees=&labels=&template=feature_request.md&title=',
    ),
    anchorButton(
      'Request maintenance',
      'engineering',
      'https://github.com/rfprod/nx-ng-starter/issues/new?assignees=&labels=&template=maintenance.md&title=',
    ),
  ];
 
  @Input() public sidebarOpen: boolean | null = false;
 
  @Input() public chatbotOpen: boolean | null = false;
 
  @Input() public darkThemeEnabled: boolean | null = false;
 
  @Output() public readonly sidebarToggled = new EventEmitter<undefined>();
 
  @Output() public readonly chatbotToggled = new EventEmitter<boolean>();
 
  @Output() public readonly themeToggled = new EventEmitter<boolean>();
 
  public toggleSidebar(): void {
    this.sidebarToggled.emit();
  }
 
  public toggleChatbot(event: MouseEvent | KeyboardEvent): void {
    Eif ((this.chatbotOpen !== null && event instanceof MouseEvent) || (event instanceof KeyboardEvent && event.key === 'Enter')) {
      this.chatbotToggled.emit(!Boolean(this.chatbotOpen));
    }
  }
 
  public toggleTheme(): void {
    if (this.darkThemeEnabled !== null) {
      this.themeToggled.emit(!this.darkThemeEnabled);
    }
  }
}