Skip to content

Commit

Permalink
revert youtube search
Browse files Browse the repository at this point in the history
  • Loading branch information
SuspiciousLookingOwl committed Jun 26, 2024
1 parent 6233896 commit 06346f2
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/apps/app/views/search/search.view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Container, Icon, Input, Item, useNavigate, useScreen } from "@common";
import { MediaSource, MediaSourceFactory, useMatchMediaUrlId } from "@media-source";
import { useQueue } from "@queue";
import { useSearchParams } from "@solidjs/router";
import { YouTubeContextMenuUtil, YouTubePlaylist, useSearchYouTubeMusic } from "@youtube";
import { YouTubeContextMenuUtil, YouTubePlaylist, useSearch } from "@youtube";
import { For, Show, onMount, type Component } from "solid-js";

export const Search: Component = () => {
Expand All @@ -15,7 +15,10 @@ export const Search: Component = () => {

const [query, setQuery] = useSearchParams<{ keyword: string }>();
const matchUrl = useMatchMediaUrlId(query.keyword || "");
const search = useSearchYouTubeMusic();
const search = useSearch({
playlistCount: 5,
playlistStartIndex: 5,
});

onMount(() => {
app.setTitle("Search");
Expand Down Expand Up @@ -67,14 +70,14 @@ export const Search: Component = () => {
<For each={Array(5)}>{() => <Item.ListSkeleton size={screen.gte.md ? "lg" : "md"} />}</For>
}
>
<For each={search.flatResult().items}>
<For each={search.result()}>
{(item) => {
if ("duration" in item) {
const mediaSource = MediaSourceFactory.fromYoutubeMusic(item);
const mediaSource = MediaSourceFactory.fromYoutubeVideo(item);
return (
<MediaSource.List size={screen.gte.md ? "lg" : "md"} mediaSource={mediaSource} />
);
} else if (item.id === "") {
} else {
return (
<YouTubePlaylist.List
size={screen.gte.md ? "lg" : "md"}
Expand Down

0 comments on commit 06346f2

Please sign in to comment.