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