status-modal.service.ts 969 Bytes
Newer Older
XFT-dev's avatar
XFT-dev committed
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
import {Injectable} from '@angular/core';
import {action} from 'mobx-angular';

import {StatusModalComponent} from '../modals/status/status-modal.component';
import {MatDialog} from '@angular/material/dialog';

@Injectable({
    providedIn: 'root'
})
export class StatusModalService {

  constructor(
    public dialog: MatDialog,
  ) { }


  @action openStatusModal(data: { hash: string }) {
      setTimeout(() => {
          window.document.body.classList.add('modal-opened');
          return this.dialog
              .open(StatusModalComponent, {
                  width: '350px',
                  panelClass: 'off-shift-modal',
                  backdropClass: 'backdrop-modal',
                  autoFocus: false,
                  data
              }).afterClosed().subscribe((res) => {
                  this.deleteModalClass();
              });
      }, 500 );

  }

  deleteModalClass() {
    window.document.body.classList.remove('modal-opened');
  }
}