added gototop on profile, fix #259
This commit is contained in:
parent
6f96de22ce
commit
54bce7762e
|
@ -127,4 +127,15 @@ export class BookmarksComponent implements OnInit {
|
||||||
browseThread(openThreadEvent: OpenThreadEvent): void {
|
browseThread(openThreadEvent: OpenThreadEvent): void {
|
||||||
this.browseThreadEvent.next(openThreadEvent);
|
this.browseThreadEvent.next(openThreadEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
applyGoToTop(): boolean {
|
||||||
|
const stream = this.statustream.nativeElement as HTMLElement;
|
||||||
|
setTimeout(() => {
|
||||||
|
stream.scrollTo({
|
||||||
|
top: 0,
|
||||||
|
behavior: 'smooth'
|
||||||
|
});
|
||||||
|
}, 0);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,6 +121,17 @@ export class DirectMessagesComponent implements OnInit {
|
||||||
browseThread(openThreadEvent: OpenThreadEvent): void {
|
browseThread(openThreadEvent: OpenThreadEvent): void {
|
||||||
this.browseThreadEvent.next(openThreadEvent);
|
this.browseThreadEvent.next(openThreadEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
applyGoToTop(): boolean {
|
||||||
|
const stream = this.statustream.nativeElement as HTMLElement;
|
||||||
|
setTimeout(() => {
|
||||||
|
stream.scrollTo({
|
||||||
|
top: 0,
|
||||||
|
behavior: 'smooth'
|
||||||
|
});
|
||||||
|
}, 0);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ConversationWrapper {
|
class ConversationWrapper {
|
||||||
|
|
|
@ -128,4 +128,15 @@ export class FavoritesComponent implements OnInit {
|
||||||
browseThread(openThreadEvent: OpenThreadEvent): void {
|
browseThread(openThreadEvent: OpenThreadEvent): void {
|
||||||
this.browseThreadEvent.next(openThreadEvent);
|
this.browseThreadEvent.next(openThreadEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
applyGoToTop(): boolean {
|
||||||
|
const stream = this.statustream.nativeElement as HTMLElement;
|
||||||
|
setTimeout(() => {
|
||||||
|
stream.scrollTo({
|
||||||
|
top: 0,
|
||||||
|
behavior: 'smooth'
|
||||||
|
});
|
||||||
|
}, 0);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,20 +35,20 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<app-bookmarks class="account__body" *ngIf="subPanel === 'bookmarks'" [account]="account"
|
<app-bookmarks #bookmarks class="account__body" *ngIf="subPanel === 'bookmarks'" [account]="account"
|
||||||
(browseAccountEvent)="browseAccount($event)" (browseHashtagEvent)="browseHashtag($event)"
|
(browseAccountEvent)="browseAccount($event)" (browseHashtagEvent)="browseHashtag($event)"
|
||||||
(browseThreadEvent)="browseThread($event)"></app-bookmarks>
|
(browseThreadEvent)="browseThread($event)"></app-bookmarks>
|
||||||
<app-direct-messages class="account__body" *ngIf="subPanel === 'dm'" [account]="account"
|
<app-direct-messages #dm class="account__body" *ngIf="subPanel === 'dm'" [account]="account"
|
||||||
(browseAccountEvent)="browseAccount($event)" (browseHashtagEvent)="browseHashtag($event)"
|
(browseAccountEvent)="browseAccount($event)" (browseHashtagEvent)="browseHashtag($event)"
|
||||||
(browseThreadEvent)="browseThread($event)"></app-direct-messages>
|
(browseThreadEvent)="browseThread($event)"></app-direct-messages>
|
||||||
<app-favorites class="account__body" *ngIf="subPanel === 'favorites'" [account]="account"
|
<app-favorites #favorites class="account__body" *ngIf="subPanel === 'favorites'" [account]="account"
|
||||||
(browseAccountEvent)="browseAccount($event)" (browseHashtagEvent)="browseHashtag($event)"
|
(browseAccountEvent)="browseAccount($event)" (browseHashtagEvent)="browseHashtag($event)"
|
||||||
(browseThreadEvent)="browseThread($event)"></app-favorites>
|
(browseThreadEvent)="browseThread($event)"></app-favorites>
|
||||||
<app-mentions class="account__body" *ngIf="subPanel === 'mentions'" [account]="account"
|
<app-mentions #mentions class="account__body" *ngIf="subPanel === 'mentions'" [account]="account"
|
||||||
(browseAccountEvent)="browseAccount($event)" (browseHashtagEvent)="browseHashtag($event)"
|
(browseAccountEvent)="browseAccount($event)" (browseHashtagEvent)="browseHashtag($event)"
|
||||||
(browseThreadEvent)="browseThread($event)"></app-mentions>
|
(browseThreadEvent)="browseThread($event)"></app-mentions>
|
||||||
<app-my-account class="account__body" *ngIf="subPanel === 'account'" [account]="account"></app-my-account>
|
<app-my-account class="account__body" *ngIf="subPanel === 'account'" [account]="account"></app-my-account>
|
||||||
<app-notifications class="account__body" *ngIf="subPanel === 'notifications'" [account]="account"
|
<app-notifications #notifications class="account__body" *ngIf="subPanel === 'notifications'" [account]="account"
|
||||||
(browseAccountEvent)="browseAccount($event)" (browseHashtagEvent)="browseHashtag($event)"
|
(browseAccountEvent)="browseAccount($event)" (browseHashtagEvent)="browseHashtag($event)"
|
||||||
(browseThreadEvent)="browseThread($event)"></app-notifications>
|
(browseThreadEvent)="browseThread($event)"></app-notifications>
|
||||||
</div>
|
</div>
|
|
@ -1,4 +1,4 @@
|
||||||
import { Component, OnInit, OnDestroy, Input, Output, EventEmitter } from '@angular/core';
|
import { Component, OnInit, OnDestroy, Input, Output, EventEmitter, ViewChild } from '@angular/core';
|
||||||
import { faAt, faUserPlus } from "@fortawesome/free-solid-svg-icons";
|
import { faAt, faUserPlus } from "@fortawesome/free-solid-svg-icons";
|
||||||
import { faBell, faEnvelope, faUser, faStar, faBookmark } from "@fortawesome/free-regular-svg-icons";
|
import { faBell, faEnvelope, faUser, faStar, faBookmark } from "@fortawesome/free-regular-svg-icons";
|
||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
|
@ -10,6 +10,11 @@ import { MastodonWrapperService } from '../../../services/mastodon-wrapper.servi
|
||||||
import { Account } from "../../../services/models/mastodon.interfaces";
|
import { Account } from "../../../services/models/mastodon.interfaces";
|
||||||
import { NotificationService } from '../../../services/notification.service';
|
import { NotificationService } from '../../../services/notification.service';
|
||||||
import { AccountInfo } from '../../../states/accounts.state';
|
import { AccountInfo } from '../../../states/accounts.state';
|
||||||
|
import { BookmarksComponent } from './bookmarks/bookmarks.component';
|
||||||
|
import { NotificationsComponent } from './notifications/notifications.component';
|
||||||
|
import { MentionsComponent } from './mentions/mentions.component';
|
||||||
|
import { DirectMessagesComponent } from './direct-messages/direct-messages.component';
|
||||||
|
import { FavoritesComponent } from './favorites/favorites.component';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -122,8 +127,36 @@ export class ManageAccountComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loadSubPanel(subpanel: 'account' | 'notifications' | 'mentions' | 'dm' | 'favorites'): boolean {
|
@ViewChild('bookmarks') bookmarksComp:BookmarksComponent;
|
||||||
|
@ViewChild('notifications') notificationsComp:NotificationsComponent;
|
||||||
|
@ViewChild('mentions') mentionsComp:MentionsComponent;
|
||||||
|
@ViewChild('dm') dmComp:DirectMessagesComponent;
|
||||||
|
@ViewChild('favorites') favoritesComp:FavoritesComponent;
|
||||||
|
|
||||||
|
loadSubPanel(subpanel: 'account' | 'notifications' | 'mentions' | 'dm' | 'favorites' | 'bookmarks'): boolean {
|
||||||
|
if(this.subPanel === subpanel){
|
||||||
|
switch(subpanel){
|
||||||
|
case 'bookmarks':
|
||||||
|
this.bookmarksComp.applyGoToTop();
|
||||||
|
break;
|
||||||
|
case 'notifications':
|
||||||
|
this.notificationsComp.applyGoToTop();
|
||||||
|
break;
|
||||||
|
case 'mentions':
|
||||||
|
this.mentionsComp.applyGoToTop();
|
||||||
|
break;
|
||||||
|
case 'dm':
|
||||||
|
this.dmComp.applyGoToTop();
|
||||||
|
break;
|
||||||
|
case 'favorites':
|
||||||
|
this.favoritesComp.applyGoToTop();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
console.log('gototop');
|
||||||
|
}
|
||||||
|
|
||||||
this.subPanel = subpanel;
|
this.subPanel = subpanel;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -146,4 +146,15 @@ export class MentionsComponent implements OnInit, OnDestroy {
|
||||||
browseThread(openThreadEvent: OpenThreadEvent): void {
|
browseThread(openThreadEvent: OpenThreadEvent): void {
|
||||||
this.browseThreadEvent.next(openThreadEvent);
|
this.browseThreadEvent.next(openThreadEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
applyGoToTop(): boolean {
|
||||||
|
const stream = this.statustream.nativeElement as HTMLElement;
|
||||||
|
setTimeout(() => {
|
||||||
|
stream.scrollTo({
|
||||||
|
top: 0,
|
||||||
|
behavior: 'smooth'
|
||||||
|
});
|
||||||
|
}, 0);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,6 +135,17 @@ export class NotificationsComponent implements OnInit, OnDestroy {
|
||||||
browseThread(openThreadEvent: OpenThreadEvent): void {
|
browseThread(openThreadEvent: OpenThreadEvent): void {
|
||||||
this.browseThreadEvent.next(openThreadEvent);
|
this.browseThreadEvent.next(openThreadEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
applyGoToTop(): boolean {
|
||||||
|
const stream = this.statustream.nativeElement as HTMLElement;
|
||||||
|
setTimeout(() => {
|
||||||
|
stream.scrollTo({
|
||||||
|
top: 0,
|
||||||
|
behavior: 'smooth'
|
||||||
|
});
|
||||||
|
}, 0);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class NotificationWrapper {
|
export class NotificationWrapper {
|
||||||
|
|
Loading…
Reference in New Issue