first wirering to navigate hashtags
This commit is contained in:
parent
27d3507922
commit
313d85f03a
|
@ -1,3 +1,5 @@
|
|||
<p>
|
||||
hashtag works!
|
||||
</p>
|
||||
<div>
|
||||
<div>hashtag</div>
|
||||
|
||||
<app-stream-statuses *ngIf="hashtagElement" class="stream-hastag" [streamElement]="hashtagElement" [goToTop]="goToTopSubject.asObservable()" (browseAccount)="browseAccount($event)" (browseHashtag)="browseHashtag($event)"></app-stream-statuses>
|
||||
</div>
|
|
@ -1,4 +1,7 @@
|
|||
import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core';
|
||||
import { Subject } from 'rxjs';
|
||||
import { StreamElement } from '../../../states/streams.state';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-hashtag',
|
||||
|
@ -11,11 +14,15 @@ export class HashtagComponent implements OnInit {
|
|||
@Output() browseAccount = new EventEmitter<string>();
|
||||
@Output() browseHashtag = new EventEmitter<string>();
|
||||
|
||||
@Input() hashtagElement: StreamElement;
|
||||
|
||||
@Input('currentHashtag')
|
||||
set currentAccount(hashtag: string) {
|
||||
this.hashtag = hashtag;
|
||||
}
|
||||
|
||||
goToTopSubject: Subject<void> = new Subject<void>();
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
|
|
|
@ -10,6 +10,6 @@
|
|||
</div> -->
|
||||
|
||||
<app-user-profile *ngIf="accountName" [currentAccount]="accountName" (browseAccount)="accountSelected($event)" (browseHashtag)="hashtagSelected($event)"></app-user-profile>
|
||||
<app-hashtag *ngIf="browseHashtag"></app-hashtag>
|
||||
<app-hashtag *ngIf="hashtagElement" [hashtagElement]="hashtagElement"></app-hashtag>
|
||||
<app-thread *ngIf="browseThread"></app-thread>
|
||||
</div>
|
|
@ -2,6 +2,7 @@ import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core';
|
|||
import { Account, Results } from "../../../services/models/mastodon.interfaces";
|
||||
import { MastodonService } from '../../../services/mastodon.service';
|
||||
import { ToolsService } from '../../../services/tools.service';
|
||||
import { StreamElement, StreamTypeEnum } from '../../../states/streams.state';
|
||||
|
||||
@Component({
|
||||
selector: 'app-stream-overlay',
|
||||
|
@ -18,7 +19,8 @@ export class StreamOverlayComponent implements OnInit {
|
|||
|
||||
accountName: string;
|
||||
thread: string;
|
||||
hashtag: string;
|
||||
// hashtag: string;
|
||||
hashtagElement: StreamElement;
|
||||
|
||||
@Output() closeOverlay = new EventEmitter();
|
||||
|
||||
|
@ -39,7 +41,7 @@ export class StreamOverlayComponent implements OnInit {
|
|||
// this.hashtag = hashtag;
|
||||
}
|
||||
|
||||
constructor() { }
|
||||
constructor(private toolsService: ToolsService) { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
@ -112,7 +114,10 @@ export class StreamOverlayComponent implements OnInit {
|
|||
if (this.currentElement) {
|
||||
this.previousElements.push(this.currentElement);
|
||||
}
|
||||
const newElement = new OverlayBrowsing(hashtag, null, null);
|
||||
|
||||
const selectedAccount = this.toolsService.getSelectedAccounts()[0];
|
||||
const hashTagElement = new StreamElement(StreamTypeEnum.tag, hashtag, selectedAccount.id, hashtag, null);
|
||||
const newElement = new OverlayBrowsing(hashTagElement, null, null);
|
||||
this.loadElement(newElement);
|
||||
this.canGoForward = false;
|
||||
}
|
||||
|
@ -121,14 +126,14 @@ export class StreamOverlayComponent implements OnInit {
|
|||
this.currentElement = element;
|
||||
|
||||
this.accountName = this.currentElement.account;
|
||||
this.hashtag = this.currentElement.hashtag;
|
||||
this.thread = this.currentElement.thread;
|
||||
this.hashtagElement = this.currentElement.hashtag;
|
||||
}
|
||||
}
|
||||
|
||||
class OverlayBrowsing {
|
||||
constructor(
|
||||
public readonly hashtag: string,
|
||||
public readonly hashtag: StreamElement,
|
||||
public readonly account: string,
|
||||
public readonly thread: string) {
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ export class StreamComponent implements OnInit {
|
|||
overlayAccountToBrowse: string;
|
||||
overlayHashtagToBrowse: string;
|
||||
|
||||
private goToTopSubject: Subject<void> = new Subject<void>();
|
||||
goToTopSubject: Subject<void> = new Subject<void>();
|
||||
|
||||
@Input() streamElement: StreamElement;
|
||||
|
||||
|
|
Loading…
Reference in New Issue