refactor: cleanup search route
This commit is contained in:
6 files changed
+83
-130
No files matched your search
@@ -68,6 +68,7 @@ const Settings = () => {
|
||||
const systemInfo = useQuery({
|
||||
queryKey: ["about", "systemInfo"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getSystemApi(api).getSystemInfo();
|
||||
return result.data;
|
||||
},
|
||||
@@ -106,7 +107,7 @@ const Settings = () => {
|
||||
const handleServerChange = useMutation({
|
||||
mutationFn: async (server: RecommendedServerInfo) => {
|
||||
await delUser();
|
||||
await setDefaultServer(server.id);
|
||||
await setDefaultServer(server.systemInfo?.Id ?? "");
|
||||
await defaultServer.refetch();
|
||||
createApi(server.address, undefined);
|
||||
queryClient.removeQueries();
|
||||
@@ -126,15 +127,15 @@ const Settings = () => {
|
||||
const handleDelete = useMutation({
|
||||
mutationKey: ["server-delete"],
|
||||
mutationFn: async (server: RecommendedServerInfo) => {
|
||||
await delServer(server.id);
|
||||
await delServer(server.systemInfo?.Id ?? "");
|
||||
|
||||
if (server.id === defaultServer.data) {
|
||||
if (server.systemInfo?.Id === defaultServer.data) {
|
||||
await delUser();
|
||||
await serversOnDisk.refetch();
|
||||
|
||||
if (serversOnDisk.data.length > 0) {
|
||||
if (serversOnDisk.data?.length) {
|
||||
setDefaultServer(serversOnDisk.data[0].id);
|
||||
createApi(serversOnDisk.data[0].address, null);
|
||||
createApi(serversOnDisk.data[0].address, undefined);
|
||||
} else {
|
||||
// TODO: Reset api in context
|
||||
// useApi.setState(useApi.getInitialState());
|
||||
@@ -158,7 +159,7 @@ const Settings = () => {
|
||||
},
|
||||
onSuccess: async (bestServer) => {
|
||||
if (bestServer) {
|
||||
await setServer(bestServer.systemInfo.Id, bestServer);
|
||||
await setServer(bestServer.systemInfo?.Id ?? "", bestServer);
|
||||
setAddServerDialog(false);
|
||||
enqueueSnackbar(
|
||||
"Client added successfully. You might need to refresh client list.",
|
||||
@@ -620,6 +621,7 @@ const Settings = () => {
|
||||
>
|
||||
Close
|
||||
</Button>
|
||||
{/* @ts-ignore */}
|
||||
<LoadingButton
|
||||
startIcon={
|
||||
<span
|
||||
|
||||
+13
-50
@@ -14,7 +14,6 @@ import { Route as rootRoute } from './routes/__root'
|
||||
import { Route as ApiImport } from './routes/_api'
|
||||
import { Route as IndexImport } from './routes/index'
|
||||
import { Route as ErrorCodeImport } from './routes/error/$code'
|
||||
import { Route as ApiSearchImport } from './routes/_api/search'
|
||||
import { Route as ApiLoginImport } from './routes/_api/login'
|
||||
import { Route as ApiSearchIndexImport } from './routes/_api/search/index'
|
||||
import { Route as ApiPlayerIndexImport } from './routes/_api/player/index'
|
||||
@@ -57,12 +56,6 @@ const ErrorCodeRoute = ErrorCodeImport.update({
|
||||
getParentRoute: () => rootRoute,
|
||||
} as any)
|
||||
|
||||
const ApiSearchRoute = ApiSearchImport.update({
|
||||
id: '/search',
|
||||
path: '/search',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiLoginRoute = ApiLoginImport.update({
|
||||
id: '/login',
|
||||
path: '/login',
|
||||
@@ -70,9 +63,9 @@ const ApiLoginRoute = ApiLoginImport.update({
|
||||
} as any)
|
||||
|
||||
const ApiSearchIndexRoute = ApiSearchIndexImport.update({
|
||||
id: '/',
|
||||
path: '/',
|
||||
getParentRoute: () => ApiSearchRoute,
|
||||
id: '/search/',
|
||||
path: '/search/',
|
||||
getParentRoute: () => ApiRoute,
|
||||
} as any)
|
||||
|
||||
const ApiPlayerIndexRoute = ApiPlayerIndexImport.update({
|
||||
@@ -220,13 +213,6 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof ApiLoginImport
|
||||
parentRoute: typeof ApiImport
|
||||
}
|
||||
'/_api/search': {
|
||||
id: '/_api/search'
|
||||
path: '/search'
|
||||
fullPath: '/search'
|
||||
preLoaderRoute: typeof ApiSearchImport
|
||||
parentRoute: typeof ApiImport
|
||||
}
|
||||
'/error/$code': {
|
||||
id: '/error/$code'
|
||||
path: '/error/$code'
|
||||
@@ -369,10 +355,10 @@ declare module '@tanstack/react-router' {
|
||||
}
|
||||
'/_api/search/': {
|
||||
id: '/_api/search/'
|
||||
path: '/'
|
||||
fullPath: '/search/'
|
||||
path: '/search'
|
||||
fullPath: '/search'
|
||||
preLoaderRoute: typeof ApiSearchIndexImport
|
||||
parentRoute: typeof ApiSearchImport
|
||||
parentRoute: typeof ApiImport
|
||||
}
|
||||
'/_api/login/$userId/$userName': {
|
||||
id: '/_api/login/$userId/$userName'
|
||||
@@ -402,21 +388,8 @@ const ApiLoginRouteWithChildren = ApiLoginRoute._addFileChildren(
|
||||
ApiLoginRouteChildren,
|
||||
)
|
||||
|
||||
interface ApiSearchRouteChildren {
|
||||
ApiSearchIndexRoute: typeof ApiSearchIndexRoute
|
||||
}
|
||||
|
||||
const ApiSearchRouteChildren: ApiSearchRouteChildren = {
|
||||
ApiSearchIndexRoute: ApiSearchIndexRoute,
|
||||
}
|
||||
|
||||
const ApiSearchRouteWithChildren = ApiSearchRoute._addFileChildren(
|
||||
ApiSearchRouteChildren,
|
||||
)
|
||||
|
||||
interface ApiRouteChildren {
|
||||
ApiLoginRoute: typeof ApiLoginRouteWithChildren
|
||||
ApiSearchRoute: typeof ApiSearchRouteWithChildren
|
||||
ApiAlbumIdRoute: typeof ApiAlbumIdRoute
|
||||
ApiArtistIdRoute: typeof ApiArtistIdRoute
|
||||
ApiBoxsetIdRoute: typeof ApiBoxsetIdRoute
|
||||
@@ -431,11 +404,11 @@ interface ApiRouteChildren {
|
||||
ApiFavoriteIndexRoute: typeof ApiFavoriteIndexRoute
|
||||
ApiHomeIndexRoute: typeof ApiHomeIndexRoute
|
||||
ApiPlayerIndexRoute: typeof ApiPlayerIndexRoute
|
||||
ApiSearchIndexRoute: typeof ApiSearchIndexRoute
|
||||
}
|
||||
|
||||
const ApiRouteChildren: ApiRouteChildren = {
|
||||
ApiLoginRoute: ApiLoginRouteWithChildren,
|
||||
ApiSearchRoute: ApiSearchRouteWithChildren,
|
||||
ApiAlbumIdRoute: ApiAlbumIdRoute,
|
||||
ApiArtistIdRoute: ApiArtistIdRoute,
|
||||
ApiBoxsetIdRoute: ApiBoxsetIdRoute,
|
||||
@@ -450,6 +423,7 @@ const ApiRouteChildren: ApiRouteChildren = {
|
||||
ApiFavoriteIndexRoute: ApiFavoriteIndexRoute,
|
||||
ApiHomeIndexRoute: ApiHomeIndexRoute,
|
||||
ApiPlayerIndexRoute: ApiPlayerIndexRoute,
|
||||
ApiSearchIndexRoute: ApiSearchIndexRoute,
|
||||
}
|
||||
|
||||
const ApiRouteWithChildren = ApiRoute._addFileChildren(ApiRouteChildren)
|
||||
@@ -458,7 +432,6 @@ export interface FileRoutesByFullPath {
|
||||
'/': typeof IndexRoute
|
||||
'': typeof ApiRouteWithChildren
|
||||
'/login': typeof ApiLoginRouteWithChildren
|
||||
'/search': typeof ApiSearchRouteWithChildren
|
||||
'/error/$code': typeof ErrorCodeRoute
|
||||
'/album/$id': typeof ApiAlbumIdRoute
|
||||
'/artist/$id': typeof ApiArtistIdRoute
|
||||
@@ -479,7 +452,7 @@ export interface FileRoutesByFullPath {
|
||||
'/favorite': typeof ApiFavoriteIndexRoute
|
||||
'/home': typeof ApiHomeIndexRoute
|
||||
'/player': typeof ApiPlayerIndexRoute
|
||||
'/search/': typeof ApiSearchIndexRoute
|
||||
'/search': typeof ApiSearchIndexRoute
|
||||
'/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute
|
||||
}
|
||||
|
||||
@@ -516,7 +489,6 @@ export interface FileRoutesById {
|
||||
'/': typeof IndexRoute
|
||||
'/_api': typeof ApiRouteWithChildren
|
||||
'/_api/login': typeof ApiLoginRouteWithChildren
|
||||
'/_api/search': typeof ApiSearchRouteWithChildren
|
||||
'/error/$code': typeof ErrorCodeRoute
|
||||
'/_api/album/$id': typeof ApiAlbumIdRoute
|
||||
'/_api/artist/$id': typeof ApiArtistIdRoute
|
||||
@@ -547,7 +519,6 @@ export interface FileRouteTypes {
|
||||
| '/'
|
||||
| ''
|
||||
| '/login'
|
||||
| '/search'
|
||||
| '/error/$code'
|
||||
| '/album/$id'
|
||||
| '/artist/$id'
|
||||
@@ -568,7 +539,7 @@ export interface FileRouteTypes {
|
||||
| '/favorite'
|
||||
| '/home'
|
||||
| '/player'
|
||||
| '/search/'
|
||||
| '/search'
|
||||
| '/login/$userId/$userName'
|
||||
fileRoutesByTo: FileRoutesByTo
|
||||
to:
|
||||
@@ -602,7 +573,6 @@ export interface FileRouteTypes {
|
||||
| '/'
|
||||
| '/_api'
|
||||
| '/_api/login'
|
||||
| '/_api/search'
|
||||
| '/error/$code'
|
||||
| '/_api/album/$id'
|
||||
| '/_api/artist/$id'
|
||||
@@ -671,7 +641,6 @@ export const routeTree = rootRoute
|
||||
"filePath": "_api.tsx",
|
||||
"children": [
|
||||
"/_api/login",
|
||||
"/_api/search",
|
||||
"/_api/album/$id",
|
||||
"/_api/artist/$id",
|
||||
"/_api/boxset/$id",
|
||||
@@ -685,7 +654,8 @@ export const routeTree = rootRoute
|
||||
"/_api/series/$id",
|
||||
"/_api/favorite/",
|
||||
"/_api/home/",
|
||||
"/_api/player/"
|
||||
"/_api/player/",
|
||||
"/_api/search/"
|
||||
]
|
||||
},
|
||||
"/_api/login": {
|
||||
@@ -697,13 +667,6 @@ export const routeTree = rootRoute
|
||||
"/_api/login/$userId/$userName"
|
||||
]
|
||||
},
|
||||
"/_api/search": {
|
||||
"filePath": "_api/search.tsx",
|
||||
"parent": "/_api",
|
||||
"children": [
|
||||
"/_api/search/"
|
||||
]
|
||||
},
|
||||
"/error/$code": {
|
||||
"filePath": "error/$code.tsx"
|
||||
},
|
||||
@@ -782,7 +745,7 @@ export const routeTree = rootRoute
|
||||
},
|
||||
"/_api/search/": {
|
||||
"filePath": "_api/search/index.tsx",
|
||||
"parent": "/_api/search"
|
||||
"parent": "/_api"
|
||||
},
|
||||
"/_api/login/$userId/$userName": {
|
||||
"filePath": "_api/login/$userId.$userName.tsx",
|
||||
|
||||
@@ -152,7 +152,9 @@ function ItemDetail() {
|
||||
return false;
|
||||
});
|
||||
setSelectedVideoTrack(
|
||||
result?.find((track) => track.IsDefault)?.Index ?? result?.[0].Index ?? 0,
|
||||
result?.find((track) => track.IsDefault)?.Index ??
|
||||
result?.[0]?.Index ??
|
||||
0,
|
||||
);
|
||||
return result ?? [];
|
||||
}, [item.data?.Id]);
|
||||
@@ -164,7 +166,9 @@ function ItemDetail() {
|
||||
return false;
|
||||
});
|
||||
setSelectedAudioTrack(
|
||||
result?.find((track) => track.IsDefault)?.Index ?? result?.[0].Index ?? 0,
|
||||
result?.find((track) => track.IsDefault)?.Index ??
|
||||
result?.[0]?.Index ??
|
||||
0,
|
||||
);
|
||||
return result ?? [];
|
||||
}, [item.data?.Id]);
|
||||
@@ -672,6 +676,7 @@ function ItemDetail() {
|
||||
<PlayButton
|
||||
item={item.data}
|
||||
itemType={item.data.Type ?? "Movie"}
|
||||
audio={item.data.Type === "Audio"}
|
||||
currentVideoTrack={selectedVideoTrack}
|
||||
currentAudioTrack={selectedAudioTrack}
|
||||
currentSubTrack={selectedSubtitleTrack}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
|
||||
export const Route = createFileRoute("/_api/search")({
|
||||
validateSearch: (search: Record<string, string>): { query: string } => {
|
||||
return {
|
||||
query: search?.query as string,
|
||||
};
|
||||
},
|
||||
});
|
||||
@@ -1,7 +1,5 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import InputAdornment from "@mui/material/InputAdornment";
|
||||
import TextField from "@mui/material/TextField";
|
||||
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
@@ -9,12 +7,8 @@ import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { EmptyNotice } from "@/components/notices/emptyNotice/emptyNotice";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
|
||||
import useDebounce from "@/utils/hooks/useDebounce";
|
||||
|
||||
import { Card } from "@/components/card/card";
|
||||
import { EpisodeCard } from "@/components/card/episodeCard";
|
||||
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
@@ -22,7 +16,7 @@ import { getPersonsApi } from "@jellyfin/sdk/lib/utils/api/persons-api";
|
||||
import { getSearchApi } from "@jellyfin/sdk/lib/utils/api/search-api";
|
||||
import "./search.scss";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import { Dialog, Fab } from "@mui/material";
|
||||
import { Fab } from "@mui/material";
|
||||
import { Outlet, createFileRoute, useNavigate } from "@tanstack/react-router";
|
||||
|
||||
export const Route = createFileRoute("/_api/search/")({
|
||||
@@ -48,6 +42,7 @@ function SearchPage() {
|
||||
const movies = useQuery({
|
||||
queryKey: ["search", "items", "Movie", query],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
searchTerm: query,
|
||||
@@ -62,6 +57,7 @@ function SearchPage() {
|
||||
const series = useQuery({
|
||||
queryKey: ["search", "items", "Series", query],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
searchTerm: query,
|
||||
@@ -76,6 +72,7 @@ function SearchPage() {
|
||||
const musicAlbum = useQuery({
|
||||
queryKey: ["search", "items", "MusicAlbum", query],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
searchTerm: query,
|
||||
@@ -90,6 +87,7 @@ function SearchPage() {
|
||||
const audio = useQuery({
|
||||
queryKey: ["search", "items", "Audio", query],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
searchTerm: query,
|
||||
@@ -104,6 +102,7 @@ function SearchPage() {
|
||||
const book = useQuery({
|
||||
queryKey: ["search", "items", "Book", query],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
searchTerm: query,
|
||||
@@ -118,6 +117,7 @@ function SearchPage() {
|
||||
const musicArtists = useQuery({
|
||||
queryKey: ["search", "items", "MusicArtists", query],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
searchTerm: query,
|
||||
@@ -132,6 +132,7 @@ function SearchPage() {
|
||||
const person = useQuery({
|
||||
queryKey: ["search", "items", "Person", query],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getPersonsApi(api).getPersons({
|
||||
userId: user?.Id,
|
||||
searchTerm: query,
|
||||
@@ -144,6 +145,7 @@ function SearchPage() {
|
||||
const episodes = useQuery({
|
||||
queryKey: ["search", "items", "Episodes", query],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getSearchApi(api).getSearchHints({
|
||||
userId: user?.Id,
|
||||
searchTerm: query,
|
||||
@@ -161,6 +163,7 @@ function SearchPage() {
|
||||
// Removing app's backdrop
|
||||
setBackdrop("", "");
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div
|
||||
className="scrollY"
|
||||
@@ -209,9 +212,9 @@ function SearchPage() {
|
||||
height: "100%",
|
||||
}}
|
||||
>
|
||||
{movies.isSuccess && movies.data.Items.length > 0 && (
|
||||
<CardScroller title="Movies" displayCards={8} disableDecoration>
|
||||
{movies.data.Items.map((item) => (
|
||||
{movies.isSuccess && Boolean(movies.data?.Items?.length) && (
|
||||
<CardScroller title="Movies" displayCards={7} disableDecoration>
|
||||
{movies.data?.Items?.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
@@ -221,19 +224,13 @@ function SearchPage() {
|
||||
cardType="portrait"
|
||||
queryKey={["search", "items", "Movie", query]}
|
||||
userId={user?.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{series.isSuccess && series.data.Items.length > 0 && (
|
||||
<CardScroller title="TV Shows" displayCards={8} disableDecoration>
|
||||
{series.data.Items.map((item, index) => (
|
||||
{series.isSuccess && Boolean(series.data?.Items?.length) && (
|
||||
<CardScroller title="TV Shows" displayCards={7} disableDecoration>
|
||||
{series.data?.Items?.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
@@ -249,19 +246,13 @@ function SearchPage() {
|
||||
cardType="portrait"
|
||||
queryKey={["search", "items", "Series", query]}
|
||||
userId={user?.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{episodes.isSuccess && episodes.data.TotalRecordCount > 0 && (
|
||||
{episodes.isSuccess && Boolean(episodes.data?.TotalRecordCount) && (
|
||||
<CardScroller title="Episodes" displayCards={4} disableDecoration>
|
||||
{episodes.data.SearchHints?.map((episode) => {
|
||||
{episodes.data?.SearchHints?.map((episode) => {
|
||||
return (
|
||||
<Card
|
||||
key={episode.Id}
|
||||
@@ -276,9 +267,9 @@ function SearchPage() {
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
{audio.isSuccess && audio.data.Items?.length > 0 && (
|
||||
<CardScroller title="Audio" displayCards={8} disableDecoration>
|
||||
{audio.data.Items?.map((item, index) => (
|
||||
{audio.isSuccess && Boolean(audio.data?.Items?.length) && (
|
||||
<CardScroller title="Audio" displayCards={7} disableDecoration>
|
||||
{audio.data?.Items?.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
@@ -292,9 +283,9 @@ function SearchPage() {
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{musicAlbum.isSuccess && musicAlbum.data.Items?.length > 0 && (
|
||||
<CardScroller title="Albums" displayCards={8} disableDecoration>
|
||||
{musicAlbum.data.Items?.map((item, index) => (
|
||||
{musicAlbum.isSuccess && Boolean(musicAlbum.data?.Items?.length) && (
|
||||
<CardScroller title="Albums" displayCards={7} disableDecoration>
|
||||
{musicAlbum.data?.Items?.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
@@ -309,9 +300,9 @@ function SearchPage() {
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{book.isSuccess && book.data.Items?.length > 0 && (
|
||||
<CardScroller title="Books" displayCards={8} disableDecoration>
|
||||
{book.data.Items?.map((item, index) => (
|
||||
{book.isSuccess && Boolean(book.data?.Items?.length) && (
|
||||
<CardScroller title="Books" displayCards={7} disableDecoration>
|
||||
{book.data?.Items?.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
@@ -326,25 +317,26 @@ function SearchPage() {
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{musicArtists.isSuccess && musicArtists.data.Items?.length > 0 && (
|
||||
<CardScroller title="Artists" displayCards={8} disableDecoration>
|
||||
{musicArtists.data.Items?.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={item.Name}
|
||||
imageType={"Primary"}
|
||||
disableOverlay
|
||||
cardType={"square"}
|
||||
queryKey={["search", "items", "MusicArtists", query]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{person.isSuccess && person.data.Items?.length > 0 && (
|
||||
<CardScroller title="People" displayCards={8} disableDecoration>
|
||||
{person.data.Items?.map((item) => (
|
||||
{musicArtists.isSuccess &&
|
||||
Boolean(musicArtists.data?.Items?.length) && (
|
||||
<CardScroller title="Artists" displayCards={7} disableDecoration>
|
||||
{musicArtists.data?.Items?.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={item.Name}
|
||||
imageType={"Primary"}
|
||||
disableOverlay
|
||||
cardType={"square"}
|
||||
queryKey={["search", "items", "MusicArtists", query]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{person.isSuccess && Boolean(person.data?.Items?.length) && (
|
||||
<CardScroller title="People" displayCards={7} disableDecoration>
|
||||
{person.data?.Items?.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
@@ -367,13 +359,13 @@ function SearchPage() {
|
||||
book.isSuccess &&
|
||||
musicArtists.isSuccess &&
|
||||
person.isSuccess &&
|
||||
movies.data.Items?.length === 0 &&
|
||||
series.data.Items?.length === 0 &&
|
||||
audio.data.Items?.length === 0 &&
|
||||
musicAlbum.data.Items?.length === 0 &&
|
||||
book.data.Items?.length === 0 &&
|
||||
musicArtists.data.Items?.length === 0 &&
|
||||
person.data.Items?.length === 0 &&
|
||||
movies.data?.Items?.length === 0 &&
|
||||
series.data?.Items?.length === 0 &&
|
||||
audio.data?.Items?.length === 0 &&
|
||||
musicAlbum.data?.Items?.length === 0 &&
|
||||
book.data?.Items?.length === 0 &&
|
||||
musicArtists.data?.Items?.length === 0 &&
|
||||
person.data?.Items?.length === 0 &&
|
||||
episodes.data?.SearchHints?.length === 0 && (
|
||||
<div
|
||||
style={{
|
||||
|
||||
@@ -126,7 +126,7 @@ function SeriesTitlePage() {
|
||||
|
||||
const [currentSeason, setCurrentSeason] = useState(() => {
|
||||
const result = sessionStorage.getItem(`season-${item.data?.Id}`);
|
||||
return result ?? seasons.data?.Items?.[0].IndexNumber ?? 0;
|
||||
return result ?? 0;
|
||||
});
|
||||
|
||||
const currentSeasonItem = useQuery({
|
||||
|
||||
Reference in new issue
Block a user