]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/videos/video-list/video-miniature.component.ts
Client: clear timeout error timer for video watch
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / video-list / video-miniature.component.ts
CommitLineData
501bc6c2 1import { DatePipe } from '@angular/common';
41a2aee3 2import { Component, Input, Output, EventEmitter } from '@angular/core';
00a44645 3import { ROUTER_DIRECTIVES } from '@angular/router';
501bc6c2 4
bddab65a 5import { SortField, Video, VideoService } from '../shared';
4a6995be 6import { User } from '../../shared';
501bc6c2
C
7
8@Component({
9 selector: 'my-video-miniature',
4a6995be
C
10 styles: [ require('./video-miniature.component.scss') ],
11 template: require('./video-miniature.component.html'),
501bc6c2
C
12 directives: [ ROUTER_DIRECTIVES ],
13 pipes: [ DatePipe ]
14})
15
16export class VideoMiniatureComponent {
17 @Output() removed = new EventEmitter<any>();
18
bddab65a 19 @Input() currentSort: SortField;
501bc6c2 20 @Input() user: User;
4fd8aa32 21 @Input() video: Video;
501bc6c2 22
ccf6ed16 23 hovering = false;
501bc6c2 24
ccf6ed16 25 constructor(private videoService: VideoService) {}
501bc6c2 26
4fd8aa32
C
27 displayRemoveIcon() {
28 return this.hovering && this.video.isRemovableBy(this.user);
501bc6c2
C
29 }
30
31 onBlur() {
32 this.hovering = false;
33 }
34
4fd8aa32
C
35 onHover() {
36 this.hovering = true;
501bc6c2
C
37 }
38
39 removeVideo(id: string) {
40 if (confirm('Do you really want to remove this video?')) {
ccf6ed16 41 this.videoService.removeVideo(id).subscribe(
501bc6c2
C
42 status => this.removed.emit(true),
43 error => alert(error)
44 );
45 }
46 }
47}