Sengi-Windows-MacOS-Linux/src/app/components/stream/stream-edition/stream-edition.component.ts

39 lines
1.1 KiB
TypeScript

import { Component, OnInit, Input } from '@angular/core';
import { Store } from '@ngxs/store';
import { faChevronLeft, faChevronRight, faTimes } from "@fortawesome/free-solid-svg-icons";
import { StreamElement, RemoveStream, MoveStreamUp, MoveStreamDown } from '../../../states/streams.state';
@Component({
selector: 'app-stream-edition',
templateUrl: './stream-edition.component.html',
styleUrls: ['./stream-edition.component.scss']
})
export class StreamEditionComponent implements OnInit {
faChevronLeft = faChevronLeft;
faChevronRight = faChevronRight;
faTimes = faTimes;
@Input() streamElement: StreamElement;
constructor(private readonly store: Store) { }
ngOnInit() {
}
moveLeft(): boolean {
this.store.dispatch([new MoveStreamUp(this.streamElement.id)]);
return false;
}
moveRight(): boolean {
this.store.dispatch([new MoveStreamDown(this.streamElement.id)]);
return false;
}
delete(): boolean {
this.store.dispatch([new RemoveStream(this.streamElement.id)]);
return false;
}
}