Skip to content
Snippets Groups Projects
app.component.ts 1.42 KiB
Newer Older
rhenck's avatar
rhenck committed
import { Component, OnInit } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { registerLocaleData } from '@angular/common';
import localeDe from '@angular/common/locales/de';
import { VeronaAPIService, StartCommand } from './services/verona-api.service';
import { UnitService } from './services/unit-services/unit.service';
  selector: 'aspect-editor',
  template: `
    <div class="mainView fx-column-start-stretch">
rhenck's avatar
rhenck committed
      <aspect-toolbar *ngIf="isStandalone"></aspect-toolbar>
      <aspect-unit-view class="fx-flex"></aspect-unit-view>
rhenck's avatar
rhenck committed
export class AppComponent implements OnInit {
rhenck's avatar
rhenck committed
  isStandalone = window === window.parent;

  constructor(private unitService: UnitService,
              private translateService: TranslateService,
rhenck's avatar
rhenck committed
              private veronaApiService: VeronaAPIService) {
    translateService.addLangs(['de']);
    translateService.setDefaultLang('de');
  }
rhenck's avatar
rhenck committed

  ngOnInit(): void {
    this.veronaApiService.startCommand
      .subscribe((message: StartCommand): void => {
        this.unitService.loadUnitDefinition(message.unitDefinition);
rhenck's avatar
rhenck committed
        if (message.editorConfig.role === 'developer') {
          this.unitService.expertMode = false;
          this.unitService.allowExpertMode = false;
        }
    this.veronaApiService.sendReady();
    registerLocaleData(localeDe);
rhenck's avatar
rhenck committed
  }