* feat(blacklist): add 'Hide Blacklisted Items' setting to general settings and UI * feat(migration): add HideBlacklistedItems migration for PostgreSQL and SQLite * feat(settings): add hideBlacklisted option to application settings * feat(settings): add tooltips for hideAvailable and hideBlacklisted options in settings * chore(migration): remove HideBlacklistedItems migration files for PostgreSQL and SQLite * docs(settings): clarify description of 'Hide Blacklisted Items' setting to specify it affects all users * docs(settings): update tooltip and description for 'Hide Blacklisted Items' to clarify it applies to all users, including administrators * docs(settings): clarify 'Hide Blacklisted Items' functionality to specify it applies only to administrators with the "Manage Blacklist" permission * fix(hooks): update permission check for 'Hide Blacklisted Items' to include 'Manage Blacklist' * fix(settings): update tooltip for 'Hide Blacklisted Items' to clarify it applies to all users with the "Manage Blacklist" permission * feat(settings): add experimental badge to settings tooltip for 'Hide Available' option
64 lines
1.5 KiB
TypeScript
64 lines
1.5 KiB
TypeScript
import Header from '@app/components/Common/Header';
|
|
import ListView from '@app/components/Common/ListView';
|
|
import PageTitle from '@app/components/Common/PageTitle';
|
|
import useDiscover from '@app/hooks/useDiscover';
|
|
import Error from '@app/pages/_error';
|
|
import defineMessages from '@app/utils/defineMessages';
|
|
import type {
|
|
MovieResult,
|
|
PersonResult,
|
|
TvResult,
|
|
} from '@server/models/Search';
|
|
import { useRouter } from 'next/router';
|
|
import { useIntl } from 'react-intl';
|
|
|
|
const messages = defineMessages('components.Search', {
|
|
search: 'Search',
|
|
searchresults: 'Search Results',
|
|
});
|
|
|
|
const Search = () => {
|
|
const intl = useIntl();
|
|
const router = useRouter();
|
|
|
|
const {
|
|
isLoadingInitialData,
|
|
isEmpty,
|
|
isLoadingMore,
|
|
isReachingEnd,
|
|
titles,
|
|
fetchMore,
|
|
error,
|
|
} = useDiscover<MovieResult | TvResult | PersonResult>(
|
|
`/api/v1/search`,
|
|
{
|
|
query: router.query.query,
|
|
},
|
|
{ hideAvailable: false, hideBlacklisted: false }
|
|
);
|
|
|
|
if (error) {
|
|
return <Error statusCode={500} />;
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<PageTitle title={intl.formatMessage(messages.search)} />
|
|
<div className="mt-1 mb-5">
|
|
<Header>{intl.formatMessage(messages.searchresults)}</Header>
|
|
</div>
|
|
<ListView
|
|
items={titles}
|
|
isEmpty={isEmpty}
|
|
isLoading={
|
|
isLoadingInitialData || (isLoadingMore && (titles?.length ?? 0) > 0)
|
|
}
|
|
isReachingEnd={isReachingEnd}
|
|
onScrollBottom={fetchMore}
|
|
/>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default Search;
|