]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/videos/video-list/video-sort.component.ts
Use typescript standard and lint all files
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / video-list / video-sort.component.ts
index 53951deb440f132c4e199466d2c7dc4467254a4a..64916bf1668e5c00217de70e5344612064da22a3 100644 (file)
@@ -1,6 +1,6 @@
-import { Component, EventEmitter, Input, Output } from '@angular/core';
+import { Component, EventEmitter, Input, Output } from '@angular/core'
 
-import { SortField } from '../shared';
+import { SortField } from '../shared'
 
 @Component({
   selector: 'my-video-sort',
@@ -8,28 +8,32 @@ import { SortField } from '../shared';
 })
 
 export class VideoSortComponent {
-  @Output() sort = new EventEmitter<any>();
+  @Output() sort = new EventEmitter<any>()
 
-  @Input() currentSort: SortField;
+  @Input() currentSort: SortField
 
-  sortChoices = {
+  sortChoices: { [ P in SortField ]: string } = {
     'name': 'Name - Asc',
     '-name': 'Name - Desc',
     'duration': 'Duration - Asc',
     '-duration': 'Duration - Desc',
     'createdAt': 'Created Date - Asc',
-    '-createdAt': 'Created Date - Desc'
-  };
+    '-createdAt': 'Created Date - Desc',
+    'views': 'Views - Asc',
+    '-views': 'Views - Desc',
+    'likes': 'Likes - Asc',
+    '-likes': 'Likes - Desc'
+  }
 
-  get choiceKeys() {
-    return Object.keys(this.sortChoices);
+  get choiceKeys () {
+    return Object.keys(this.sortChoices)
   }
 
-  getStringChoice(choiceKey: SortField) {
-    return this.sortChoices[choiceKey];
+  getStringChoice (choiceKey: SortField) {
+    return this.sortChoices[choiceKey]
   }
 
-  onSortChange() {
-    this.sort.emit(this.currentSort);
+  onSortChange () {
+    this.sort.emit(this.currentSort)
   }
 }