aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/header/suggestion.component.ts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-02-04 16:44:53 +0100
committerRigel Kent <sendmemail@rigelk.eu>2020-02-13 16:35:24 +0100
commit9b8a7aa8ea128f7e197ff38ca9f86ffa53bbe110 (patch)
treef38e6f83a9d892a99f930c0a25b1a405e679cd4a /client/src/app/header/suggestion.component.ts
parentece3029bd99a76b3c48a1cc8c58914c5cf61f106 (diff)
downloadPeerTube-9b8a7aa8ea128f7e197ff38ca9f86ffa53bbe110.tar.gz
PeerTube-9b8a7aa8ea128f7e197ff38ca9f86ffa53bbe110.tar.zst
PeerTube-9b8a7aa8ea128f7e197ff38ca9f86ffa53bbe110.zip
Improve search typeahead performance and use native events
Diffstat (limited to 'client/src/app/header/suggestion.component.ts')
-rw-r--r--client/src/app/header/suggestion.component.ts18
1 files changed, 3 insertions, 15 deletions
diff --git a/client/src/app/header/suggestion.component.ts b/client/src/app/header/suggestion.component.ts
index bdcb3e03f..69641b511 100644
--- a/client/src/app/header/suggestion.component.ts
+++ b/client/src/app/header/suggestion.component.ts
@@ -1,6 +1,5 @@
1import { Input, Component, Output, EventEmitter, OnInit } from '@angular/core' 1import { Input, Component, Output, EventEmitter, OnInit, ChangeDetectionStrategy } from '@angular/core'
2import { RouterLink } from '@angular/router' 2import { RouterLink } from '@angular/router'
3import { I18n } from '@ngx-translate/i18n-polyfill'
4import { ListKeyManagerOption } from '@angular/cdk/a11y' 3import { ListKeyManagerOption } from '@angular/cdk/a11y'
5 4
6export type Result = { 5export type Result = {
@@ -13,28 +12,17 @@ export type Result = {
13@Component({ 12@Component({
14 selector: 'my-suggestion', 13 selector: 'my-suggestion',
15 templateUrl: './suggestion.component.html', 14 templateUrl: './suggestion.component.html',
16 styleUrls: [ './suggestion.component.scss' ] 15 styleUrls: [ './suggestion.component.scss' ],
16 changeDetection: ChangeDetectionStrategy.OnPush
17}) 17})
18export class SuggestionComponent implements OnInit, ListKeyManagerOption { 18export class SuggestionComponent implements OnInit, ListKeyManagerOption {
19 @Input() result: Result 19 @Input() result: Result
20 @Input() highlight: string 20 @Input() highlight: string
21 @Output() selected = new EventEmitter() 21 @Output() selected = new EventEmitter()
22 22
23 inAllText: string
24 inThisChannelText: string
25 inThisInstanceText: string
26
27 disabled = false 23 disabled = false
28 active = false 24 active = false
29 25
30 constructor (
31 private i18n: I18n
32 ) {
33 this.inAllText = this.i18n('In the vidiverse')
34 this.inThisChannelText = this.i18n('In this channel')
35 this.inThisInstanceText = this.i18n('In this instance')
36 }
37
38 getLabel () { 26 getLabel () {
39 return this.result.text 27 return this.result.text
40 } 28 }