diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-02-04 16:44:53 +0100 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2020-02-13 16:35:24 +0100 |
commit | 9b8a7aa8ea128f7e197ff38ca9f86ffa53bbe110 (patch) | |
tree | f38e6f83a9d892a99f930c0a25b1a405e679cd4a /client/src/app/header/suggestion.component.ts | |
parent | ece3029bd99a76b3c48a1cc8c58914c5cf61f106 (diff) | |
download | PeerTube-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.ts | 18 |
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 @@ | |||
1 | import { Input, Component, Output, EventEmitter, OnInit } from '@angular/core' | 1 | import { Input, Component, Output, EventEmitter, OnInit, ChangeDetectionStrategy } from '@angular/core' |
2 | import { RouterLink } from '@angular/router' | 2 | import { RouterLink } from '@angular/router' |
3 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
4 | import { ListKeyManagerOption } from '@angular/cdk/a11y' | 3 | import { ListKeyManagerOption } from '@angular/cdk/a11y' |
5 | 4 | ||
6 | export type Result = { | 5 | export 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 | }) |
18 | export class SuggestionComponent implements OnInit, ListKeyManagerOption { | 18 | export 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 | } |