import {ChangeDetectorRef, Component, Inject, PLATFORM_ID} from "@angular/core";
import {BaseComponent} from "../../openaireLibrary/sharedComponents/base/base.component";
import {ActivatedRoute, Router} from "@angular/router";
import {PiwikService} from "../../openaireLibrary/utils/piwik/piwik.service";
import {SEOService} from "../../openaireLibrary/sharedComponents/SEO/SEO.service";
import {Meta, Title} from "@angular/platform-browser";
import {Breadcrumb} from "../../openaireLibrary/utils/breadcrumbs/breadcrumbs.component";
import {isPlatformServer} from "@angular/common";
import {LayoutService} from "../../openaireLibrary/dashboard/sharedComponents/sidebar/layout.service";

@Component({
  selector: 'user-actions',
  templateUrl: 'user-actions.component.html',
  styleUrls: ['user-actions.component.less']
})
export class UserActionsComponent extends BaseComponent{
  title = 'User Actions';
  description = 'User Actions';
  breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'resources - user actions'}];

  isMobile: boolean = false;
  isServer: boolean;

  constructor(protected _route: ActivatedRoute,
              protected _piwikService: PiwikService,
              protected _meta: Meta,
              protected seoService: SEOService,
              protected _title: Title,
              protected _router: Router,
              private cdr: ChangeDetectorRef,
              private layoutService: LayoutService,
              @Inject(PLATFORM_ID) private platform: any) {
    super();
    this.isServer = isPlatformServer(this.platform);
  }

  ngOnInit() {
    this.setMetadata();
    this.layoutService.isMobile.subscribe(isMobile => {
			this.isMobile = isMobile;
			this.cdr.detectChanges();
		});
  }
}