From 7ddd02c9b8c1e088f6679a2227f105e6439fc992 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 27 Jan 2017 16:14:11 +0100 Subject: Client: better notifications for a beautiful world --- client/src/app/videos/video-watch/video-report.component.ts | 11 ++++++----- client/src/app/videos/video-watch/video-watch.component.ts | 8 +++++--- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'client/src/app/videos/video-watch') diff --git a/client/src/app/videos/video-watch/video-report.component.ts b/client/src/app/videos/video-watch/video-report.component.ts index 7a125f53e..19a7af148 100644 --- a/client/src/app/videos/video-watch/video-report.component.ts +++ b/client/src/app/videos/video-watch/video-report.component.ts @@ -2,6 +2,7 @@ import { Component, Input, OnInit, ViewChild } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; import { ModalDirective } from 'ng2-bootstrap/modal'; +import { NotificationsService } from 'angular2-notifications'; import { FormReactive, VideoAbuseService, VIDEO_ABUSE_REASON } from '../../shared'; import { Video, VideoService } from '../shared'; @@ -26,7 +27,8 @@ export class VideoReportComponent extends FormReactive implements OnInit { constructor( private formBuilder: FormBuilder, - private videoAbuseService: VideoAbuseService + private videoAbuseService: VideoAbuseService, + private notificationsService: NotificationsService ) { super(); } @@ -56,13 +58,12 @@ export class VideoReportComponent extends FormReactive implements OnInit { this.videoAbuseService.reportVideo(this.video.id, reason) .subscribe( - // TODO: move alert to beautiful notifications - ok => { - alert('Video reported.'); + () => { + this.notificationsService.success('Success', 'Video reported.'); this.hide(); }, - err => alert(err.text) + err => this.notificationsService.error('Error', err.text); ) } } diff --git a/client/src/app/videos/video-watch/video-watch.component.ts b/client/src/app/videos/video-watch/video-watch.component.ts index 5cd7550be..c27133f74 100644 --- a/client/src/app/videos/video-watch/video-watch.component.ts +++ b/client/src/app/videos/video-watch/video-watch.component.ts @@ -1,8 +1,9 @@ import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; -import { MetaService } from 'ng2-meta'; import * as videojs from 'video.js'; +import { MetaService } from 'ng2-meta'; +import { NotificationsService } from 'angular2-notifications'; import { AuthService } from '../../core'; import { VideoMagnetComponent } from './video-magnet.component'; @@ -45,7 +46,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy { private videoService: VideoService, private metaService: MetaService, private webTorrentService: WebTorrentService, - private authService: AuthService + private authService: AuthService, + private notificationsService: NotificationsService ) {} ngOnInit() { @@ -117,7 +119,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { console.log('Added ' + this.video.magnetUri + '.'); torrent.files[0].renderTo(this.playerElement, { autoplay: true }, (err) => { if (err) { - alert('Cannot append the file.'); + this.notificationsService.error('Error', 'Cannot append the file in the video element.'); console.error(err); } }); -- cgit v1.2.3