added reply label

This commit is contained in:
Nicolas Constant 2019-03-01 00:59:12 -05:00
parent 1673d8b35b
commit 5d86387ede
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
4 changed files with 29 additions and 24 deletions

View File

@ -20,36 +20,34 @@
</a> </a>
</div> </div>
<div class="status__labels"> <div class="status__labels">
<div class="status__labels--label status__labels--bot" title="bot" <div class="status__labels--label status__labels--bot" title="bot" *ngIf="status.account.bot">
*ngIf="status.account.bot">
bot bot
</div> </div>
<div class="status__labels--label status__labels--xpost" title="cross-poster" <div class="status__labels--label status__labels--xpost" title="this status was cross-posted" *ngIf="isCrossPoster">
*ngIf="isCrossPoster">
x-post x-post
</div> </div>
<div class="status__labels--label status__labels--thread" title="thread" <div class="status__labels--label status__labels--thread" title="thread" *ngIf="isThread">
*ngIf="isThread"> thread
thread </div>
</div> <div class="status__labels--label status__labels--discuss" title="this status has a discution" *ngIf="hasReply">
replies
</div>
</div> </div>
<!-- <div #content class="status__content" innerHTML="{{displayedStatus.content}}"></div> --> <!-- <div #content class="status__content" innerHTML="{{displayedStatus.content}}"></div> -->
<a href class="status__content-warning" *ngIf="isContentWarned" title="show content" (click)="removeContentWarning()"> <a href class="status__content-warning" *ngIf="isContentWarned" title="show content"
(click)="removeContentWarning()">
<span class="status__content-warning--title">sensitive content</span> <span class="status__content-warning--title">sensitive content</span>
{{ contentWarningText }} {{ contentWarningText }}
</a> </a>
<app-databinded-text class="status__content" *ngIf="!isContentWarned" <app-databinded-text class="status__content" *ngIf="!isContentWarned" [text]="displayedStatus.content"
[text]="displayedStatus.content" (accountSelected)="accountSelected($event)" (hashtagSelected)="hashtagSelected($event)"
(accountSelected)="accountSelected($event)"
(hashtagSelected)="hashtagSelected($event)"
(textSelected)="textSelected()"></app-databinded-text> (textSelected)="textSelected()"></app-databinded-text>
<app-attachements *ngIf="!isContentWarned && hasAttachments" class="attachments" [attachments]="displayedStatus.media_attachments"> <app-attachements *ngIf="!isContentWarned && hasAttachments" class="attachments"
[attachments]="displayedStatus.media_attachments">
</app-attachements> </app-attachements>
<app-action-bar #appActionBar <app-action-bar #appActionBar [statusWrapper]="statusWrapper" (cwIsActiveEvent)="changeCw($event)"
[statusWrapper]="statusWrapper"
(cwIsActiveEvent)="changeCw($event)"
(replyEvent)="openReply()"></app-action-bar> (replyEvent)="openReply()"></app-action-bar>
<app-reply-to-status *ngIf="replyingToStatus" [statusReplyingToWrapper]="statusWrapper" (onClose)="closeReply()"> <app-reply-to-status *ngIf="replyingToStatus" [statusReplyingToWrapper]="statusWrapper" (onClose)="closeReply()">

View File

@ -76,6 +76,9 @@
background-color: rgb(0, 136, 61); background-color: rgb(0, 136, 61);
background-color: rgb(0, 114, 51); background-color: rgb(0, 114, 51);
} }
&--discuss {
background-color: rgb(90, 0, 143);
}
} }
&__name { &__name {
display: inline-block; display: inline-block;

View File

@ -17,6 +17,7 @@ export class StatusComponent implements OnInit {
isCrossPoster: boolean; isCrossPoster: boolean;
isThread: boolean; isThread: boolean;
isContentWarned: boolean; isContentWarned: boolean;
hasReply: boolean;
contentWarningText: string; contentWarningText: string;
@Output() browseAccountEvent = new EventEmitter<string>(); @Output() browseAccountEvent = new EventEmitter<string>();
@ -29,10 +30,7 @@ export class StatusComponent implements OnInit {
@Input('statusWrapper') @Input('statusWrapper')
set statusWrapper(value: StatusWrapper) { set statusWrapper(value: StatusWrapper) {
this._statusWrapper = value; this._statusWrapper = value;
this.status = value.status; this.status = value.status;
this.checkLabels(this.status);
this.checkContentWarning(this.status);
if (this.status.reblog) { if (this.status.reblog) {
this.reblog = true; this.reblog = true;
@ -40,6 +38,9 @@ export class StatusComponent implements OnInit {
} else { } else {
this.displayedStatus = this.status; this.displayedStatus = this.status;
} }
this.checkLabels(this.displayedStatus);
this.checkContentWarning(this.displayedStatus);
if (!this.displayedStatus.account.display_name) { if (!this.displayedStatus.account.display_name) {
this.displayedStatus.account.display_name = this.displayedStatus.account.username; this.displayedStatus.account.display_name = this.displayedStatus.account.username;
@ -71,7 +72,7 @@ export class StatusComponent implements OnInit {
return false; return false;
} }
changeCw(cwIsActive: boolean){ changeCw(cwIsActive: boolean) {
this.isContentWarned = cwIsActive; this.isContentWarned = cwIsActive;
} }
@ -87,9 +88,11 @@ export class StatusComponent implements OnInit {
} }
} }
if (this.status.in_reply_to_account_id && this.status.in_reply_to_account_id === this.status.account.id) { if (status.in_reply_to_account_id && status.in_reply_to_account_id === status.account.id) {
this.isThread = true; this.isThread = true;
} }
this.hasReply = status.replies_count > 0;
} }
openAccount(account: Account): boolean { openAccount(account: Account): boolean {

View File

@ -131,7 +131,8 @@ export interface Status {
reblog: Status; reblog: Status;
content: string; content: string;
created_at: string; created_at: string;
reblogs_count: string; reblogs_count: number;
replies_count: number;
favourites_count: string; favourites_count: string;
reblogged: boolean; reblogged: boolean;
favourited: boolean; favourited: boolean;