added old label (> 3 months)

This commit is contained in:
Nicolas Constant 2019-06-17 21:49:18 -04:00
parent 8d5d6ae5d1
commit 0e214f1204
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
3 changed files with 14 additions and 0 deletions

View File

@ -63,6 +63,9 @@
*ngIf="hasReply"> *ngIf="hasReply">
replies replies
</div> </div>
<div class="status__labels--label status__labels--old" title="this status is old" *ngIf="isOld">
old
</div>
</div> </div>
<!-- <div #content class="status__content" innerHTML="{{displayedStatus.content}}"></div> --> <!-- <div #content class="status__content" innerHTML="{{displayedStatus.content}}"></div> -->

View File

@ -80,6 +80,9 @@
&--discuss { &--discuss {
background-color: rgb(90, 0, 143); background-color: rgb(90, 0, 143);
} }
&--old {
background-color: rgb(150, 0, 0);
}
} }
&__name { &__name {
display: inline-block; display: inline-block;

View File

@ -30,6 +30,7 @@ export class StatusComponent implements OnInit {
replyingToStatus: boolean; replyingToStatus: boolean;
isCrossPoster: boolean; isCrossPoster: boolean;
isThread: boolean; isThread: boolean;
isOld: boolean;
isContentWarned: boolean; isContentWarned: boolean;
hasReply: boolean; hasReply: boolean;
contentWarningText: string; contentWarningText: string;
@ -121,6 +122,13 @@ export class StatusComponent implements OnInit {
} }
this.hasReply = status.replies_count > 0; this.hasReply = status.replies_count > 0;
let createdAt = new Date(status.created_at);
let now = new Date();
now.setMonth(now.getMonth() - 3);
if (now > createdAt) {
this.isOld = true;
}
} }
openAccount(account: Account): boolean { openAccount(account: Account): boolean {