import { Component , OnInit , OnDestroy } from '@angular/core' ; import { MediumFadeAnimation } from '../../../../../animations' ; import { ActivityService , ActivityEntity } from '../../activity.service' ; import { ActivityModalService } from '../modal.service' ; import { Session } from '../../../../../services/session' ; import { ConfigsService } from '../../../../../common/services/configs.service' ; import { Subscription } from 'rxjs' ; @ Component ( { selector : 'm-activity__modalTitleOverlay' , templateUrl : './title-overlay.component.html' , styleUrls : [ './title-overlay.component.ng.scss' ] , animations : [ MediumFadeAnimation ] , } ) export class ActivityModalTitleOverlayComponent implements OnInit , OnDestroy { fullscreenHovering : boolean = false ; tabletOverlayTimeout : any = null ; entitySubscription : Subscription ; entity : ActivityEntity ; constructor ( public service , public activityService , private session , private configs ) { } ngOnInit ( ) { this . entitySubscription = this . activityService . entity$ . subscribe ( ( entity ) => { this . entity = entity ; } ) ; } ngOnDestroy ( ) { if ( this . entitySubscription ) { this . entitySubscription . unsubscribe ( ) ; } } get title ( ) : string { return this . entity . title || `${ this . entity . ownerObj . name }'s post` ; } get avatarUrl ( ) : string { const currentUser = this . session . getLoggedInUser ( ) ; const iconTime = currentUser && currentUser . guid === this . entity . ownerObj . guid ? currentUser . icontime : this . entity . ownerObj . icontime ; return ( this . configs . get ( 'cdn_url' ) + 'icon/' + this . entity . ownerObj . guid + '/medium/' + iconTime ) ; } }