import { Component, Input, OnChanges } from '@angular/core'; import { EmailService } from '@features/system-emails/email.service'; import { EmailNotificationType } from '@features/system-emails/email.typing'; import { I18nService } from '@yourcause/common/i18n'; @Component({ selector: 'gc-email-disabled-alert', templateUrl: './email-disabled-alert.component.html', styleUrls: ['./email-disabled-alert.component.scss'] }) export class EmailDisabledAlertComponent implements OnChanges { @Input() currentEmailType: EmailNotificationType; emailAlertMessage = ''; constructor ( private i18n: I18nService, private emailService: EmailService ) { } async ngOnChanges () { await this.emailService.setEmails(); const found = this.emailService.getEmailByType(this.currentEmailType); this.emailAlertMessage = this.i18n.translate( 'GLOBAL:textEmailNotActiveDesc', { subject: found.subject }, '__subject__ emails have been turned off. To send, please have your administrator activate this email.' ); } }