mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-07 10:14:13 -04:00
Cleaning up the search engine.
This commit is contained in:
parent
06cbd21502
commit
38e464c461
@ -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<Library[]>("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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<div class="root">
|
||||
<div class="episodes" #scrollView (scroll)="onScroll()">
|
||||
<a class="episode" *ngFor="let episode of this.episodes" #episode routerLink="/watch/{{episode.link}}" href="/watch/{{this.showSlug}}-s{{episode.seasonNumber}}e{{episode.episodeNumber}}">
|
||||
<a class="episode" *ngFor="let episode of this.episodes" #episodeDom routerLink="/watch/{{episode.link}}" href="/watch/{{this.showSlug}}-s{{episode.seasonNumber}}e{{episode.episodeNumber}}">
|
||||
<div matRipple class="img" [style.background-image]="sanitize(episode.thumb)">
|
||||
<button mat-icon-button class="playBtn"><i class="material-icons playIcon">play_circle_outline</i></button>
|
||||
</div>
|
||||
|
@ -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) { }
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
<div class="container-fluid mt-3">
|
||||
<div *ngIf="items.shows.length > 0" class="container-fluid mt-3">
|
||||
<h3>Shows</h3>
|
||||
</div>
|
||||
<app-shows-list [shows]="items.shows"></app-shows-list>
|
||||
<div class="container-fluid mt-5">
|
||||
<div *ngIf="items.episodes.length > 0" class="container-fluid mt-5">
|
||||
<h3>Episodes</h3>
|
||||
</div>
|
||||
<app-episodes-list displayShowTitle="true" [episodes]="items.episodes"></app-episodes-list>
|
||||
<div class="container-fluid mt-5">
|
||||
<div *ngIf="items.people.length > 0" class="container-fluid mt-5">
|
||||
<h3>People</h3>
|
||||
</div>
|
||||
<app-people-list [people]="items.people"></app-people-list>
|
||||
|
@ -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");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import { Genre } from "./genre";
|
||||
|
||||
export interface SearchResut
|
||||
{
|
||||
query: string;
|
||||
shows: Show[];
|
||||
episodes: Episode[];
|
||||
people: People[];
|
||||
|
@ -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),
|
||||
|
@ -4,6 +4,7 @@ namespace Kyoo.Models
|
||||
{
|
||||
public class SearchResult
|
||||
{
|
||||
public string query;
|
||||
public IEnumerable<Show> shows;
|
||||
public IEnumerable<Episode> episodes;
|
||||
public IEnumerable<People> people;
|
||||
|
Loading…
x
Reference in New Issue
Block a user