From 1f0215a908c3b447cef03c10d4b089c0788922bd Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 5 May 2017 16:08:43 +0200 Subject: Client: little refractoring --- client/src/app/+admin/friends/friends.component.ts | 2 +- client/src/app/+admin/users/shared/user.service.ts | 1 - .../users/user-list/user-list.component.scss | 4 -- client/src/app/+admin/users/users.component.ts | 2 +- client/src/app/+admin/users/users.routes.ts | 50 +++++++++++----------- .../video-abuse-list.component.scss | 7 --- .../video-abuse-list/video-abuse-list.component.ts | 3 +- .../app/+admin/video-abuses/video-abuses.routes.ts | 36 ++++++++-------- client/src/app/core/menu/menu-admin.component.html | 1 - client/src/app/videos/shared/index.ts | 1 - client/src/app/videos/shared/loader/index.ts | 1 - .../app/videos/shared/loader/loader.component.html | 3 -- .../app/videos/shared/loader/loader.component.scss | 22 ---------- .../app/videos/shared/loader/loader.component.ts | 11 ----- client/src/app/videos/video-list/index.ts | 1 + .../app/videos/video-list/loader.component.html | 3 ++ .../app/videos/video-list/loader.component.scss | 22 ++++++++++ .../src/app/videos/video-list/loader.component.ts | 11 +++++ .../videos/video-list/video-list.component.scss | 13 ------ .../app/videos/video-list/video-list.component.ts | 5 --- .../video-list/video-miniature.component.html | 2 +- .../video-list/video-miniature.component.scss | 5 +-- .../videos/video-list/video-miniature.component.ts | 10 ----- .../videos/video-watch/video-watch.component.html | 2 + .../videos/video-watch/video-watch.component.scss | 10 ++--- client/src/app/videos/videos.module.ts | 4 +- 26 files changed, 93 insertions(+), 139 deletions(-) delete mode 100644 client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.scss delete mode 100644 client/src/app/videos/shared/loader/index.ts delete mode 100644 client/src/app/videos/shared/loader/loader.component.html delete mode 100644 client/src/app/videos/shared/loader/loader.component.scss delete mode 100644 client/src/app/videos/shared/loader/loader.component.ts create mode 100644 client/src/app/videos/video-list/loader.component.html create mode 100644 client/src/app/videos/video-list/loader.component.scss create mode 100644 client/src/app/videos/video-list/loader.component.ts (limited to 'client/src') diff --git a/client/src/app/+admin/friends/friends.component.ts b/client/src/app/+admin/friends/friends.component.ts index bc3f54158..5ca29111c 100644 --- a/client/src/app/+admin/friends/friends.component.ts +++ b/client/src/app/+admin/friends/friends.component.ts @@ -1,7 +1,7 @@ import { Component } from '@angular/core'; @Component({ - template: '' + template: '' }) export class FriendsComponent { diff --git a/client/src/app/+admin/users/shared/user.service.ts b/client/src/app/+admin/users/shared/user.service.ts index a92f9c231..da540bf9f 100644 --- a/client/src/app/+admin/users/shared/user.service.ts +++ b/client/src/app/+admin/users/shared/user.service.ts @@ -6,7 +6,6 @@ import { AuthHttp, RestExtractor, RestDataSource, User } from '../../../shared'; @Injectable() export class UserService { - // TODO: merge this constant with account private static BASE_USERS_URL = '/api/v1/users/'; constructor( diff --git a/client/src/app/+admin/users/user-list/user-list.component.scss b/client/src/app/+admin/users/user-list/user-list.component.scss index e9f61e900..71adef653 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.scss +++ b/client/src/app/+admin/users/user-list/user-list.component.scss @@ -1,7 +1,3 @@ -.glyphicon-remove { - cursor: pointer; -} - .add-user { margin-top: 10px; } diff --git a/client/src/app/+admin/users/users.component.ts b/client/src/app/+admin/users/users.component.ts index 37e3b158d..91af6c320 100644 --- a/client/src/app/+admin/users/users.component.ts +++ b/client/src/app/+admin/users/users.component.ts @@ -1,7 +1,7 @@ import { Component } from '@angular/core'; @Component({ - template: '' + template: '' }) export class UsersComponent { diff --git a/client/src/app/+admin/users/users.routes.ts b/client/src/app/+admin/users/users.routes.ts index ac64c891f..21fb192e0 100644 --- a/client/src/app/+admin/users/users.routes.ts +++ b/client/src/app/+admin/users/users.routes.ts @@ -6,32 +6,32 @@ import { UserListComponent } from './user-list'; export const UsersRoutes: Routes = [ { - path: 'users', - component: UsersComponent, - children: [ - { - path: '', - redirectTo: 'list', - pathMatch: 'full' - }, - { - path: 'list', - component: UserListComponent, - data: { - meta: { - title: 'Users list' - } + path: 'users', + component: UsersComponent, + children: [ + { + path: '', + redirectTo: 'list', + pathMatch: 'full' + }, + { + path: 'list', + component: UserListComponent, + data: { + meta: { + title: 'Users list' } - }, - { - path: 'add', - component: UserAddComponent, - data: { - meta: { - title: 'Add a user' - } + } + }, + { + path: 'add', + component: UserAddComponent, + data: { + meta: { + title: 'Add a user' } } - ] - } + } + ] + } ]; diff --git a/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.scss b/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.scss deleted file mode 100644 index a094f74b8..000000000 --- a/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.scss +++ /dev/null @@ -1,7 +0,0 @@ -.cell-id { - width: 40px; -} - -.cell-reason { - width: 200px; -} diff --git a/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts b/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts index f59c4fffb..55d82f790 100644 --- a/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts +++ b/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts @@ -6,8 +6,7 @@ import { Utils, VideoAbuseService, VideoAbuse } from '../../../shared'; @Component({ selector: 'my-video-abuse-list', - templateUrl: './video-abuse-list.component.html', - styleUrls: [ './video-abuse-list.component.scss' ] + templateUrl: './video-abuse-list.component.html' }) export class VideoAbuseListComponent { videoAbusesSource = null; diff --git a/client/src/app/+admin/video-abuses/video-abuses.routes.ts b/client/src/app/+admin/video-abuses/video-abuses.routes.ts index c99e162be..1f19d7885 100644 --- a/client/src/app/+admin/video-abuses/video-abuses.routes.ts +++ b/client/src/app/+admin/video-abuses/video-abuses.routes.ts @@ -5,24 +5,24 @@ import { VideoAbuseListComponent } from './video-abuse-list'; export const VideoAbusesRoutes: Routes = [ { - path: 'video-abuses', - component: VideoAbusesComponent - , - children: [ - { - path: '', - redirectTo: 'list', - pathMatch: 'full' - }, - { - path: 'list', - component: VideoAbuseListComponent, - data: { - meta: { - title: 'Video abuses list' - } + path: 'video-abuses', + component: VideoAbusesComponent + , + children: [ + { + path: '', + redirectTo: 'list', + pathMatch: 'full' + }, + { + path: 'list', + component: VideoAbuseListComponent, + data: { + meta: { + title: 'Video abuses list' } } - ] - } + } + ] + } ]; diff --git a/client/src/app/core/menu/menu-admin.component.html b/client/src/app/core/menu/menu-admin.component.html index 027799ee1..0dfe22d84 100644 --- a/client/src/app/core/menu/menu-admin.component.html +++ b/client/src/app/core/menu/menu-admin.component.html @@ -1,5 +1,4 @@ -
diff --git a/client/src/app/videos/shared/index.ts b/client/src/app/videos/shared/index.ts index beaa528c0..a68491022 100644 --- a/client/src/app/videos/shared/index.ts +++ b/client/src/app/videos/shared/index.ts @@ -1,4 +1,3 @@ -export * from './loader'; export * from './sort-field.type'; export * from './rate-type.type'; export * from './video.model'; diff --git a/client/src/app/videos/shared/loader/index.ts b/client/src/app/videos/shared/loader/index.ts deleted file mode 100644 index ab22584e4..000000000 --- a/client/src/app/videos/shared/loader/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './loader.component'; diff --git a/client/src/app/videos/shared/loader/loader.component.html b/client/src/app/videos/shared/loader/loader.component.html deleted file mode 100644 index 38d06950e..000000000 --- a/client/src/app/videos/shared/loader/loader.component.html +++ /dev/null @@ -1,3 +0,0 @@ -
-
-
diff --git a/client/src/app/videos/shared/loader/loader.component.scss b/client/src/app/videos/shared/loader/loader.component.scss deleted file mode 100644 index 44cf1f9da..000000000 --- a/client/src/app/videos/shared/loader/loader.component.scss +++ /dev/null @@ -1,22 +0,0 @@ -// Thanks https://gist.github.com/alexandrevicenzi/680147013e902a4eaa5d -.glyphicon-refresh-animate { - -animation: spin .7s infinite linear; - -ms-animation: spin .7s infinite linear; - -webkit-animation: spinw .7s infinite linear; - -moz-animation: spinm .7s infinite linear; -} - -@keyframes spin { - from { transform: scale(1) rotate(0deg);} - to { transform: scale(1) rotate(360deg);} -} - -@-webkit-keyframes spinw { - from { -webkit-transform: rotate(0deg);} - to { -webkit-transform: rotate(360deg);} -} - -@-moz-keyframes spinm { - from { -moz-transform: rotate(0deg);} - to { -moz-transform: rotate(360deg);} -} diff --git a/client/src/app/videos/shared/loader/loader.component.ts b/client/src/app/videos/shared/loader/loader.component.ts deleted file mode 100644 index e72d2f3f3..000000000 --- a/client/src/app/videos/shared/loader/loader.component.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Component, Input } from '@angular/core'; - -@Component({ - selector: 'my-loader', - styleUrls: [ './loader.component.scss' ], - templateUrl: './loader.component.html' -}) - -export class LoaderComponent { - @Input() loading: boolean; -} diff --git a/client/src/app/videos/video-list/index.ts b/client/src/app/videos/video-list/index.ts index 1f6d6a4e7..71d3b78e6 100644 --- a/client/src/app/videos/video-list/index.ts +++ b/client/src/app/videos/video-list/index.ts @@ -1,3 +1,4 @@ +export * from './loader.component'; export * from './video-list.component'; export * from './video-miniature.component'; export * from './video-sort.component'; diff --git a/client/src/app/videos/video-list/loader.component.html b/client/src/app/videos/video-list/loader.component.html new file mode 100644 index 000000000..38d06950e --- /dev/null +++ b/client/src/app/videos/video-list/loader.component.html @@ -0,0 +1,3 @@ +
+
+
diff --git a/client/src/app/videos/video-list/loader.component.scss b/client/src/app/videos/video-list/loader.component.scss new file mode 100644 index 000000000..44cf1f9da --- /dev/null +++ b/client/src/app/videos/video-list/loader.component.scss @@ -0,0 +1,22 @@ +// Thanks https://gist.github.com/alexandrevicenzi/680147013e902a4eaa5d +.glyphicon-refresh-animate { + -animation: spin .7s infinite linear; + -ms-animation: spin .7s infinite linear; + -webkit-animation: spinw .7s infinite linear; + -moz-animation: spinm .7s infinite linear; +} + +@keyframes spin { + from { transform: scale(1) rotate(0deg);} + to { transform: scale(1) rotate(360deg);} +} + +@-webkit-keyframes spinw { + from { -webkit-transform: rotate(0deg);} + to { -webkit-transform: rotate(360deg);} +} + +@-moz-keyframes spinm { + from { -moz-transform: rotate(0deg);} + to { -moz-transform: rotate(360deg);} +} diff --git a/client/src/app/videos/video-list/loader.component.ts b/client/src/app/videos/video-list/loader.component.ts new file mode 100644 index 000000000..e72d2f3f3 --- /dev/null +++ b/client/src/app/videos/video-list/loader.component.ts @@ -0,0 +1,11 @@ +import { Component, Input } from '@angular/core'; + +@Component({ + selector: 'my-loader', + styleUrls: [ './loader.component.scss' ], + templateUrl: './loader.component.html' +}) + +export class LoaderComponent { + @Input() loading: boolean; +} diff --git a/client/src/app/videos/video-list/video-list.component.scss b/client/src/app/videos/video-list/video-list.component.scss index b48a4f125..4b4409602 100644 --- a/client/src/app/videos/video-list/video-list.component.scss +++ b/client/src/app/videos/video-list/video-list.component.scss @@ -23,19 +23,6 @@ my-video-miniature { text-align: left; - transition: all 0.5s ease; - - &.ng-enter { - opacity: 0; - } - - &.ng-enter-active { - opacity: 1; - } - - &.ng-leave { - opacity: 0; - } } .no-video { diff --git a/client/src/app/videos/video-list/video-list.component.ts b/client/src/app/videos/video-list/video-list.component.ts index 16e1b5bcc..16a40bdc4 100644 --- a/client/src/app/videos/video-list/video-list.component.ts +++ b/client/src/app/videos/video-list/video-list.component.ts @@ -76,10 +76,7 @@ export class VideoListComponent implements OnInit, OnDestroy { this.loading.next(true); this.videos = []; - this.changeDetector.detectChanges(); - let observable = null; - if (this.search.value) { observable = this.videoService.searchVideos(this.search, this.pagination, this.sort); } else { @@ -150,8 +147,6 @@ export class VideoListComponent implements OnInit, OnDestroy { } else { this.pagination.currentPage = 1; } - - this.changeDetector.detectChanges(); } private navigateToNewParams() { diff --git a/client/src/app/videos/video-list/video-miniature.component.html b/client/src/app/videos/video-list/video-miniature.component.html index 1d3451c2b..648ef61b1 100644 --- a/client/src/app/videos/video-list/video-miniature.component.html +++ b/client/src/app/videos/video-list/video-miniature.component.html @@ -1,4 +1,4 @@ -
+
Download: {{ downloadSpeed | bytes }}/s
Upload: {{ uploadSpeed | bytes }}/s
Number of peers: {{ numPeers }}
+
diff --git a/client/src/app/videos/video-watch/video-watch.component.scss b/client/src/app/videos/video-watch/video-watch.component.scss index 767a3ed4e..789260a91 100644 --- a/client/src/app/videos/video-watch/video-watch.component.scss +++ b/client/src/app/videos/video-watch/video-watch.component.scss @@ -13,6 +13,10 @@ .embed-responsive { height: 500px; + + @media screen and (max-width: 600px) { + height: 300px; + } } #torrent-info { @@ -25,12 +29,6 @@ } } -.embed-responsive { - @media screen and (max-width: 600px) { - height: 300px; - } -} - #video-info { .video-name-views { font-weight: bold; diff --git a/client/src/app/videos/videos.module.ts b/client/src/app/videos/videos.module.ts index 04a06e0a3..adfbe7031 100644 --- a/client/src/app/videos/videos.module.ts +++ b/client/src/app/videos/videos.module.ts @@ -5,7 +5,7 @@ import { TagInputModule } from 'ng2-tag-input'; import { VideosRoutingModule } from './videos-routing.module'; import { VideosComponent } from './videos.component'; import { VideoAddComponent, VideoUpdateComponent } from './video-edit'; -import { VideoListComponent, VideoMiniatureComponent, VideoSortComponent } from './video-list'; +import { LoaderComponent, VideoListComponent, VideoMiniatureComponent, VideoSortComponent } from './video-list'; import { VideoWatchComponent, VideoMagnetComponent, @@ -13,7 +13,7 @@ import { VideoShareComponent, WebTorrentService } from './video-watch'; -import { LoaderComponent, VideoService } from './shared'; +import { VideoService } from './shared'; import { SharedModule } from '../shared'; @NgModule({ -- cgit v1.2.3