added the possibility to append new hashtag to the columns

This commit is contained in:
Nicolas Constant 2018-12-11 22:23:03 -05:00
parent 143d445fcb
commit a87c2c19bb
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
4 changed files with 19 additions and 14 deletions

View File

@ -21,7 +21,7 @@
<div *ngIf="hashtags.length > 0" class="search-results">
<h3 class="search-results__title">Hashtags</h3>
<a (click)="selectHashtag(hashtag)" href *ngFor="let hashtag of hashtags" class="search-results__hashtag" title="add hashtag column">
<a (click)="selectHashtag(hashtag)" href *ngFor="let hashtag of hashtags" class="search-results__hashtag" title="browse hashtag">
#{{ hashtag }}
</a>
</div>

View File

@ -48,14 +48,14 @@ export class SearchComponent implements OnInit {
return false;
}
addHashtag(hashtag: string): boolean {
if (hashtag) {
const newStream = new StreamElement(StreamTypeEnum.tag, `#${hashtag}`, this.lastAccountUsed.id, hashtag, null);
this.store.dispatch([new AddStream(newStream)]);
}
// addHashtag(hashtag: string): boolean {
// if (hashtag) {
// const newStream = new StreamElement(StreamTypeEnum.tag, `#${hashtag}`, this.lastAccountUsed.id, hashtag, null);
// this.store.dispatch([new AddStream(newStream)]);
// }
return false;
}
// return false;
// }
selectAccount(accountName: string): boolean {
console.warn(accountName);

View File

@ -3,7 +3,7 @@
<a href (click)="goToTop()" class="hashtag-header__gototop" title="go to top">
<h3 class="hashtag-header__title">#{{hashtagElement.tag}}</h3>
<button class="btn-custom-secondary hashtag-header__add-column" (click)=" addColumn($event)" title="add column to board">add column</button>
<button class="btn-custom-secondary hashtag-header__add-column" (click)="addColumn($event)" title="add column to board">add column</button>
</a>
</div>
<app-stream-statuses class="hashtag-stream" *ngIf="hashtagElement" [streamElement]="hashtagElement" [goToTop]="goToTopSubject.asObservable()"

View File

@ -1,7 +1,8 @@
import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core';
import { Subject } from 'rxjs';
import { StreamElement } from '../../../states/streams.state';
import { Store } from '@ngxs/store';
import { StreamElement, StreamTypeEnum, AddStream } from '../../../states/streams.state';
@Component({
selector: 'app-hashtag',
@ -16,21 +17,25 @@ export class HashtagComponent implements OnInit {
goToTopSubject: Subject<void> = new Subject<void>();
constructor() { }
constructor(
private readonly store: Store) { }
ngOnInit() {
}
goToTop(): boolean{
goToTop(): boolean {
this.goToTopSubject.next();
return false;
}
addColumn(event): boolean {
event.stopPropagation();
console.log(`add column ${this.hashtagElement.tag}`)
return false;
const hashtag = this.hashtagElement.tag;
const newStream = new StreamElement(StreamTypeEnum.tag, `#${hashtag}`, this.hashtagElement.accountId, hashtag, null);
this.store.dispatch([new AddStream(newStream)]);
return false;
}
selectAccount(account: string) {