From 313d85f03a78a68f1dc457a1aa0e26704721fd5f Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Fri, 16 Nov 2018 00:23:14 -0500 Subject: [PATCH] first wirering to navigate hashtags --- .../stream/hashtag/hashtag.component.html | 8 +++++--- .../stream/hashtag/hashtag.component.ts | 9 ++++++++- .../stream-overlay/stream-overlay.component.html | 2 +- .../stream-overlay/stream-overlay.component.ts | 15 ++++++++++----- src/app/components/stream/stream.component.ts | 2 +- 5 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/app/components/stream/hashtag/hashtag.component.html b/src/app/components/stream/hashtag/hashtag.component.html index d58c9b76..b3f676de 100644 --- a/src/app/components/stream/hashtag/hashtag.component.html +++ b/src/app/components/stream/hashtag/hashtag.component.html @@ -1,3 +1,5 @@ -

- hashtag works! -

+
+
hashtag
+ + +
\ No newline at end of file diff --git a/src/app/components/stream/hashtag/hashtag.component.ts b/src/app/components/stream/hashtag/hashtag.component.ts index 8de00dde..85d6a233 100644 --- a/src/app/components/stream/hashtag/hashtag.component.ts +++ b/src/app/components/stream/hashtag/hashtag.component.ts @@ -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', @@ -6,16 +9,20 @@ import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core'; styleUrls: ['./hashtag.component.scss'] }) export class HashtagComponent implements OnInit { - hashtag: string; + hashtag: string; @Output() browseAccount = new EventEmitter(); @Output() browseHashtag = new EventEmitter(); + @Input() hashtagElement: StreamElement; + @Input('currentHashtag') set currentAccount(hashtag: string) { this.hashtag = hashtag; } + goToTopSubject: Subject = new Subject(); + constructor() { } ngOnInit() { 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 b46a84b0..51e87387 100644 --- a/src/app/components/stream/stream-overlay/stream-overlay.component.html +++ b/src/app/components/stream/stream-overlay/stream-overlay.component.html @@ -10,6 +10,6 @@ --> - + \ No newline at end of file diff --git a/src/app/components/stream/stream-overlay/stream-overlay.component.ts b/src/app/components/stream/stream-overlay/stream-overlay.component.ts index ddb28cea..f43bfbbe 100644 --- a/src/app/components/stream/stream-overlay/stream-overlay.component.ts +++ b/src/app/components/stream/stream-overlay/stream-overlay.component.ts @@ -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) { diff --git a/src/app/components/stream/stream.component.ts b/src/app/components/stream/stream.component.ts index c0456de4..63a1d030 100644 --- a/src/app/components/stream/stream.component.ts +++ b/src/app/components/stream/stream.component.ts @@ -15,7 +15,7 @@ export class StreamComponent implements OnInit { overlayAccountToBrowse: string; overlayHashtagToBrowse: string; - private goToTopSubject: Subject = new Subject(); + goToTopSubject: Subject = new Subject(); @Input() streamElement: StreamElement;