Sengi-Windows-MacOS-Linux/src/app/components/floating-column/manage-account/manage-account.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({
2018-09-22 06:22:51 +02:00
selector: 'app-manage-account',
templateUrl: './manage-account.component.html',
styleUrls: ['./manage-account.component.scss']
2018-09-10 03:55:16 +02:00
})
2018-09-22 06:22:51 +02:00
export class ManageAccountComponent 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-11-03 06:38:52 +01:00
this.availableStreams.push(new StreamElement(StreamTypeEnum.global, 'Global Timeline', this.account.info.id, null, null));
this.availableStreams.push(new StreamElement(StreamTypeEnum.local, 'Local Timeline', this.account.info.id, null, null));
this.availableStreams.push(new StreamElement(StreamTypeEnum.personnal, 'Personnal Timeline', this.account.info.id, null, null));
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;
}
}