diff --git a/Kyoo/ClientApp/src/app/app.component.ts b/Kyoo/ClientApp/src/app/app.component.ts index 50afa42f..81d31048 100644 --- a/Kyoo/ClientApp/src/app/app.component.ts +++ b/Kyoo/ClientApp/src/app/app.component.ts @@ -2,6 +2,7 @@ import { Component } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Event, Router, NavigationStart, NavigationEnd, NavigationCancel, NavigationError } from '@angular/router'; import * as $ from "jquery"; +import { Location } from "@angular/common"; @Component({ selector: 'app-root', @@ -13,7 +14,7 @@ export class AppComponent libraries: Library[]; isLoading: boolean = false; - constructor(http: HttpClient, private router: Router) + constructor(http: HttpClient, private router: Router, private location: Location) { http.get("api/libraries").subscribe(result => { @@ -50,8 +51,11 @@ export class AppComponent onUpdateValue(event) { - console.log("Value: " + event.target.value); - this.router.navigate(["/search/" + event.target.value]); + let query: string = event.target.value; + if (query != "") + this.router.navigate(["/search/" + query], { replaceUrl: this.router.url.startsWith("/search/") }); + else + this.location.back(); } } diff --git a/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.html b/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.html index 620cb0d6..5e251e94 100644 --- a/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.html +++ b/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.html @@ -1,6 +1,6 @@
- +
diff --git a/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.ts b/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.ts index 954ccfa0..865f241e 100644 --- a/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.ts +++ b/Kyoo/ClientApp/src/app/episodes-list/episodes-list.component.ts @@ -15,7 +15,7 @@ export class EpisodesListComponent @ViewChild("scrollView", { static: true }) private scrollView: ElementRef; @ViewChild("leftBtn", { static: false }) private leftBtn: MatButton; @ViewChild("rightBtn", { static: false }) private rightBtn: MatButton; - @ViewChild("episode", { static: false }) private episode: ElementRef; + @ViewChild("episodeDom", { static: false }) private episode: ElementRef; constructor(private sanitizer: DomSanitizer) { } diff --git a/Kyoo/ClientApp/src/app/search/search.component.html b/Kyoo/ClientApp/src/app/search/search.component.html index a6f329b7..b65f2c78 100644 --- a/Kyoo/ClientApp/src/app/search/search.component.html +++ b/Kyoo/ClientApp/src/app/search/search.component.html @@ -1,12 +1,12 @@ -
+

Shows

-
+

Episodes

-
+

People

diff --git a/Kyoo/ClientApp/src/app/search/search.component.ts b/Kyoo/ClientApp/src/app/search/search.component.ts index 0c423454..63633886 100644 --- a/Kyoo/ClientApp/src/app/search/search.component.ts +++ b/Kyoo/ClientApp/src/app/search/search.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute } from "@angular/router"; import { SearchResut } from "../../models/search-result"; +import { Title } from "@angular/platform-browser"; @Component({ selector: 'app-search', @@ -11,13 +12,14 @@ export class SearchComponent implements OnInit { items: SearchResut; - constructor(private route: ActivatedRoute) { } + constructor(private route: ActivatedRoute, private title: Title) { } ngOnInit() { this.route.data.subscribe((data) => { this.items = data.items; + this.title.setTitle(this.items.query + " - Kyoo"); }); } } diff --git a/Kyoo/ClientApp/src/models/search-result.ts b/Kyoo/ClientApp/src/models/search-result.ts index af103920..671dd086 100644 --- a/Kyoo/ClientApp/src/models/search-result.ts +++ b/Kyoo/ClientApp/src/models/search-result.ts @@ -6,6 +6,7 @@ import { Genre } from "./genre"; export interface SearchResut { + query: string; shows: Show[]; episodes: Episode[]; people: People[]; diff --git a/Kyoo/Controllers/SearchController.cs b/Kyoo/Controllers/SearchController.cs index b33acd3f..1dd08d17 100644 --- a/Kyoo/Controllers/SearchController.cs +++ b/Kyoo/Controllers/SearchController.cs @@ -20,6 +20,7 @@ namespace Kyoo.Controllers { SearchResult result = new SearchResult { + query = query, shows = libraryManager.GetShows(query), episodes = libraryManager.SearchEpisodes(query), people = libraryManager.SearchPeople(query), diff --git a/Kyoo/Models/SearchResult.cs b/Kyoo/Models/SearchResult.cs index 57ce32f8..5462c904 100644 --- a/Kyoo/Models/SearchResult.cs +++ b/Kyoo/Models/SearchResult.cs @@ -4,6 +4,7 @@ namespace Kyoo.Models { public class SearchResult { + public string query; public IEnumerable shows; public IEnumerable episodes; public IEnumerable people;