File

src/app/app.component.ts

Implements

OnInit

Metadata

Index

Properties

Constructor

constructor(consentService: ConsentService, snackbar: MatSnackBar, matIconRegistry: MatIconRegistry, domSanitizer: DomSanitizer, router: Router)
Parameters :
Name Type Optional
consentService ConsentService No
snackbar MatSnackBar No
matIconRegistry MatIconRegistry No
domSanitizer DomSanitizer No
router Router No

Properties

Public Readonly router
Type : Router
import { Component, OnInit } from '@angular/core';
import { MatIconRegistry } from '@angular/material/icon';
import { MatSnackBar } from '@angular/material/snack-bar';
import { DomSanitizer } from '@angular/platform-browser';
import { NavigationEnd, Router } from '@angular/router';
import { environment } from '../environments/environment';
import { TrackingPopupComponent } from './components/tracking-popup/tracking-popup.component';
import { ConsentService } from './services/consent.service';

declare let gtag: (arg1?: unknown, arg2?: unknown, arg3?: unknown) => void;

@Component({
  selector: 'app-reporter',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss'],
})
export class AppComponent implements OnInit {
  constructor(
    readonly consentService: ConsentService,
    readonly snackbar: MatSnackBar,
    private readonly matIconRegistry: MatIconRegistry,
    private readonly domSanitizer: DomSanitizer,
    public readonly router: Router,
  ) {
    switch (environment.tag) {
      case 'Staging':
        document.title = 'ASCT+B Reporter | Staging';
        break;
      case 'Development':
        document.title = 'ASCT+B Reporter | Development';
        break;
      default:
        document.title = 'ASCT+B Reporter';
    }

    this.matIconRegistry.addSvgIcon(
      'debug',
      this.domSanitizer.bypassSecurityTrustResourceUrl('../assets/icons/debug.svg'),
    );

    this.matIconRegistry.addSvgIcon(
      'report',
      this.domSanitizer.bypassSecurityTrustResourceUrl('../assets/icons/report.svg'),
    );

    this.matIconRegistry.addSvgIcon(
      'indentedList',
      this.domSanitizer.bypassSecurityTrustResourceUrl('../assets/icons/indent.svg'),
    );

    this.matIconRegistry.addSvgIcon(
      'compare',
      this.domSanitizer.bypassSecurityTrustResourceUrl('../assets/icons/compare.svg'),
    );

    this.matIconRegistry.addSvgIcon(
      'playground',
      this.domSanitizer.bypassSecurityTrustResourceUrl('../assets/icons/playground.svg'),
    );

    this.matIconRegistry.addSvgIcon(
      'upload_file',
      this.domSanitizer.bypassSecurityTrustResourceUrl('../assets/icons/upload.svg'),
    );

    this.router.events.subscribe((event) => {
      if (event instanceof NavigationEnd) {
        gtag('config', environment.googleAnalyticsId, {
          page_path: event.urlAfterRedirects,
        });
      }
    });
  }

  ngOnInit(): void {
    const snackBar = this.snackbar.openFromComponent(TrackingPopupComponent, {
      data: {
        preClose: () => {
          snackBar.dismiss();
        },
      },
      duration: this.consentService.consent === 'not-set' ? Infinity : 3000,
    });
  }
}
<router-outlet></router-outlet>

./app.component.scss

.over {
  z-index: 1000;
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""