mirror of
https://github.com/NicolasConstant/sengi
synced 2025-02-09 08:28:40 +01:00
dispatching selection down to status (not working)
This commit is contained in:
parent
28ca6d7fa0
commit
c85eaee78b
@ -6,8 +6,8 @@
|
||||
<div *ngIf="displayError" class="stream-toots__error">{{displayError}}</div>
|
||||
|
||||
<!-- data-simplebar -->
|
||||
<div class="stream-toots__status" *ngFor="let statusWrapper of statuses">
|
||||
<app-status
|
||||
<div class="stream-toots__status" *ngFor="let statusWrapper of statuses" #status>
|
||||
<app-status
|
||||
[statusWrapper]="statusWrapper"
|
||||
[isThreadDisplay]="isThread"
|
||||
(browseAccountEvent)="browseAccount($event)"
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Component, OnInit, Input, ViewChild, ElementRef, OnDestroy, EventEmitter, Output } from '@angular/core';
|
||||
import { Component, OnInit, Input, ViewChild, ElementRef, OnDestroy, EventEmitter, Output, ViewChildren, QueryList } from '@angular/core';
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
import { Store } from '@ngxs/store';
|
||||
@ -17,7 +17,7 @@ import { StatusWrapper } from '../../../models/common.model';
|
||||
templateUrl: './stream-statuses.component.html',
|
||||
styleUrls: ['./stream-statuses.component.scss']
|
||||
})
|
||||
export class StreamStatusesComponent implements OnInit, OnDestroy {
|
||||
export class StreamStatusesComponent implements OnInit, OnDestroy {
|
||||
isLoading = true;
|
||||
isThread = false;
|
||||
displayError: string;
|
||||
@ -272,6 +272,22 @@ export class StreamStatusesComponent implements OnInit, OnDestroy {
|
||||
return regAccounts;
|
||||
}
|
||||
|
||||
@ViewChildren('status') private statusEls: QueryList<ElementRef>;
|
||||
focus(): boolean {
|
||||
// var element = this.statustream.nativeElement as HTMLElement;
|
||||
// element.click();
|
||||
console.warn(this.statusEls);
|
||||
console.warn(this.statusEls.toArray()[0].nativeElement);
|
||||
// this.statusEls.toArray()[0].elem.nativeElement.click();
|
||||
// this.statusEls.toArray()[0].nativeElement.focus();
|
||||
var element = this.statustream.nativeElement as HTMLElement;
|
||||
element.focus();
|
||||
element.click();
|
||||
element.dispatchEvent(new Event('click'));
|
||||
element.dispatchEvent(new Event('focus'));
|
||||
this.statusEls.toArray()[0].nativeElement.dispatchEvent(new Event('click'));
|
||||
return false;
|
||||
}
|
||||
|
||||
private retrieveToots(): void {
|
||||
this.mastodonService.getTimeline(this.account, this._streamElement.type, null, null, this.streamingService.nbStatusPerIteration, this._streamElement.tag, this._streamElement.listId)
|
||||
|
@ -6,6 +6,7 @@ import { StreamElement, StreamTypeEnum } from "../../states/streams.state";
|
||||
import { Status } from "../../services/models/mastodon.interfaces";
|
||||
import { AccountInfo } from "../../states/accounts.state";
|
||||
import { OpenThreadEvent } from "../../services/tools.service";
|
||||
import { StreamStatusesComponent } from './stream-statuses/stream-statuses.component';
|
||||
|
||||
@Component({
|
||||
selector: "app-stream",
|
||||
@ -25,6 +26,8 @@ export class StreamComponent implements OnInit {
|
||||
|
||||
private _streamElement: StreamElement;
|
||||
|
||||
@ViewChild(StreamStatusesComponent) private streamStatusesComponent: StreamStatusesComponent;
|
||||
|
||||
@Input('streamElement')
|
||||
set streamElement(stream: StreamElement) {
|
||||
switch (stream.type) {
|
||||
@ -57,6 +60,11 @@ export class StreamComponent implements OnInit {
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
focus(): boolean {
|
||||
this.streamStatusesComponent.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
goToTop(): boolean {
|
||||
this.goToTopSubject.next();
|
||||
return false;
|
||||
|
@ -4,6 +4,7 @@ import { Select } from "@ngxs/store";
|
||||
|
||||
import { StreamElement } from "../../states/streams.state";
|
||||
import { NavigationService } from "../../services/navigation.service";
|
||||
import { StreamComponent } from '../../components/stream/stream.component';
|
||||
|
||||
@Component({
|
||||
selector: "app-streams-main-display",
|
||||
@ -12,6 +13,7 @@ import { NavigationService } from "../../services/navigation.service";
|
||||
})
|
||||
export class StreamsMainDisplayComponent implements OnInit, OnDestroy {
|
||||
|
||||
@ViewChildren(StreamComponent) private streamComponents: QueryList<StreamComponent>;
|
||||
@Select(state => state.streamsstatemodel.streams) streamElements$: Observable<StreamElement[]>;
|
||||
private columnSelectedSub: Subscription;
|
||||
|
||||
@ -34,6 +36,9 @@ export class StreamsMainDisplayComponent implements OnInit, OnDestroy {
|
||||
if (columnIndex > -1) {
|
||||
setTimeout(() => {
|
||||
this.streamsElementRef.toArray()[columnIndex].nativeElement.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'start' });
|
||||
|
||||
console.warn(this.streamComponents);
|
||||
this.streamComponents.toArray()[columnIndex].focus();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user