X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fheader%2Fsuggestion.component.ts;h=c874212a5a9ea51556307014bcb186c7a62c8c6b;hb=601b661315491ecde1002c5a08e7fdf75dfab574;hp=75c44a5839037720154f43f90442636d5bb92914;hpb=6af662a5961b48ac12682df2b8b971060a2cc67d;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/header/suggestion.component.ts b/client/src/app/header/suggestion.component.ts index 75c44a583..c874212a5 100644 --- a/client/src/app/header/suggestion.component.ts +++ b/client/src/app/header/suggestion.component.ts @@ -1,48 +1,33 @@ -import { Input, Component, Output, EventEmitter, OnInit } from '@angular/core' -import { RouterLink } from '@angular/router' -import { I18n } from '@ngx-translate/i18n-polyfill' import { ListKeyManagerOption } from '@angular/cdk/a11y' +import { Component, Input, OnInit } from '@angular/core' +import { RouterLink } from '@angular/router' -type Result = { +export type SuggestionPayload = { text: string - type: 'channel' | 'suggestion' | 'search-channel' | 'search-instance' | 'search-global' | 'search-any' + type: SuggestionPayloadType routerLink?: RouterLink + default: boolean } +export type SuggestionPayloadType = 'search-instance' | 'search-index' + @Component({ selector: 'my-suggestion', templateUrl: './suggestion.component.html', styleUrls: [ './suggestion.component.scss' ] }) export class SuggestionComponent implements OnInit, ListKeyManagerOption { - @Input() result: Result + @Input() result: SuggestionPayload @Input() highlight: string - @Output() selected = new EventEmitter() - - inAllText: string - inThisChannelText: string - inThisInstanceText: string disabled = false active = false - constructor ( - private i18n: I18n - ) { - this.inAllText = this.i18n('In the vidiverse') - this.inThisChannelText = this.i18n('In this channel') - this.inThisInstanceText = this.i18n('In this instance') - } - getLabel () { return this.result.text } ngOnInit () { - this.active = false - } - - selectItem () { - this.selected.emit(this.result) + if (this.result.default) this.active = true } }