mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add retry global search link button
This commit is contained in:
parent
1fd314213a
commit
ad01e8669d
4 changed files with 18 additions and 5 deletions
|
@ -33,7 +33,7 @@ export const useSearchItems = (
|
|||
return useQuery({
|
||||
queryKey: ['SearchItems', collectionType, parentId, searchTerm],
|
||||
queryFn: async ({ signal }) => {
|
||||
if (liveTvSections) {
|
||||
if (liveTvSections && collectionType && isLivetv(collectionType)) {
|
||||
return sortSections(liveTvSections);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, { type FC } from 'react';
|
||||
import React, { useCallback, type FC } from 'react';
|
||||
import { useSearchItems } from '../api/useSearchItems';
|
||||
import globalize from '../../../../../lib/globalize';
|
||||
import Loading from '../../../../../components/loading/LoadingComponent';
|
||||
|
@ -6,6 +6,8 @@ import SearchResultsRow from './SearchResultsRow';
|
|||
import { CardShape } from 'utils/card';
|
||||
import { CollectionType } from '@jellyfin/sdk/lib/generated-client/models/collection-type';
|
||||
import { Section } from '../types';
|
||||
import LinkButton from 'elements/emby-button/LinkButton';
|
||||
import { useLocation, useSearchParams } from 'react-router-dom';
|
||||
|
||||
interface SearchResultsProps {
|
||||
parentId?: string;
|
||||
|
@ -22,6 +24,13 @@ const SearchResults: FC<SearchResultsProps> = ({
|
|||
query
|
||||
}) => {
|
||||
const { data, isPending } = useSearchItems(parentId, collectionType, query?.trim());
|
||||
const location = useLocation();
|
||||
const [ searchParams ] = useSearchParams();
|
||||
|
||||
const getUri = useCallback(() => {
|
||||
searchParams.delete('collectionType');
|
||||
return `${location.pathname}?${searchParams.toString()}`;
|
||||
}, [ searchParams, location.pathname ]);
|
||||
|
||||
if (isPending) return <Loading />;
|
||||
|
||||
|
@ -29,6 +38,11 @@ const SearchResults: FC<SearchResultsProps> = ({
|
|||
return (
|
||||
<div className='noItemsMessage centerMessage'>
|
||||
{globalize.translate('SearchResultsEmpty', query)}
|
||||
{collectionType && (
|
||||
<div>
|
||||
<LinkButton href={getUri()}>{globalize.translate('RetryWithGlobalSearch')}</LinkButton>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ export function getTitleFromType(type: BaseItemKind) {
|
|||
export function getItemTypesFromCollectionType(collectionType: CollectionType | undefined) {
|
||||
switch (collectionType) {
|
||||
case CollectionType.Movies:
|
||||
return [BaseItemKind.Movie];
|
||||
return [ BaseItemKind.Movie ];
|
||||
case CollectionType.Tvshows:
|
||||
return [
|
||||
BaseItemKind.Series,
|
||||
|
@ -122,8 +122,6 @@ export function getItemTypesFromCollectionType(collectionType: CollectionType |
|
|||
BaseItemKind.MusicAlbum,
|
||||
BaseItemKind.Audio
|
||||
];
|
||||
case CollectionType.Livetv:
|
||||
return [];
|
||||
default:
|
||||
return [
|
||||
BaseItemKind.Movie,
|
||||
|
|
|
@ -1451,6 +1451,7 @@
|
|||
"ReplaceExistingImages": "Replace existing images",
|
||||
"ReplaceTrickplayImages": "Replace existing trickplay images",
|
||||
"Retry": "Retry",
|
||||
"RetryWithGlobalSearch": "Retry with global search",
|
||||
"Reset": "Reset",
|
||||
"ResetPassword": "Reset Password",
|
||||
"ResolutionMatchSource": "Match Source",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue