feat: remember last search query
This commit is contained in:
10 files changed
+125
-86
No files matched your search
@@ -14,7 +14,7 @@ export const EmptyNotice = ({ extraMsg }) => {
|
|||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
flexFlow: "column",
|
flexFlow: "column",
|
||||||
position: "absolute",
|
position: "static",
|
||||||
top: 0,
|
top: 0,
|
||||||
left: 0,
|
left: 0,
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -267,7 +267,12 @@ const AudioPlayer = () => {
|
|||||||
initial={{
|
initial={{
|
||||||
transform: "translateY(100%)",
|
transform: "translateY(100%)",
|
||||||
}}
|
}}
|
||||||
animate={{ transform: "translateY(0)" }}
|
animate={{
|
||||||
|
transform:
|
||||||
|
location.pathname === "/player/audio"
|
||||||
|
? "translateY(100%)"
|
||||||
|
: "translateY(0%)",
|
||||||
|
}}
|
||||||
exit={{
|
exit={{
|
||||||
transform: "translateY(100%)",
|
transform: "translateY(100%)",
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const TagChip = ({
|
|||||||
linkProps,
|
linkProps,
|
||||||
}: { label: string; linkProps: LinkProps }) => {
|
}: { label: string; linkProps: LinkProps }) => {
|
||||||
return (
|
return (
|
||||||
<Link className="tag" {...linkProps}>
|
<Link className="tag" to="/search" search={{ query: label }} {...linkProps}>
|
||||||
<Typography variant="subtitle2" fontWeight={300}>
|
<Typography variant="subtitle2" fontWeight={300}>
|
||||||
{label}
|
{label}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|||||||
+29
-9
@@ -14,6 +14,7 @@ import { Route as rootRoute } from './routes/__root'
|
|||||||
import { Route as ApiImport } from './routes/_api'
|
import { Route as ApiImport } from './routes/_api'
|
||||||
import { Route as IndexImport } from './routes/index'
|
import { Route as IndexImport } from './routes/index'
|
||||||
import { Route as ErrorCodeImport } from './routes/error/$code'
|
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 ApiLoginImport } from './routes/_api/login'
|
||||||
import { Route as ApiSearchIndexImport } from './routes/_api/search/index'
|
import { Route as ApiSearchIndexImport } from './routes/_api/search/index'
|
||||||
import { Route as ApiPlayerIndexImport } from './routes/_api/player/index'
|
import { Route as ApiPlayerIndexImport } from './routes/_api/player/index'
|
||||||
@@ -53,14 +54,19 @@ const ErrorCodeRoute = ErrorCodeImport.update({
|
|||||||
getParentRoute: () => rootRoute,
|
getParentRoute: () => rootRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
|
const ApiSearchRoute = ApiSearchImport.update({
|
||||||
|
path: '/search',
|
||||||
|
getParentRoute: () => ApiRoute,
|
||||||
|
} as any)
|
||||||
|
|
||||||
const ApiLoginRoute = ApiLoginImport.update({
|
const ApiLoginRoute = ApiLoginImport.update({
|
||||||
path: '/login',
|
path: '/login',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiSearchIndexRoute = ApiSearchIndexImport.update({
|
const ApiSearchIndexRoute = ApiSearchIndexImport.update({
|
||||||
path: '/search/',
|
path: '/',
|
||||||
getParentRoute: () => ApiRoute,
|
getParentRoute: () => ApiSearchRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const ApiPlayerIndexRoute = ApiPlayerIndexImport.update({
|
const ApiPlayerIndexRoute = ApiPlayerIndexImport.update({
|
||||||
@@ -183,6 +189,13 @@ declare module '@tanstack/react-router' {
|
|||||||
preLoaderRoute: typeof ApiLoginImport
|
preLoaderRoute: typeof ApiLoginImport
|
||||||
parentRoute: typeof ApiImport
|
parentRoute: typeof ApiImport
|
||||||
}
|
}
|
||||||
|
'/_api/search': {
|
||||||
|
id: '/_api/search'
|
||||||
|
path: '/search'
|
||||||
|
fullPath: '/search'
|
||||||
|
preLoaderRoute: typeof ApiSearchImport
|
||||||
|
parentRoute: typeof ApiImport
|
||||||
|
}
|
||||||
'/error/$code': {
|
'/error/$code': {
|
||||||
id: '/error/$code'
|
id: '/error/$code'
|
||||||
path: '/error/$code'
|
path: '/error/$code'
|
||||||
@@ -318,10 +331,10 @@ declare module '@tanstack/react-router' {
|
|||||||
}
|
}
|
||||||
'/_api/search/': {
|
'/_api/search/': {
|
||||||
id: '/_api/search/'
|
id: '/_api/search/'
|
||||||
path: '/search'
|
path: '/'
|
||||||
fullPath: '/search'
|
fullPath: '/search/'
|
||||||
preLoaderRoute: typeof ApiSearchIndexImport
|
preLoaderRoute: typeof ApiSearchIndexImport
|
||||||
parentRoute: typeof ApiImport
|
parentRoute: typeof ApiSearchImport
|
||||||
}
|
}
|
||||||
'/_api/login/$userId/$userName': {
|
'/_api/login/$userId/$userName': {
|
||||||
id: '/_api/login/$userId/$userName'
|
id: '/_api/login/$userId/$userName'
|
||||||
@@ -343,6 +356,7 @@ export const routeTree = rootRoute.addChildren({
|
|||||||
ApiLoginManualRoute,
|
ApiLoginManualRoute,
|
||||||
ApiLoginUserIdUserNameRoute,
|
ApiLoginUserIdUserNameRoute,
|
||||||
}),
|
}),
|
||||||
|
ApiSearchRoute: ApiSearchRoute.addChildren({ ApiSearchIndexRoute }),
|
||||||
ApiAlbumIdRoute,
|
ApiAlbumIdRoute,
|
||||||
ApiArtistIdRoute,
|
ApiArtistIdRoute,
|
||||||
ApiBoxsetIdRoute,
|
ApiBoxsetIdRoute,
|
||||||
@@ -356,7 +370,6 @@ export const routeTree = rootRoute.addChildren({
|
|||||||
ApiFavoriteIndexRoute,
|
ApiFavoriteIndexRoute,
|
||||||
ApiHomeIndexRoute,
|
ApiHomeIndexRoute,
|
||||||
ApiPlayerIndexRoute,
|
ApiPlayerIndexRoute,
|
||||||
ApiSearchIndexRoute,
|
|
||||||
}),
|
}),
|
||||||
ErrorCodeRoute,
|
ErrorCodeRoute,
|
||||||
SetupServerAddRoute,
|
SetupServerAddRoute,
|
||||||
@@ -387,6 +400,7 @@ export const routeTree = rootRoute.addChildren({
|
|||||||
"filePath": "_api.tsx",
|
"filePath": "_api.tsx",
|
||||||
"children": [
|
"children": [
|
||||||
"/_api/login",
|
"/_api/login",
|
||||||
|
"/_api/search",
|
||||||
"/_api/album/$id",
|
"/_api/album/$id",
|
||||||
"/_api/artist/$id",
|
"/_api/artist/$id",
|
||||||
"/_api/boxset/$id",
|
"/_api/boxset/$id",
|
||||||
@@ -399,8 +413,7 @@ export const routeTree = rootRoute.addChildren({
|
|||||||
"/_api/series/$id",
|
"/_api/series/$id",
|
||||||
"/_api/favorite/",
|
"/_api/favorite/",
|
||||||
"/_api/home/",
|
"/_api/home/",
|
||||||
"/_api/player/",
|
"/_api/player/"
|
||||||
"/_api/search/"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"/_api/login": {
|
"/_api/login": {
|
||||||
@@ -412,6 +425,13 @@ export const routeTree = rootRoute.addChildren({
|
|||||||
"/_api/login/$userId/$userName"
|
"/_api/login/$userId/$userName"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"/_api/search": {
|
||||||
|
"filePath": "_api/search.tsx",
|
||||||
|
"parent": "/_api",
|
||||||
|
"children": [
|
||||||
|
"/_api/search/"
|
||||||
|
]
|
||||||
|
},
|
||||||
"/error/$code": {
|
"/error/$code": {
|
||||||
"filePath": "error/$code.tsx"
|
"filePath": "error/$code.tsx"
|
||||||
},
|
},
|
||||||
@@ -486,7 +506,7 @@ export const routeTree = rootRoute.addChildren({
|
|||||||
},
|
},
|
||||||
"/_api/search/": {
|
"/_api/search/": {
|
||||||
"filePath": "_api/search/index.jsx",
|
"filePath": "_api/search/index.jsx",
|
||||||
"parent": "/_api"
|
"parent": "/_api/search"
|
||||||
},
|
},
|
||||||
"/_api/login/$userId/$userName": {
|
"/_api/login/$userId/$userName": {
|
||||||
"filePath": "_api/login/$userId.$userName.tsx",
|
"filePath": "_api/login/$userId.$userName.tsx",
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ export const Route = createRootRouteWithContext<ApiContext>()({
|
|||||||
<AudioPlayer />
|
<AudioPlayer />
|
||||||
<Outlet />
|
<Outlet />
|
||||||
<ReactQueryDevtools />
|
<ReactQueryDevtools />
|
||||||
{/* <TanStackRouterDevtools /> */}
|
<TanStackRouterDevtools />
|
||||||
</SnackbarProvider>
|
</SnackbarProvider>
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
.audio {
|
.audio {
|
||||||
|
&-hidden{
|
||||||
|
transform: translateY(-100%);
|
||||||
|
}
|
||||||
&-info {
|
&-info {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 4em;
|
padding: 4em;
|
||||||
@@ -23,6 +26,14 @@
|
|||||||
border-radius: $border-radius-default;
|
border-radius: $border-radius-default;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
&-icon {
|
||||||
|
font-size: 4em;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
height: 100%;
|
||||||
|
background: rgb(255 255 255 / 0.2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
&-controls {
|
&-controls {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -51,7 +62,7 @@
|
|||||||
}
|
}
|
||||||
&.active{
|
&.active{
|
||||||
.audio-queue-track-info-name{
|
.audio-queue-track-info-name{
|
||||||
color: $clr-accent-light;
|
color: $clr-accent-default;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import PlayNextButton from "@/components/buttons/playNextButton";
|
|||||||
import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
|
import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
|
||||||
import QueueTrack from "@/components/queueTrack";
|
import QueueTrack from "@/components/queueTrack";
|
||||||
import { getRuntimeMusic, secToTicks, ticksToSec } from "@/utils/date/time";
|
import { getRuntimeMusic, secToTicks, ticksToSec } from "@/utils/date/time";
|
||||||
import { useDrop } from "react-dnd";
|
import { getLyricsApi } from "@jellyfin/sdk/lib/utils/api/lyrics-api";
|
||||||
import { Identifier } from "typescript";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
|
||||||
export const Route = createFileRoute("/_api/player/audio")({
|
export const Route = createFileRoute("/_api/player/audio")({
|
||||||
component: AudioPlayerRoute,
|
component: AudioPlayerRoute,
|
||||||
@@ -32,6 +32,16 @@ function AudioPlayerRoute() {
|
|||||||
const [progress, setProgress] = useState<number | number[]>(
|
const [progress, setProgress] = useState<number | number[]>(
|
||||||
audioPlayer?.currentTime ?? 0,
|
audioPlayer?.currentTime ?? 0,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const lyrics = useQuery({
|
||||||
|
queryKey: ["player", "audio", item?.Id, "lyrics"],
|
||||||
|
queryFn: async () =>
|
||||||
|
await getLyricsApi(api).getLyrics({
|
||||||
|
itemId: item?.Id,
|
||||||
|
}),
|
||||||
|
enabled: Boolean(item?.Id),
|
||||||
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
audioPlayer?.addEventListener("timeupdate", () => {
|
audioPlayer?.addEventListener("timeupdate", () => {
|
||||||
setProgress(audioPlayer.currentTime);
|
setProgress(audioPlayer.currentTime);
|
||||||
@@ -42,7 +52,7 @@ function AudioPlayerRoute() {
|
|||||||
<div className="scrollY padded-top flex flex-column" style={{ gap: "1em" }}>
|
<div className="scrollY padded-top flex flex-column" style={{ gap: "1em" }}>
|
||||||
<div className="audio-info-container">
|
<div className="audio-info-container">
|
||||||
<div className="audio-info-image-container">
|
<div className="audio-info-image-container">
|
||||||
{item?.ImageTags ? (
|
{item?.ImageTags?.Primary ? (
|
||||||
<img
|
<img
|
||||||
alt={item.Name ?? "Music"}
|
alt={item.Name ?? "Music"}
|
||||||
src={api.getItemImageUrl(item.Id, "Primary", {
|
src={api.getItemImageUrl(item.Id, "Primary", {
|
||||||
@@ -51,7 +61,9 @@ function AudioPlayerRoute() {
|
|||||||
className="audio-info-image"
|
className="audio-info-image"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<span className="material-symbols-rounded fill">music_note</span>
|
<span className="material-symbols-rounded fill audio-info-image-icon">
|
||||||
|
music_note
|
||||||
|
</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="audio-info">
|
<div className="audio-info">
|
||||||
@@ -116,6 +128,7 @@ function AudioPlayerRoute() {
|
|||||||
<span className="material-symbols-rounded">fast_rewind</span>
|
<span className="material-symbols-rounded">fast_rewind</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<Fab
|
<Fab
|
||||||
|
disabled={!audioPlayer?.readyState}
|
||||||
color="white"
|
color="white"
|
||||||
size="large"
|
size="large"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
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,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -21,8 +21,8 @@ import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
|||||||
import { getPersonsApi } from "@jellyfin/sdk/lib/utils/api/persons-api";
|
import { getPersonsApi } from "@jellyfin/sdk/lib/utils/api/persons-api";
|
||||||
import { getSearchApi } from "@jellyfin/sdk/lib/utils/api/search-api";
|
import { getSearchApi } from "@jellyfin/sdk/lib/utils/api/search-api";
|
||||||
import "./search.scss";
|
import "./search.scss";
|
||||||
import { Dialog } from "@mui/material";
|
import { Dialog, Fab } from "@mui/material";
|
||||||
import { Outlet, createFileRoute } from "@tanstack/react-router";
|
import { Outlet, createFileRoute, useNavigate } from "@tanstack/react-router";
|
||||||
|
|
||||||
export const Route = createFileRoute("/_api/search/")({
|
export const Route = createFileRoute("/_api/search/")({
|
||||||
component: SearchPage,
|
component: SearchPage,
|
||||||
@@ -31,8 +31,11 @@ export const Route = createFileRoute("/_api/search/")({
|
|||||||
function SearchPage() {
|
function SearchPage() {
|
||||||
const api = Route.useRouteContext().api;
|
const api = Route.useRouteContext().api;
|
||||||
|
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const { query } = Route.useSearch();
|
||||||
|
|
||||||
const [searchTerm, setSearchTerm] = useState("");
|
const [searchTerm, setSearchTerm] = useState("");
|
||||||
const searchParam = useDebounce(searchTerm, 500);
|
// const searchParam = useDebounce(query, 500);
|
||||||
|
|
||||||
const user = useQuery({
|
const user = useQuery({
|
||||||
queryKey: ["user"],
|
queryKey: ["user"],
|
||||||
@@ -47,11 +50,11 @@ function SearchPage() {
|
|||||||
const itemLimit = 12;
|
const itemLimit = 12;
|
||||||
|
|
||||||
const movies = useQuery({
|
const movies = useQuery({
|
||||||
queryKey: ["search", "items", "Movie", searchParam],
|
queryKey: ["search", "items", "Movie", query],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data?.Id,
|
userId: user.data?.Id,
|
||||||
searchTerm,
|
searchTerm: query,
|
||||||
includeItemTypes: [BaseItemKind.Movie],
|
includeItemTypes: [BaseItemKind.Movie],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
limit: itemLimit,
|
limit: itemLimit,
|
||||||
@@ -61,11 +64,11 @@ function SearchPage() {
|
|||||||
enabled: user.isSuccess,
|
enabled: user.isSuccess,
|
||||||
});
|
});
|
||||||
const series = useQuery({
|
const series = useQuery({
|
||||||
queryKey: ["search", "items", "Series", searchParam],
|
queryKey: ["search", "items", "Series", query],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data?.Id,
|
userId: user.data?.Id,
|
||||||
searchTerm,
|
searchTerm: query,
|
||||||
includeItemTypes: [BaseItemKind.Series],
|
includeItemTypes: [BaseItemKind.Series],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
limit: itemLimit,
|
limit: itemLimit,
|
||||||
@@ -75,11 +78,11 @@ function SearchPage() {
|
|||||||
enabled: user.isSuccess,
|
enabled: user.isSuccess,
|
||||||
});
|
});
|
||||||
const musicAlbum = useQuery({
|
const musicAlbum = useQuery({
|
||||||
queryKey: ["search", "items", "MusicAlbum", searchParam],
|
queryKey: ["search", "items", "MusicAlbum", query],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data?.Id,
|
userId: user.data?.Id,
|
||||||
searchTerm,
|
searchTerm: query,
|
||||||
includeItemTypes: [BaseItemKind.MusicAlbum],
|
includeItemTypes: [BaseItemKind.MusicAlbum],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
limit: itemLimit,
|
limit: itemLimit,
|
||||||
@@ -89,11 +92,11 @@ function SearchPage() {
|
|||||||
enabled: user.isSuccess,
|
enabled: user.isSuccess,
|
||||||
});
|
});
|
||||||
const audio = useQuery({
|
const audio = useQuery({
|
||||||
queryKey: ["search", "items", "Audio", searchParam],
|
queryKey: ["search", "items", "Audio", query],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data?.Id,
|
userId: user.data?.Id,
|
||||||
searchTerm,
|
searchTerm: query,
|
||||||
includeItemTypes: [BaseItemKind.Audio],
|
includeItemTypes: [BaseItemKind.Audio],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
limit: itemLimit,
|
limit: itemLimit,
|
||||||
@@ -103,11 +106,11 @@ function SearchPage() {
|
|||||||
enabled: user.isSuccess,
|
enabled: user.isSuccess,
|
||||||
});
|
});
|
||||||
const book = useQuery({
|
const book = useQuery({
|
||||||
queryKey: ["search", "items", "Book", searchParam],
|
queryKey: ["search", "items", "Book", query],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data?.Id,
|
userId: user.data?.Id,
|
||||||
searchTerm,
|
searchTerm: query,
|
||||||
includeItemTypes: [BaseItemKind.Book],
|
includeItemTypes: [BaseItemKind.Book],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
limit: itemLimit,
|
limit: itemLimit,
|
||||||
@@ -117,11 +120,11 @@ function SearchPage() {
|
|||||||
enabled: user.isSuccess,
|
enabled: user.isSuccess,
|
||||||
});
|
});
|
||||||
const musicArtists = useQuery({
|
const musicArtists = useQuery({
|
||||||
queryKey: ["search", "items", "MusicArtists", searchParam],
|
queryKey: ["search", "items", "MusicArtists", query],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user.data?.Id,
|
userId: user.data?.Id,
|
||||||
searchTerm,
|
searchTerm: query,
|
||||||
includeItemTypes: [BaseItemKind.MusicArtist],
|
includeItemTypes: [BaseItemKind.MusicArtist],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
limit: itemLimit,
|
limit: itemLimit,
|
||||||
@@ -131,11 +134,11 @@ function SearchPage() {
|
|||||||
enabled: user.isSuccess,
|
enabled: user.isSuccess,
|
||||||
});
|
});
|
||||||
const person = useQuery({
|
const person = useQuery({
|
||||||
queryKey: ["search", "items", "Person", searchParam],
|
queryKey: ["search", "items", "Person", query],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getPersonsApi(api).getPersons({
|
const result = await getPersonsApi(api).getPersons({
|
||||||
userId: user.data?.Id,
|
userId: user.data?.Id,
|
||||||
searchTerm,
|
searchTerm: query,
|
||||||
limit: itemLimit,
|
limit: itemLimit,
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
@@ -143,11 +146,11 @@ function SearchPage() {
|
|||||||
enabled: user.isSuccess,
|
enabled: user.isSuccess,
|
||||||
});
|
});
|
||||||
const episodes = useQuery({
|
const episodes = useQuery({
|
||||||
queryKey: ["search", "items", "Episodes", searchParam],
|
queryKey: ["search", "items", "Episodes", query],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getSearchApi(api).getSearchHints({
|
const result = await getSearchApi(api).getSearchHints({
|
||||||
userId: user.data?.Id,
|
userId: user.data?.Id,
|
||||||
searchTerm,
|
searchTerm: query,
|
||||||
limit: itemLimit,
|
limit: itemLimit,
|
||||||
includeItemTypes: ["Episode"],
|
includeItemTypes: ["Episode"],
|
||||||
});
|
});
|
||||||
@@ -182,50 +185,28 @@ function SearchPage() {
|
|||||||
placeholder="Search"
|
placeholder="Search"
|
||||||
hiddenLabel
|
hiddenLabel
|
||||||
className="search-searchbar"
|
className="search-searchbar"
|
||||||
inputProps={{
|
slotProps={{
|
||||||
className: "search-searchbar-input",
|
input: {
|
||||||
}}
|
style: {
|
||||||
InputProps={{
|
border: "100px !important",
|
||||||
style: {
|
},
|
||||||
border: "100px !important",
|
autoFocus: true,
|
||||||
|
},
|
||||||
|
htmlInput: {
|
||||||
|
className: "search-searchbar-input",
|
||||||
},
|
},
|
||||||
autoFocus: true,
|
|
||||||
startAdornment: (
|
|
||||||
<InputAdornment position="start">
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
position: "relative",
|
|
||||||
display: "inline-flex",
|
|
||||||
alignItems: "center",
|
|
||||||
justifyContent: "center",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<CircularProgress
|
|
||||||
style={{
|
|
||||||
position: "absolute",
|
|
||||||
transition: "opacity 250ms",
|
|
||||||
opacity:
|
|
||||||
Boolean(searchTerm) &&
|
|
||||||
(movies.isPending ||
|
|
||||||
series.isPending ||
|
|
||||||
audio.isPending ||
|
|
||||||
musicAlbum.isPending ||
|
|
||||||
musicArtists.isPending ||
|
|
||||||
person.isPending ||
|
|
||||||
book.isPending)
|
|
||||||
? 1
|
|
||||||
: 0,
|
|
||||||
}}
|
|
||||||
size={35}
|
|
||||||
/>
|
|
||||||
<span className="material-symbols-rounded">search</span>
|
|
||||||
</div>
|
|
||||||
</InputAdornment>
|
|
||||||
),
|
|
||||||
}}
|
}}
|
||||||
value={searchTerm}
|
value={searchTerm}
|
||||||
onChange={(e) => setSearchTerm(e.target.value)}
|
onChange={(e) => setSearchTerm(e.currentTarget.value)}
|
||||||
/>
|
/>
|
||||||
|
<Fab
|
||||||
|
size="medium"
|
||||||
|
onClick={() =>
|
||||||
|
navigate({ search: { query: searchTerm }, replace: true })
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<span className="material-symbols-rounded">search</span>
|
||||||
|
</Fab>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
@@ -242,7 +223,7 @@ function SearchPage() {
|
|||||||
imageType={"Primary"}
|
imageType={"Primary"}
|
||||||
cardCaption={item.ProductionYear}
|
cardCaption={item.ProductionYear}
|
||||||
cardType="portrait"
|
cardType="portrait"
|
||||||
queryKey={["search", "items", "Movie", searchParam]}
|
queryKey={["search", "items", "Movie", query]}
|
||||||
userId={user.data.Id}
|
userId={user.data.Id}
|
||||||
imageBlurhash={
|
imageBlurhash={
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
!!item.ImageBlurHashes?.Primary &&
|
||||||
@@ -270,7 +251,7 @@ function SearchPage() {
|
|||||||
: "Present"
|
: "Present"
|
||||||
}`}
|
}`}
|
||||||
cardType="portrait"
|
cardType="portrait"
|
||||||
queryKey={["search", "items", "Series", searchParam]}
|
queryKey={["search", "items", "Series", query]}
|
||||||
userId={user.data.Id}
|
userId={user.data.Id}
|
||||||
imageBlurhash={
|
imageBlurhash={
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
!!item.ImageBlurHashes?.Primary &&
|
||||||
@@ -291,7 +272,7 @@ function SearchPage() {
|
|||||||
item={episode}
|
item={episode}
|
||||||
cardTitle={episode.Series}
|
cardTitle={episode.Series}
|
||||||
cardCaption={`S${episode.ParentIndexNumber}:E${episode.IndexNumber} - ${episode.Name}`}
|
cardCaption={`S${episode.ParentIndexNumber}:E${episode.IndexNumber} - ${episode.Name}`}
|
||||||
queryKey={["search", "items", "Episodes", searchParam]}
|
queryKey={["search", "items", "Episodes", query]}
|
||||||
userId={user.data.Id}
|
userId={user.data.Id}
|
||||||
disableRunTime
|
disableRunTime
|
||||||
/>
|
/>
|
||||||
@@ -309,7 +290,7 @@ function SearchPage() {
|
|||||||
imageType={"Primary"}
|
imageType={"Primary"}
|
||||||
cardCaption={item.ProductionYear}
|
cardCaption={item.ProductionYear}
|
||||||
cardType="square"
|
cardType="square"
|
||||||
queryKey={["search", "items", "Audio", searchParam]}
|
queryKey={["search", "items", "Audio", query]}
|
||||||
userId={user.data.Id}
|
userId={user.data.Id}
|
||||||
imageBlurhash={
|
imageBlurhash={
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
!!item.ImageBlurHashes?.Primary &&
|
||||||
@@ -332,7 +313,7 @@ function SearchPage() {
|
|||||||
imageType={"Primary"}
|
imageType={"Primary"}
|
||||||
cardCaption={item.AlbumArtist}
|
cardCaption={item.AlbumArtist}
|
||||||
cardType={"square"}
|
cardType={"square"}
|
||||||
queryKey={["search", "items", "MusicAlbum", searchParam]}
|
queryKey={["search", "items", "MusicAlbum", query]}
|
||||||
userId={user.data.Id}
|
userId={user.data.Id}
|
||||||
imageBlurhash={
|
imageBlurhash={
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
!!item.ImageBlurHashes?.Primary &&
|
||||||
@@ -355,7 +336,7 @@ function SearchPage() {
|
|||||||
cardCaption={item.ProductionYear}
|
cardCaption={item.ProductionYear}
|
||||||
disableOverlay
|
disableOverlay
|
||||||
cardType={"portrait"}
|
cardType={"portrait"}
|
||||||
queryKey={["search", "items", "Book", searchParam]}
|
queryKey={["search", "items", "Book", query]}
|
||||||
userId={user.data.Id}
|
userId={user.data.Id}
|
||||||
imageBlurhash={
|
imageBlurhash={
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
!!item.ImageBlurHashes?.Primary &&
|
||||||
@@ -377,7 +358,7 @@ function SearchPage() {
|
|||||||
imageType={"Primary"}
|
imageType={"Primary"}
|
||||||
disableOverlay
|
disableOverlay
|
||||||
cardType={"square"}
|
cardType={"square"}
|
||||||
queryKey={["search", "items", "MusicArtists", searchParam]}
|
queryKey={["search", "items", "MusicArtists", query]}
|
||||||
userId={user.data.Id}
|
userId={user.data.Id}
|
||||||
imageBlurhash={
|
imageBlurhash={
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
!!item.ImageBlurHashes?.Primary &&
|
||||||
@@ -399,7 +380,7 @@ function SearchPage() {
|
|||||||
imageType={"Primary"}
|
imageType={"Primary"}
|
||||||
disableOverlay
|
disableOverlay
|
||||||
cardType={"square"}
|
cardType={"square"}
|
||||||
queryKey={["search", "items", "Person", searchParam]}
|
queryKey={["search", "items", "Person", query]}
|
||||||
userId={user.data.Id}
|
userId={user.data.Id}
|
||||||
imageBlurhash={
|
imageBlurhash={
|
||||||
!!item.ImageBlurHashes?.Primary &&
|
!!item.ImageBlurHashes?.Primary &&
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
}
|
}
|
||||||
&-input {
|
&-input {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 0.75em 1.5em !important;
|
padding: 0.8em 1.5em !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user