Sengi-Windows-MacOS-Linux/src/app/components/floating-column/columns-editor/columns-editor.component.ts

33 lines
1.2 KiB
TypeScript
Raw Normal View History

2018-09-10 03:55:16 +02:00
import { Component, OnInit, Input } from '@angular/core';
import { StreamElement, StreamTypeEnum, AddStream } from '../../../states/streams.state';
import { Store } from '@ngxs/store';
2018-09-11 07:54:23 +02:00
import { AccountsStateModel, AccountInfo } from '../../../states/accounts.state';
import { AccountWrapper } from '../../../models/account.models';
2018-09-10 03:55:16 +02:00
@Component({
selector: 'app-columns-editor',
templateUrl: './columns-editor.component.html',
styleUrls: ['./columns-editor.component.scss']
})
export class ColumnsEditorComponent implements OnInit {
2018-09-11 07:54:23 +02:00
@Input() account: AccountWrapper;
2018-09-10 03:55:16 +02:00
availableStreams: StreamElement[] = [];
2018-09-10 03:55:16 +02:00
constructor(private readonly store: Store) { }
2018-09-10 03:55:16 +02:00
ngOnInit() {
this.availableStreams.length = 0;
2018-09-11 07:54:23 +02:00
this.availableStreams.push(new StreamElement(StreamTypeEnum.global, 'Global Timeline', this.account.username));
this.availableStreams.push(new StreamElement(StreamTypeEnum.local, 'Local Timeline', this.account.username));
this.availableStreams.push(new StreamElement(StreamTypeEnum.personnal, 'Personnal Timeline', this.account.username));
2018-09-10 03:55:16 +02:00
}
addStream(stream: StreamElement): boolean {
if (stream) {
this.store.dispatch([new AddStream(stream)]);
}
2018-09-10 03:55:16 +02:00
return false;
}
}