diff --git a/src/app/app.module.ts b/src/app/app.module.ts index dd607cd4..6df66aef 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -84,6 +84,7 @@ import { environment } from '../environments/environment'; import { BookmarksComponent } from './components/floating-column/manage-account/bookmarks/bookmarks.component'; import { AttachementImageComponent } from './components/stream/status/attachements/attachement-image/attachement-image.component'; import { EnsureHttpsPipe } from './pipes/ensure-https.pipe'; +import { UserFollowsComponent } from './components/stream/user-follows/user-follows.component'; const routes: Routes = [ @@ -148,7 +149,8 @@ const routes: Routes = [ NotificationComponent, BookmarksComponent, AttachementImageComponent, - EnsureHttpsPipe + EnsureHttpsPipe, + UserFollowsComponent ], entryComponents: [ EmojiPickerComponent diff --git a/src/app/components/stream/stream-overlay/stream-overlay.component.html b/src/app/components/stream/stream-overlay/stream-overlay.component.html index dcb02f76..0ced8ea6 100644 --- a/src/app/components/stream/stream-overlay/stream-overlay.component.html +++ b/src/app/components/stream/stream-overlay/stream-overlay.component.html @@ -31,7 +31,16 @@ class="overlay__content" (browseAccountEvent)="browseAccount($event)" (browseHashtagEvent)="browseHashtag($event)" - (browseThreadEvent)="browseThread($event)"> + (browseThreadEvent)="browseThread($event)" + (browseFollowsEvent)="browseFollows($event)" + (browseFollowersEvent)="browseFollowers($event)"> + + user-follows works! +

diff --git a/src/app/components/stream/user-follows/user-follows.component.scss b/src/app/components/stream/user-follows/user-follows.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/src/app/components/stream/user-follows/user-follows.component.spec.ts b/src/app/components/stream/user-follows/user-follows.component.spec.ts new file mode 100644 index 00000000..d939b6f5 --- /dev/null +++ b/src/app/components/stream/user-follows/user-follows.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { UserFollowsComponent } from './user-follows.component'; + +xdescribe('UserFollowsComponent', () => { + let component: UserFollowsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ UserFollowsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(UserFollowsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/components/stream/user-follows/user-follows.component.ts b/src/app/components/stream/user-follows/user-follows.component.ts new file mode 100644 index 00000000..83daf842 --- /dev/null +++ b/src/app/components/stream/user-follows/user-follows.component.ts @@ -0,0 +1,81 @@ +import { Component, OnInit, Input, EventEmitter, Output, OnDestroy, ViewChild, ElementRef } from '@angular/core'; +import { Subscription } from 'rxjs'; + +@Component({ + selector: 'app-user-follows', + templateUrl: './user-follows.component.html', + styleUrls: ['./user-follows.component.scss'] +}) +export class UserFollowsComponent implements OnInit, OnDestroy { + + private _type: string; + private _currentAccount: string; + + @Input('type') + set setType(type: string) { + this._type = type; + this.load(this._type, this._currentAccount); + } + get setType(): string { + return this._type; + } + + @Input('currentAccount') + set currentAccount(accountName: string) { + this._currentAccount = accountName; + this.load(this._type, this._currentAccount); + } + get currentAccount(): string { + return this._currentAccount; + } + + @Input() refreshEventEmitter: EventEmitter; + @Input() goToTopEventEmitter: EventEmitter; + + @Output() browseAccountEvent = new EventEmitter(); + + @ViewChild('statusstream') public statustream: ElementRef; + + private refreshSubscription: Subscription; + private goToTopSubscription: Subscription; + + constructor() { } + + ngOnInit() { + if (this.refreshEventEmitter) { + this.refreshSubscription = this.refreshEventEmitter.subscribe(() => { + this.refresh(); + }) + } + + if (this.goToTopEventEmitter) { + this.goToTopSubscription = this.goToTopEventEmitter.subscribe(() => { + this.goToTop(); + }) + } + } + + ngOnDestroy(): void { + if (this.refreshSubscription) this.refreshSubscription.unsubscribe(); + if (this.goToTopSubscription) this.goToTopSubscription.unsubscribe(); + } + + private load(type: string, accountName: string) { + if (type && accountName) { + console.warn(`type: ${type} account ${accountName}`); + } + } + + refresh(): any { + } + + goToTop(): any { + const stream = this.statustream.nativeElement as HTMLElement; + setTimeout(() => { + stream.scrollTo({ + top: 0, + behavior: 'smooth' + }); + }, 0); + } +} diff --git a/src/app/components/stream/user-profile/user-profile.component.html b/src/app/components/stream/user-profile/user-profile.component.html index 55ff8424..a0796d87 100644 --- a/src/app/components/stream/user-profile/user-profile.component.html +++ b/src/app/components/stream/user-profile/user-profile.component.html @@ -121,6 +121,11 @@ target="_blank" title="{{displayedAccount.acct}}">@{{displayedAccount.acct}} + +