added loading animation for thread loading

This commit is contained in:
Nicolas Constant 2019-01-27 23:29:17 -05:00
parent 2970dfd8d8
commit 8624a2f954
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
5 changed files with 10 additions and 7 deletions

View File

@ -1,6 +1,9 @@
<div class="stream-toots flexcroll" #statusstream (scroll)="onScroll()">
<app-waiting-animation *ngIf="isLoading" class="waiting-icon"></app-waiting-animation>
<!-- data-simplebar -->
<div class="stream-toots__status" *ngFor="let statusWrapper of statuses">
<app-status [statusWrapper]="statusWrapper" (browseAccountEvent)="browseAccount($event)" (browseHashtagEvent)="browseHashtag($event)" (browseThreadEvent)="browseThread($event)"></app-status>
<app-status [statusWrapper]="statusWrapper" (browseAccountEvent)="browseAccount($event)" (browseHashtagEvent)="browseHashtag($event)"
(browseThreadEvent)="browseThread($event)"></app-status>
</div>
</div>
</div>

View File

@ -16,6 +16,7 @@ import { StatusWrapper } from '../stream.component';
styleUrls: ['./stream-statuses.component.scss']
})
export class StreamStatusesComponent implements OnInit, OnDestroy {
private isLoading = false; //TODO
private _streamElement: StreamElement;
private account: AccountInfo;

View File

@ -1,5 +0,0 @@
<p>
thread works!
{{ thread }}
</p>

View File

@ -11,6 +11,7 @@ import { Status, Results, Context } from '../../../services/models/mastodon.inte
})
export class ThreadComponent implements OnInit {
statuses: StatusWrapper[] = [];
private isLoading: boolean;
@Output() browseAccountEvent = new EventEmitter<string>();
@Output() browseHashtagEvent = new EventEmitter<string>();
@ -19,6 +20,7 @@ export class ThreadComponent implements OnInit {
@Input('currentThread')
set currentThread(thread: string) {
if (thread) {
this.isLoading = true;
this.getThread(thread);
}
}
@ -41,6 +43,7 @@ export class ThreadComponent implements OnInit {
const retrievedStatus = result.statuses[0];
this.mastodonService.getStatusContext(currentAccount, retrievedStatus.id)
.then((context: Context) => {
this.isLoading = false;
let contextStatuses = [...context.ancestors, retrievedStatus, ...context.descendants]
for (const s of contextStatuses) {
@ -50,6 +53,7 @@ export class ThreadComponent implements OnInit {
});
} else {
//TODO handle error
this.isLoading = false;
console.error('could not retrieve status');
}
});