This commit is contained in:
Nicolas Constant 2019-03-16 19:35:49 -04:00
parent 5b03f9d1d7
commit eb552028b0
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
4 changed files with 53 additions and 5 deletions

View File

@ -1,4 +1,8 @@
<div class="stream-toots flexcroll" #statusstream (scroll)="onScroll()">
<div class="stream-toots__remove-cw" *ngIf="isThread && hasContentWarnings">
<button class="stream-toots__remove-cw--button" (click)="removeCw()"
title="remove content warnings">Remove CWs</button>
</div>
<div *ngIf="displayError" class="stream-toots__error">{{displayError}}</div>
<!-- data-simplebar -->

View File

@ -1,19 +1,48 @@
@import "variables";
@import "commons";
@import "mixins";
.stream-toots {
height: calc(100%);
width: calc(100%);
overflow: auto;
&__error {
padding: 20px 20px 0 20px;
color: rgb(255, 113, 113);
}
&__status:not(:last-child) {
border: solid #06070b;
border-width: 0 0 1px 0;
}
&__remove-cw {
padding: 5px;
// border: solid #06070b;
// border-width: 0 0 1px 0;
height: 45px;
// width: calc(100%);
// position: relative;
&--button {
@include clearButton;
position: absolute;
z-index: 10;
padding: 3px;
text-align: center;
border: 2px $status-secondary-color dashed;
width: calc(80%);
margin-left: 40%;
transform: translateX(-40%);
transition: all .2s;
background-color: $color-secondary;
&:hover{
$hover-color: rgb(0, 206, 27);
$hover-color: rgb(0, 231, 231);
$hover-color: rgb(164, 222, 255);
// $hover-color: $status-secondary-color;
background-color: $hover-color;
color: black;
border: 3px $hover-color dashed;
}
}
}
}

View File

@ -21,6 +21,7 @@ export class StreamStatusesComponent implements OnInit, OnDestroy {
isLoading = true;
isThread = false;
displayError: string;
hasContentWarnings = false;
private _streamElement: StreamElement;
private account: AccountInfo;

View File

@ -1,4 +1,4 @@
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { Component, OnInit, Input, Output, EventEmitter, ViewChildren, QueryList } from '@angular/core';
import { HttpErrorResponse } from '@angular/common/http';
import { MastodonService } from '../../../services/mastodon.service';
@ -7,6 +7,7 @@ import { Results, Context, Status } from '../../../services/models/mastodon.inte
import { NotificationService } from '../../../services/notification.service';
import { AccountInfo } from '../../../states/accounts.state';
import { StatusWrapper } from '../../../models/common.model';
import { StatusComponent } from '../status/status.component';
@Component({
selector: 'app-thread',
@ -18,6 +19,7 @@ export class ThreadComponent implements OnInit {
displayError: string;
isLoading = true;
isThread = true;
hasContentWarnings = false;
private lastThreadEvent: OpenThreadEvent;
@ -33,6 +35,8 @@ export class ThreadComponent implements OnInit {
}
}
@ViewChildren(StatusComponent) statusChildren: QueryList<StatusComponent>;
constructor(
private readonly notificationService: NotificationService,
private readonly toolsService: ToolsService,
@ -86,6 +90,8 @@ export class ThreadComponent implements OnInit {
const wrapper = new StatusWrapper(s, currentAccount);
this.statuses.push(wrapper);
}
this.hasContentWarnings = this.statuses.filter(x => x.status.sensitive || x.status.spoiler_text).length > 1;
});
})
@ -119,4 +125,12 @@ export class ThreadComponent implements OnInit {
browseThread(openThreadEvent: OpenThreadEvent): void {
this.browseThreadEvent.next(openThreadEvent);
}
removeCw(){
const statuses = this.statusChildren.toArray();
statuses.forEach(x => {
x.removeContentWarning();
});
this.hasContentWarnings = false;
}
}