(apps/mailbox) Removed unused methods

This commit is contained in:
sercan 2021-04-26 16:08:19 +03:00
parent deeef323f9
commit 88e98d002d

View File

@ -1,7 +1,6 @@
import { Component, ElementRef, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import * as moment from 'moment';
import { MailboxService } from 'app/modules/admin/apps/mailbox/mailbox.service';
import { MailboxComponent } from 'app/modules/admin/apps/mailbox/mailbox.component';
import { Mail, MailCategory } from 'app/modules/admin/apps/mailbox/mailbox.types';
@ -119,77 +118,6 @@ export class MailboxListComponent implements OnInit, OnDestroy
this._mailboxService.selectedMailChanged.next(mail);
}
/**
* Generate and return mail list group label if necessary or return false
*
* @param index
*/
mailListGroupLabel(index: number): string | false
{
const previousMail = this.mails[index - 1];
const currentMail = this.mails[index];
// Generate and return label, if there is no previous mail
if ( !previousMail )
{
return this._generateMailListGroupLabel(this.mails[index].date);
}
// Return false, if the two dates are equal by day
if ( moment(previousMail.date, moment.ISO_8601).isSame(moment(currentMail.date, moment.ISO_8601), 'day') )
{
return false;
}
// Generate and return label
return this._generateMailListGroupLabel(this.mails[index].date);
}
// -----------------------------------------------------------------------------------------------------
// @ Private methods
// -----------------------------------------------------------------------------------------------------
/**
* Generate a mail list group label based on the date
*
* @param mailDate
* @private
*/
private _generateMailListGroupLabel(mailDate: string): string
{
const date = moment(mailDate, moment.ISO_8601);
const today = moment();
const yesterday = moment().subtract(1, 'day');
// Check if the mail date is today
if ( date.isSame(today, 'day') )
{
// Return 'Today'
return 'Today';
}
// Check if the mail date is yesterday
if ( date.isSame(yesterday, 'day') )
{
// Return 'Yesterday'
return 'Yesterday';
}
// Check if we are in the same year with the mail date...
if ( date.isSame(today, 'year') )
{
// Return a date without a year
return date.format('MMMM DD');
}
// Return a date
return date.format('LL');
}
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
/**
* Track by function for ngFor loops
*